Skip to content

Commit 799690b

Browse files
committed
Remove stmt_crate_directive, it's vestigial and confusing.
1 parent dfd699a commit 799690b

File tree

7 files changed

+2
-37
lines changed

7 files changed

+2
-37
lines changed

src/comp/middle/alias.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,6 @@ fn visit_block(cx: @ctx, b: ast::blk, sc: scope, v: vt<scope>) {
154154
ast::stmt_expr(ex, _) {
155155
v.visit_expr(ex, sc, v);
156156
}
157-
ast::stmt_crate_directive(cd) {
158-
visit::visit_crate_directive(cd, sc, v);
159-
}
160157
}
161158
}
162159
visit::visit_expr_opt(b.node.expr, sc, v);

src/comp/middle/tstate/auxiliary.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,10 +319,6 @@ fn stmt_to_ann(ccx: crate_ctxt, s: stmt) -> ts_ann {
319319
alt s.node {
320320
stmt_decl(_, id) { ret node_id_to_ts_ann(ccx, id); }
321321
stmt_expr(_, id) { ret node_id_to_ts_ann(ccx, id); }
322-
stmt_crate_directive(_) {
323-
log_err "expecting an annotated statement here";
324-
fail;
325-
}
326322
}
327323
}
328324

src/comp/middle/ty.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,10 +1659,6 @@ fn stmt_node_id(s: @ast::stmt) -> ast::node_id {
16591659
alt s.node {
16601660
ast::stmt_decl(_, id) { ret id; }
16611661
ast::stmt_expr(_, id) { ret id; }
1662-
ast::stmt_crate_directive(_) {
1663-
log_err "ty::stmt_node_id(): crate directive found";
1664-
fail;
1665-
}
16661662
}
16671663
}
16681664

src/comp/syntax/ast.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,6 @@ type stmt = spanned<stmt_>;
145145
tag stmt_ {
146146
stmt_decl(@decl, node_id);
147147
stmt_expr(@expr, node_id);
148-
149-
// These only exist in crate-level blocks.
150-
stmt_crate_directive(@crate_directive);
151148
}
152149

153150
tag init_op { init_assign; init_move; }

src/comp/syntax/fold.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,7 @@ fn noop_fold_stmt(s: stmt_, fld: ast_fold) -> stmt_ {
258258
ret alt s {
259259
stmt_decl(d, nid) { stmt_decl(fld.fold_decl(d), nid) }
260260
stmt_expr(e, nid) { stmt_expr(fld.fold_expr(e), nid) }
261-
stmt_crate_directive(cd) {
262-
stmt_crate_directive(fld.fold_crate_directive(cd))
263-
}
264-
};
261+
};
265262
}
266263

267264
fn noop_fold_arm(a: arm, fld: ast_fold) -> arm {

src/comp/syntax/parse/parser.rs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1525,18 +1525,6 @@ fn parse_let(p: parser) -> @ast::decl {
15251525
}
15261526

15271527
fn parse_stmt(p: parser) -> @ast::stmt {
1528-
if p.get_file_type() == SOURCE_FILE {
1529-
ret parse_source_stmt(p);
1530-
} else { ret parse_crate_stmt(p); }
1531-
}
1532-
1533-
fn parse_crate_stmt(p: parser) -> @ast::stmt {
1534-
let cdir = parse_crate_directive(p, []);
1535-
ret @spanned(cdir.span.lo, cdir.span.hi,
1536-
ast::stmt_crate_directive(@cdir));
1537-
}
1538-
1539-
fn parse_source_stmt(p: parser) -> @ast::stmt {
15401528
let lo = p.get_lo_pos();
15411529
if eat_word(p, "let") {
15421530
let decl = parse_let(p);
@@ -1642,10 +1630,6 @@ fn stmt_ends_with_semi(stmt: ast::stmt) -> bool {
16421630
ast::stmt_expr(e, _) {
16431631
ret expr_has_value(e);
16441632
}
1645-
// We should not be calling this on a cdir.
1646-
ast::stmt_crate_directive(cdir) {
1647-
fail;
1648-
}
16491633
}
16501634
}
16511635

@@ -1707,8 +1691,7 @@ fn parse_block_tail(p: parser, lo: uint, s: ast::blk_check_mode) -> ast::blk {
17071691
// Not an expression statement.
17081692
stmts += [stmt];
17091693

1710-
if p.get_file_type() == SOURCE_FILE &&
1711-
stmt_ends_with_semi(*stmt) {
1694+
if stmt_ends_with_semi(*stmt) {
17121695
expect(p, token::SEMI);
17131696
}
17141697
}

src/comp/syntax/visit.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ fn visit_stmt<E>(s: @stmt, e: E, v: vt<E>) {
196196
alt s.node {
197197
stmt_decl(d, _) { v.visit_decl(d, e, v); }
198198
stmt_expr(ex, _) { v.visit_expr(ex, e, v); }
199-
stmt_crate_directive(cd) { visit_crate_directive(cd, e, v); }
200199
}
201200
}
202201

0 commit comments

Comments
 (0)