about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGraydon Hoare <graydon@mozilla.com>2011-12-07 13:12:05 -0800
committerGraydon Hoare <graydon@mozilla.com>2011-12-07 13:33:00 -0800
commit799690bea0dbcf427bf7a9a813fec163eedf217d (patch)
tree540b6eaeebfeb327462a143479830d0ce044b794
parentdfd699a8521c6fecd49b260e541764134c54b591 (diff)
downloadrust-799690bea0dbcf427bf7a9a813fec163eedf217d.tar.gz
rust-799690bea0dbcf427bf7a9a813fec163eedf217d.zip
Remove stmt_crate_directive, it's vestigial and confusing.
-rw-r--r--src/comp/middle/alias.rs3
-rw-r--r--src/comp/middle/tstate/auxiliary.rs4
-rw-r--r--src/comp/middle/ty.rs4
-rw-r--r--src/comp/syntax/ast.rs3
-rw-r--r--src/comp/syntax/fold.rs5
-rw-r--r--src/comp/syntax/parse/parser.rs19
-rw-r--r--src/comp/syntax/visit.rs1
7 files changed, 2 insertions, 37 deletions
diff --git a/src/comp/middle/alias.rs b/src/comp/middle/alias.rs
index eb9122bfa7d..909e90fd0c6 100644
--- a/src/comp/middle/alias.rs
+++ b/src/comp/middle/alias.rs
@@ -154,9 +154,6 @@ fn visit_block(cx: @ctx, b: ast::blk, sc: scope, v: vt<scope>) {
           ast::stmt_expr(ex, _) {
             v.visit_expr(ex, sc, v);
           }
-          ast::stmt_crate_directive(cd) {
-            visit::visit_crate_directive(cd, sc, v);
-          }
         }
     }
     visit::visit_expr_opt(b.node.expr, sc, v);
diff --git a/src/comp/middle/tstate/auxiliary.rs b/src/comp/middle/tstate/auxiliary.rs
index b910dce220f..315eac89147 100644
--- a/src/comp/middle/tstate/auxiliary.rs
+++ b/src/comp/middle/tstate/auxiliary.rs
@@ -319,10 +319,6 @@ fn stmt_to_ann(ccx: crate_ctxt, s: stmt) -> ts_ann {
     alt s.node {
       stmt_decl(_, id) { ret node_id_to_ts_ann(ccx, id); }
       stmt_expr(_, id) { ret node_id_to_ts_ann(ccx, id); }
-      stmt_crate_directive(_) {
-        log_err "expecting an annotated statement here";
-        fail;
-      }
     }
 }
 
diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs
index 9c2ddedc56b..00699238b7f 100644
--- a/src/comp/middle/ty.rs
+++ b/src/comp/middle/ty.rs
@@ -1659,10 +1659,6 @@ fn stmt_node_id(s: @ast::stmt) -> ast::node_id {
     alt s.node {
       ast::stmt_decl(_, id) { ret id; }
       ast::stmt_expr(_, id) { ret id; }
-      ast::stmt_crate_directive(_) {
-        log_err "ty::stmt_node_id(): crate directive found";
-        fail;
-      }
     }
 }
 
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); }
     }
 }