diff options
| author | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-01-22 21:09:43 -0800 |
|---|---|---|
| committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-01-23 15:48:08 -0800 |
| commit | 9dc59e15061827122dc0f08d3f66acd17ba329dc (patch) | |
| tree | d98b61d751f5db6d33c844d3706a9c6a4f399524 /src/comp/syntax/print | |
| parent | e51599932478db1d841912a6e0a10cbc20335e1f (diff) | |
| download | rust-9dc59e15061827122dc0f08d3f66acd17ba329dc.tar.gz rust-9dc59e15061827122dc0f08d3f66acd17ba329dc.zip | |
Export all enum variants by default; new syntax for selectively exporting variants
See issue 1426 for details. Now, the semantics of "export t;" where t is a tag are
to export all of t's variants as well. "export t{};" exports t but not its
variants, while "export t{a, b, c};" exports only variants a, b, c of t.
To do:
- documentation
- there's currently no checking that a, b, c are actually variants of t in the
above example
- there's also no checking that t is an enum type, in the second two examples above
- change the modules listed in issue 1426 that should have the old export
semantics to use the t{} syntax
I deleted the test export-no-tag-variants since we're doing the opposite now,
and other tests cover the same behavior.
Diffstat (limited to 'src/comp/syntax/print')
| -rw-r--r-- | src/comp/syntax/print/pprust.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs index a57cf3add14..2ebcaa055a7 100644 --- a/src/comp/syntax/print/pprust.rs +++ b/src/comp/syntax/print/pprust.rs @@ -1303,6 +1303,19 @@ fn print_view_item(s: ps, item: @ast::view_item) { commasep(s, inconsistent, ids, fn@(s: ps, &&w: ast::ident) { word(s.s, w) }); } + ast::view_item_export_tag_none(id, _) { + head(s, "export"); + word(s.s, id); + word(s.s, "::{}"); + } + ast::view_item_export_tag_some(id, ids, _) { + head(s, "export"); + word(s.s, id); + word(s.s, "::{"); + commasep(s, inconsistent, ids, fn@(s:ps, &&w: ast::import_ident) { + word(s.s, w.node.name) }); + word(s.s, "}"); + } } word(s.s, ";"); end(s); // end inner head-block |
