Remove stmt_crate_directive, it's vestigial and confusing.
This commit is contained in:
parent
dfd699a852
commit
799690bea0
7 changed files with 2 additions and 37 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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; }
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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); }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue