diff options
| author | Graydon Hoare <graydon@mozilla.com> | 2011-12-07 13:12:05 -0800 |
|---|---|---|
| committer | Graydon Hoare <graydon@mozilla.com> | 2011-12-07 13:33:00 -0800 |
| commit | 799690bea0dbcf427bf7a9a813fec163eedf217d (patch) | |
| tree | 540b6eaeebfeb327462a143479830d0ce044b794 /src/comp/syntax | |
| parent | dfd699a8521c6fecd49b260e541764134c54b591 (diff) | |
| download | rust-799690bea0dbcf427bf7a9a813fec163eedf217d.tar.gz rust-799690bea0dbcf427bf7a9a813fec163eedf217d.zip | |
Remove stmt_crate_directive, it's vestigial and confusing.
Diffstat (limited to 'src/comp/syntax')
| -rw-r--r-- | src/comp/syntax/ast.rs | 3 | ||||
| -rw-r--r-- | src/comp/syntax/fold.rs | 5 | ||||
| -rw-r--r-- | src/comp/syntax/parse/parser.rs | 19 | ||||
| -rw-r--r-- | src/comp/syntax/visit.rs | 1 |
4 files changed, 2 insertions, 26 deletions
diff --git a/src/comp/syntax/ast.rs b/src/comp/syntax/ast.rs index e0fd6617708..a501d083aae 100644 --- a/src/comp/syntax/ast.rs +++ b/src/comp/syntax/ast.rs @@ -145,9 +145,6 @@ type stmt = spanned<stmt_>; tag stmt_ { stmt_decl(@decl, node_id); stmt_expr(@expr, node_id); - - // These only exist in crate-level blocks. - stmt_crate_directive(@crate_directive); } tag init_op { init_assign; init_move; } diff --git a/src/comp/syntax/fold.rs b/src/comp/syntax/fold.rs index 4f26667800b..0e76e9a15d1 100644 --- a/src/comp/syntax/fold.rs +++ b/src/comp/syntax/fold.rs @@ -258,10 +258,7 @@ fn noop_fold_stmt(s: stmt_, fld: ast_fold) -> stmt_ { ret alt s { stmt_decl(d, nid) { stmt_decl(fld.fold_decl(d), nid) } stmt_expr(e, nid) { stmt_expr(fld.fold_expr(e), nid) } - stmt_crate_directive(cd) { - stmt_crate_directive(fld.fold_crate_directive(cd)) - } - }; + }; } fn noop_fold_arm(a: arm, fld: ast_fold) -> arm { diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs index 23ed2485f69..2bf7865bf81 100644 --- a/src/comp/syntax/parse/parser.rs +++ b/src/comp/syntax/parse/parser.rs @@ -1525,18 +1525,6 @@ fn parse_let(p: parser) -> @ast::decl { } fn parse_stmt(p: parser) -> @ast::stmt { - if p.get_file_type() == SOURCE_FILE { - ret parse_source_stmt(p); - } else { ret parse_crate_stmt(p); } -} - -fn parse_crate_stmt(p: parser) -> @ast::stmt { - let cdir = parse_crate_directive(p, []); - ret @spanned(cdir.span.lo, cdir.span.hi, - ast::stmt_crate_directive(@cdir)); -} - -fn parse_source_stmt(p: parser) -> @ast::stmt { let lo = p.get_lo_pos(); if eat_word(p, "let") { let decl = parse_let(p); @@ -1642,10 +1630,6 @@ fn stmt_ends_with_semi(stmt: ast::stmt) -> bool { ast::stmt_expr(e, _) { ret expr_has_value(e); } - // We should not be calling this on a cdir. - ast::stmt_crate_directive(cdir) { - fail; - } } } @@ -1707,8 +1691,7 @@ fn parse_block_tail(p: parser, lo: uint, s: ast::blk_check_mode) -> ast::blk { // Not an expression statement. stmts += [stmt]; - if p.get_file_type() == SOURCE_FILE && - stmt_ends_with_semi(*stmt) { + if stmt_ends_with_semi(*stmt) { expect(p, token::SEMI); } } diff --git a/src/comp/syntax/visit.rs b/src/comp/syntax/visit.rs index a4052cec2a0..be4dbef294b 100644 --- a/src/comp/syntax/visit.rs +++ b/src/comp/syntax/visit.rs @@ -196,7 +196,6 @@ fn visit_stmt<E>(s: @stmt, e: E, v: vt<E>) { alt s.node { stmt_decl(d, _) { v.visit_decl(d, e, v); } stmt_expr(ex, _) { v.visit_expr(ex, e, v); } - stmt_crate_directive(cd) { visit_crate_directive(cd, e, v); } } } |
