diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2012-02-27 16:05:17 -0800 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2012-02-28 06:31:28 -0800 |
| commit | bceea8339a87193c25472f22a92dbbaa52ac6ed3 (patch) | |
| tree | 6cc937e467ca51637917677d92ce039f09ac0132 /src/comp/syntax | |
| parent | a1b2f34bd0f301f550a55ad1ccf43b65f3d5a0c1 (diff) | |
| download | rust-bceea8339a87193c25472f22a92dbbaa52ac6ed3.tar.gz rust-bceea8339a87193c25472f22a92dbbaa52ac6ed3.zip | |
change def's that are always local to use node_id, add --inline opt
Diffstat (limited to 'src/comp/syntax')
| -rw-r--r-- | src/comp/syntax/ast.rs | 12 | ||||
| -rw-r--r-- | src/comp/syntax/ast_util.rs | 12 |
2 files changed, 16 insertions, 8 deletions
diff --git a/src/comp/syntax/ast.rs b/src/comp/syntax/ast.rs index 262eac3ca01..9e84cb9cd90 100644 --- a/src/comp/syntax/ast.rs +++ b/src/comp/syntax/ast.rs @@ -33,19 +33,21 @@ type ty_param = {ident: ident, id: node_id, bounds: @[ty_param_bound]}; enum def { def_fn(def_id, purity), - def_self(def_id), + def_self(node_id), def_mod(def_id), def_native_mod(def_id), def_const(def_id), - def_arg(def_id, mode), - def_local(def_id), + def_arg(node_id, mode), + def_local(node_id), def_variant(def_id /* enum */, def_id /* variant */), def_ty(def_id), def_prim_ty(prim_ty), def_ty_param(def_id, uint), - def_binding(def_id), + def_binding(node_id), def_use(def_id), - def_upvar(def_id, @def, node_id), // node_id == expr_fn or expr_fn_block + def_upvar(node_id /* local id of closed over var */, + @def /* closed over def */, + node_id /* expr node that creates the closure */), def_class(def_id), // first def_id is for parent class def_class_field(def_id, def_id), diff --git a/src/comp/syntax/ast_util.rs b/src/comp/syntax/ast_util.rs index d5b33971f8d..fb36fc17216 100644 --- a/src/comp/syntax/ast_util.rs +++ b/src/comp/syntax/ast_util.rs @@ -35,11 +35,17 @@ fn variant_def_ids(d: def) -> {enm: def_id, var: def_id} { fn def_id_of_def(d: def) -> def_id { alt d { - def_fn(id, _) | def_self(id) | def_mod(id) | - def_native_mod(id) | def_const(id) | def_arg(id, _) | def_local(id) | + def_fn(id, _) | def_mod(id) | + def_native_mod(id) | def_const(id) | def_variant(_, id) | def_ty(id) | def_ty_param(id, _) | - def_binding(id) | def_use(id) | def_upvar(id, _, _) | + def_use(id) | def_class(id) | def_class_field(_, id) | def_class_method(_, id) { id } + + def_self(id) | def_arg(id, _) | def_local(id) | + def_upvar(id, _, _) | def_binding(id) { + local_def(id) + } + def_prim_ty(_) { fail; } } } |
