change def's that are always local to use node_id, add --inline opt

This commit is contained in:
Niko Matsakis 2012-02-27 16:05:17 -08:00
parent a1b2f34bd0
commit bceea8339a
19 changed files with 125 additions and 111 deletions

View File

@ -410,12 +410,13 @@ TSREQS := \
FUZZ := $(HBIN3_H_$(CFG_HOST_TRIPLE))/fuzzer$(X)
CARGO := $(HBIN3_H_$(CFG_HOST_TRIPLE))/cargo$(X)
RUSTDOC := $(HBIN3_H_$(CFG_HOST_TRIPLE))/rustdoc$(X)
SERIALIZER := $(HBIN2_H_$(CFG_HOST_TRIPLE))/serializer$(X)
# ^^ Note: we use HBIN2 because that is the only stage for which
# we build a complete rustc by default, and serializer requires
# the complete rustc.
all: rustc $(GENERATED) docs $(FUZZ) $(CARGO) $(RUSTDOC) $(SERIALIZER)
all: rustc $(GENERATED) docs $(FUZZ) $(CARGO) $(RUSTDOC) serializer
serializer: $(HBIN1_H_$(CFG_HOST_TRIPLE))/serializer$(X) \
$(SREQ1_T_$(CFG_HOST_TRIPLE)_H_$(CFG_HOST_TRIPLE))
# ^^ Note: we use HBIN1 because that is built by the snapshot compiler
# and sometimes we need the serializer to build the later stages.
endif

1
configure vendored
View File

@ -670,5 +670,6 @@ rm -f config.mk.bak
msg
copy ${CFG_SRC_DIR}Makefile.in ./Makefile
chmod u-w Makefile # it is generated, make it read-only
step_msg "complete"

View File

@ -177,9 +177,10 @@ fn compile_upto(sess: session, cfg: ast::crate_cfg,
last_uses: last_uses, impl_map: impl_map,
method_map: method_map, dict_map: dict_map};
let ienbld = sess.opts.inline;
let inline_map =
time(time_passes, "inline",
bind inline::instantiate_inlines(ty_cx, maps, crate));
bind inline::instantiate_inlines(ienbld, ty_cx, maps, crate));
let (llmod, link_meta) =
time(time_passes, "translation",
@ -363,6 +364,7 @@ fn build_session_options(match: getopts::match,
lint_opts += [(lint::ctypes, false)];
}
let monomorphize = opt_present(match, "monomorphize");
let inline = opt_present(match, "inline");
let output_type =
if parse_only || no_trans {
@ -441,6 +443,7 @@ fn build_session_options(match: getopts::match,
no_trans: no_trans,
no_asm_comments: no_asm_comments,
monomorphize: monomorphize,
inline: inline,
warn_unused_imports: warn_unused_imports};
ret sopts;
}
@ -511,6 +514,7 @@ fn opts() -> [getopts::opt] {
optflag("no-verify"),
optflag("no-lint-ctypes"),
optflag("monomorphize"),
optflag("inline"),
optmulti("cfg"), optflag("test"),
optflag("lib"), optflag("bin"), optflag("static"), optflag("gc"),
optflag("no-asm-comments"),

View File

@ -46,6 +46,7 @@ type options =
no_trans: bool,
no_asm_comments: bool,
monomorphize: bool,
inline: bool,
warn_unused_imports: bool};
type crate_metadata = {name: str, data: [u8]};

View File

@ -354,24 +354,22 @@ impl of tr for ast::def {
fn tr(xcx: extended_decode_ctxt) -> ast::def {
alt self {
ast::def_fn(did, p) { ast::def_fn(did.tr(xcx), p) }
ast::def_self(did) { ast::def_self(did.tr(xcx)) }
ast::def_self(nid) { ast::def_self(xcx.tr_id(nid)) }
ast::def_mod(did) { ast::def_mod(did.tr(xcx)) }
ast::def_native_mod(did) { ast::def_native_mod(did.tr(xcx)) }
ast::def_const(did) { ast::def_const(did.tr(xcx)) }
ast::def_arg(did, m) { ast::def_arg(did.tr_intern(xcx), m) }
ast::def_local(did) { ast::def_local(did.tr_intern(xcx)) }
ast::def_arg(nid, m) { ast::def_arg(xcx.tr_id(nid), m) }
ast::def_local(nid) { ast::def_local(xcx.tr_id(nid)) }
ast::def_variant(e_did, v_did) {
ast::def_variant(e_did.tr(xcx), v_did.tr(xcx))
}
ast::def_ty(did) { ast::def_ty(did.tr(xcx)) }
ast::def_prim_ty(p) { ast::def_prim_ty(p) }
ast::def_ty_param(did, v) { ast::def_ty_param(did.tr(xcx), v) }
ast::def_binding(did) { ast::def_binding(did.tr(xcx)) }
ast::def_binding(nid) { ast::def_binding(xcx.tr_id(nid)) }
ast::def_use(did) { ast::def_use(did.tr(xcx)) }
ast::def_upvar(did, def, node_id) {
ast::def_upvar(did.tr_intern(xcx),
@(*def).tr(xcx),
xcx.tr_id(node_id))
ast::def_upvar(nid1, def, nid2) {
ast::def_upvar(xcx.tr_id(nid1), @(*def).tr(xcx), xcx.tr_id(nid2))
}
ast::def_class(did) {
ast::def_class(did.tr(xcx))

View File

@ -8009,20 +8009,20 @@ fn serialize_161<S: std::serialization::serializer>(s: S,
s.emit_enum("syntax::ast::def",
/*syntax::ast::def_id*//*syntax::ast::purity*/
/*syntax::ast::node_id*/
/*syntax::ast::def_id*/
/*syntax::ast::def_id*/
/*syntax::ast::def_id*/
/*syntax::ast::def_id*/
/*syntax::ast::def_id*/
/*syntax::ast::node_id*/
/*syntax::ast::mode<syntax::ast::rmode>*/
/*syntax::ast::def_id*/
/*syntax::ast::node_id*/
/*syntax::ast::def_id*//*syntax::ast::def_id*/
/*syntax::ast::def_id*/
/*syntax::ast::prim_ty*/
/*syntax::ast::def_id*//*uint*/
/*syntax::ast::node_id*/
/*syntax::ast::def_id*/
/*syntax::ast::def_id*/
/*syntax::ast::def_id*//*@syntax::ast::def*/
/*syntax::ast::node_id*//*@syntax::ast::def*/
/*syntax::ast::node_id*/
/*syntax::ast::def_id*/
/*syntax::ast::def_id*//*syntax::ast::def_id*/
@ -8052,8 +8052,8 @@ fn serialize_161<S: std::serialization::serializer>(s: S,
{
s.emit_enum_variant_arg(0u,
{||
serialize_162(s,
v0)
serialize_27(s,
v0)
})
}
})
@ -8101,8 +8101,8 @@ fn serialize_161<S: std::serialization::serializer>(s: S,
{
s.emit_enum_variant_arg(0u,
{||
serialize_162(s,
v0)
serialize_27(s,
v0)
});
s.emit_enum_variant_arg(1u,
{||
@ -8118,8 +8118,8 @@ fn serialize_161<S: std::serialization::serializer>(s: S,
{
s.emit_enum_variant_arg(0u,
{||
serialize_162(s,
v0)
serialize_27(s,
v0)
})
}
})
@ -8192,8 +8192,8 @@ fn serialize_161<S: std::serialization::serializer>(s: S,
{
s.emit_enum_variant_arg(0u,
{||
serialize_162(s,
v0)
serialize_27(s,
v0)
})
}
})
@ -8216,8 +8216,8 @@ fn serialize_161<S: std::serialization::serializer>(s: S,
{
s.emit_enum_variant_arg(0u,
{||
serialize_162(s,
v0)
serialize_27(s,
v0)
});
s.emit_enum_variant_arg(1u,
{||
@ -8367,7 +8367,7 @@ fn deserialize_161<S: std::serialization::deserializer>(s: S) ->
s.read_enum("syntax::ast::def",
/*syntax::ast::def_id*//*syntax::ast::purity*/
/*syntax::ast::def_id*/
/*syntax::ast::node_id*/
/*syntax::ast::def_id*/
@ -8375,10 +8375,10 @@ fn deserialize_161<S: std::serialization::deserializer>(s: S) ->
/*syntax::ast::def_id*/
/*syntax::ast::def_id*/
/*syntax::ast::node_id*/
/*syntax::ast::mode<syntax::ast::rmode>*/
/*syntax::ast::def_id*/
/*syntax::ast::node_id*/
/*syntax::ast::def_id*//*syntax::ast::def_id*/
@ -8388,11 +8388,11 @@ fn deserialize_161<S: std::serialization::deserializer>(s: S) ->
/*syntax::ast::def_id*//*uint*/
/*syntax::ast::def_id*/
/*syntax::ast::node_id*/
/*syntax::ast::def_id*/
/*syntax::ast::def_id*//*@syntax::ast::def*/
/*syntax::ast::node_id*//*@syntax::ast::def*/
/*syntax::ast::node_id*/
/*syntax::ast::def_id*/
@ -8416,7 +8416,7 @@ fn deserialize_161<S: std::serialization::deserializer>(s: S) ->
1u {
syntax::ast::def_self(s.read_enum_variant_arg(0u,
{||
deserialize_162(s)
deserialize_27(s)
}))
}
2u {
@ -8440,7 +8440,7 @@ fn deserialize_161<S: std::serialization::deserializer>(s: S) ->
5u {
syntax::ast::def_arg(s.read_enum_variant_arg(0u,
{||
deserialize_162(s)
deserialize_27(s)
}),
s.read_enum_variant_arg(1u,
{||
@ -8450,7 +8450,7 @@ fn deserialize_161<S: std::serialization::deserializer>(s: S) ->
6u {
syntax::ast::def_local(s.read_enum_variant_arg(0u,
{||
deserialize_162(s)
deserialize_27(s)
}))
}
7u {
@ -8488,7 +8488,7 @@ fn deserialize_161<S: std::serialization::deserializer>(s: S) ->
11u {
syntax::ast::def_binding(s.read_enum_variant_arg(0u,
{||
deserialize_162(s)
deserialize_27(s)
}))
}
12u {
@ -8500,7 +8500,7 @@ fn deserialize_161<S: std::serialization::deserializer>(s: S) ->
13u {
syntax::ast::def_upvar(s.read_enum_variant_arg(0u,
{||
deserialize_162(s)
deserialize_27(s)
}),
s.read_enum_variant_arg(1u,
{||

View File

@ -18,7 +18,8 @@ enum ctxt = {
mutable to_process: [@ast::item]
};
fn instantiate_inlines(tcx: ty::ctxt,
fn instantiate_inlines(enabled: bool,
tcx: ty::ctxt,
maps: maps,
crate: @ast::crate) -> inline_map {
let vt = visit::mk_vt(@{
@ -31,7 +32,7 @@ fn instantiate_inlines(tcx: ty::ctxt,
let inline_map = ast_util::new_def_id_hash();
let cx = ctxt({tcx: tcx, maps: maps,
inline_map: inline_map, mutable to_process: []});
visit::visit_crate(*crate, cx, vt);
if enabled { visit::visit_crate(*crate, cx, vt); }
while !vec::is_empty(cx.to_process) {
let to_process = [];
to_process <-> cx.to_process;

View File

@ -288,15 +288,15 @@ fn clear_in_current(cx: ctx, my_def: node_id, to: bool) {
fn clear_def_if_path(cx: ctx, d: def, to: bool)
-> option<node_id> {
alt d {
def_local(def_id) {
clear_in_current(cx, def_id.node, to);
some(def_id.node)
def_local(nid) {
clear_in_current(cx, nid, to);
some(nid)
}
def_arg(def_id, m) {
def_arg(nid, m) {
alt ty::resolved_mode(cx.tcx, m) {
by_copy | by_move {
clear_in_current(cx, def_id.node, to);
some(def_id.node)
clear_in_current(cx, nid, to);
some(nid)
}
by_ref | by_val | by_mutbl_ref {
none

View File

@ -1019,7 +1019,7 @@ fn lookup_in_scope(e: env, sc: scopes, sp: span, name: ident, ns: namespace)
ast::item_iface(tps, _) {
if ns == ns_type {
if name == "self" {
ret some(def_self(local_def(it.id)));
ret some(def_self(it.id));
}
ret lookup_in_ty_params(e, name, tps);
}
@ -1050,7 +1050,7 @@ fn lookup_in_scope(e: env, sc: scopes, sp: span, name: ident, ns: namespace)
}
scope_method(id, tps) {
if (name == "self" && ns == ns_val(value_or_enum)) {
ret some(ast::def_self(local_def(id)));
ret some(ast::def_self(id));
} else if ns == ns_type {
ret lookup_in_ty_params(e, name, tps);
}
@ -1073,7 +1073,7 @@ fn lookup_in_scope(e: env, sc: scopes, sp: span, name: ident, ns: namespace)
scope_loop(local) {
if ns == ns_val(value_or_enum) {
alt lookup_in_pat(e, name, local.node.pat) {
some(did) { ret some(ast::def_binding(did)); }
some(nid) { ret some(ast::def_binding(nid)); }
_ { }
}
}
@ -1084,7 +1084,7 @@ fn lookup_in_scope(e: env, sc: scopes, sp: span, name: ident, ns: namespace)
scope_arm(a) {
if ns == ns_val(value_or_enum) {
alt lookup_in_pat(e, name, a.pats[0]) {
some(did) { ret some(ast::def_binding(did)); }
some(nid) { ret some(ast::def_binding(nid)); }
_ { ret none; }
}
}
@ -1127,8 +1127,10 @@ fn lookup_in_scope(e: env, sc: scopes, sp: span, name: ident, ns: namespace)
let i = vec::len(closing);
while i > 0u {
i -= 1u;
df = ast::def_upvar(def_id_of_def(df), @df,
closing[i]);
#debug["name=%s df=%?", name, df];
assert def_is_local(df) || def_is_self(df);
let df_id = def_id_of_def(df).node;
df = ast::def_upvar(df_id, @df, closing[i]);
}
}
ret some(df);
@ -1163,12 +1165,12 @@ fn lookup_in_ty_params(e: env, name: ident, ty_params: [ast::ty_param])
ret none;
}
fn lookup_in_pat(e: env, name: ident, pat: @ast::pat) -> option<def_id> {
fn lookup_in_pat(e: env, name: ident, pat: @ast::pat) -> option<node_id> {
let found = none;
pat_util::pat_bindings(e.def_map, pat) {|p_id, _sp, n|
if str::eq(path_to_ident(n), name)
{ found = some(local_def(p_id)); }
{ found = some(p_id); }
};
ret found;
}
@ -1180,7 +1182,7 @@ fn lookup_in_fn(e: env, name: ident, decl: ast::fn_decl,
ns_val(value_or_enum) {
for a: ast::arg in decl.inputs {
if str::eq(a.ident, name) {
ret some(ast::def_arg(local_def(a.id), a.mode));
ret some(ast::def_arg(a.id, a.mode));
}
}
ret none;
@ -1233,8 +1235,8 @@ fn lookup_in_block(e: env, name: ident, sp: span, b: ast::blk_, pos: uint,
if ns == ns_val(value_or_enum)
&& (i < pos || j < loc_pos) {
alt lookup_in_pat(e, name, loc.node.pat) {
some(did) {
ret some(ast::def_local(did));
some(nid) {
ret some(ast::def_local(nid));
}
_ { }
}

View File

@ -2245,19 +2245,19 @@ fn trans_local_var(cx: block, def: ast::def) -> local_var_result {
}
}
alt def {
ast::def_upvar(did, _, _) {
assert (cx.fcx.llupvars.contains_key(did.node));
ret { val: cx.fcx.llupvars.get(did.node), kind: owned };
ast::def_upvar(nid, _, _) {
assert (cx.fcx.llupvars.contains_key(nid));
ret { val: cx.fcx.llupvars.get(nid), kind: owned };
}
ast::def_arg(did, _) {
assert (cx.fcx.llargs.contains_key(did.node));
ret take_local(cx.fcx.llargs, did.node);
ast::def_arg(nid, _) {
assert (cx.fcx.llargs.contains_key(nid));
ret take_local(cx.fcx.llargs, nid);
}
ast::def_local(did) | ast::def_binding(did) {
assert (cx.fcx.lllocals.contains_key(did.node));
ret take_local(cx.fcx.lllocals, did.node);
ast::def_local(nid) | ast::def_binding(nid) {
assert (cx.fcx.lllocals.contains_key(nid));
ret take_local(cx.fcx.lllocals, nid);
}
ast::def_self(did) {
ast::def_self(nid) {
let slf = option::get(cx.fcx.llself);
let ptr = PointerCast(cx, slf.v,
T_ptr(type_of_or_i8(cx.ccx(), slf.t)));

View File

@ -362,6 +362,7 @@ fn build_closure(bcx0: block,
// Package up the captured upvars
vec::iter(cap_vars) { |cap_var|
#debug["Building closure: captured variable %?", cap_var];
let lv = trans_local_var(bcx, cap_var.def);
let nid = ast_util::def_id_of_def(cap_var.def).node;
let ty = node_id_type(bcx, nid);

View File

@ -576,10 +576,10 @@ fn expr_to_constr_arg(tcx: ty::ctxt, e: @expr) -> @constr_arg_use {
alt e.node {
expr_path(p) {
alt tcx.def_map.find(e.id) {
some(def_local(id)) | some(def_arg(id, _)) |
some(def_binding(id)) | some(def_upvar(id, _, _)) {
some(def_local(nid)) | some(def_arg(nid, _)) |
some(def_binding(nid)) | some(def_upvar(nid, _, _)) {
ret @respan(p.span,
carg_ident({ident: p.node.idents[0], node: id.node}));
carg_ident({ident: p.node.idents[0], node: nid}));
}
some(what) {
tcx.sess.span_bug(e.span,
@ -786,9 +786,9 @@ enum if_ty { if_check, plain_if, }
fn local_node_id_to_def_id_strict(fcx: fn_ctxt, sp: span, i: node_id) ->
def_id {
alt local_node_id_to_def(fcx, i) {
some(def_local(id)) | some(def_arg(id, _)) |
some(def_upvar(id, _, _)) {
ret id;
some(def_local(nid)) | some(def_arg(nid, _)) |
some(def_upvar(nid, _, _)) {
ret local_def(nid);
}
some(_) {
fcx.ccx.tcx.sess.span_fatal(sp,
@ -810,9 +810,9 @@ fn local_node_id_to_def(fcx: fn_ctxt, i: node_id) -> option<def> {
fn local_node_id_to_def_id(fcx: fn_ctxt, i: node_id) -> option<def_id> {
alt local_node_id_to_def(fcx, i) {
some(def_local(id)) | some(def_arg(id, _)) | some(def_binding(id)) |
some(def_upvar(id, _, _)) {
some(id)
some(def_local(nid)) | some(def_arg(nid, _)) | some(def_binding(nid)) |
some(def_upvar(nid, _, _)) {
some(local_def(nid))
}
_ { none }
}

View File

@ -185,8 +185,8 @@ fn clear_in_poststate_expr(fcx: fn_ctxt, e: @expr, t: poststate) {
alt vec::last(p.node.idents) {
some(i) {
alt local_node_id_to_def(fcx, e.id) {
some(def_local(d_id)) {
clear_in_poststate_(bit_num(fcx, ninit(d_id.node, i)), t);
some(def_local(nid)) {
clear_in_poststate_(bit_num(fcx, ninit(nid, i)), t);
}
some(_) {/* ignore args (for now...) */ }
_ {

View File

@ -176,13 +176,13 @@ fn gen_if_local(fcx: fn_ctxt, lhs: @expr, rhs: @expr, larger_id: node_id,
alt node_id_to_def(fcx.ccx, new_var) {
some(d) {
alt d {
def_local(d_id) {
def_local(nid) {
find_pre_post_expr(fcx, rhs);
let p = expr_pp(fcx.ccx, rhs);
set_pre_and_post(fcx.ccx, larger_id, p.precondition,
p.postcondition);
gen(fcx, larger_id,
ninit(d_id.node, path_to_ident(pth)));
ninit(nid, path_to_ident(pth)));
}
_ { find_pre_post_exprs(fcx, [lhs, rhs], larger_id); }
}
@ -214,10 +214,8 @@ fn handle_update(fcx: fn_ctxt, parent: @expr, lhs: @expr, rhs: @expr,
// pure and assign_op require the lhs to be init'd
let df = node_id_to_def_strict(fcx.ccx.tcx, lhs.id);
alt df {
def_local(d_id) {
let i =
bit_num(fcx,
ninit(d_id.node, path_to_ident(p)));
def_local(nid) {
let i = bit_num(fcx, ninit(nid, path_to_ident(p)));
require_and_preserve(i, expr_pp(fcx.ccx, lhs));
}
_ { }
@ -261,9 +259,9 @@ fn handle_var(fcx: fn_ctxt, rslt: pre_and_post, id: node_id, name: ident) {
fn handle_var_def(fcx: fn_ctxt, rslt: pre_and_post, def: def, name: ident) {
log(debug, ("handle_var_def: ", def, name));
alt def {
def_local(d_id) | def_arg(d_id, _) {
use_var(fcx, d_id.node);
let i = bit_num(fcx, ninit(d_id.node, name));
def_local(nid) | def_arg(nid, _) {
use_var(fcx, nid);
let i = bit_num(fcx, ninit(nid, name));
require_and_preserve(i, rslt);
}
_ {/* nothing to check */ }

View File

@ -246,9 +246,8 @@ fn gen_if_local(fcx: fn_ctxt, p: poststate, e: @expr) -> bool {
alt e.node {
expr_path(pth) {
alt fcx.ccx.tcx.def_map.find(e.id) {
some(def_local(loc)) {
ret set_in_poststate_ident(fcx, loc.node,
path_to_ident(pth), p);
some(def_local(nid)) {
ret set_in_poststate_ident(fcx, nid, path_to_ident(pth), p);
}
_ { ret false; }
}

View File

@ -96,14 +96,14 @@ fn lookup_def(fcx: @fn_ctxt, sp: span, id: ast::node_id) -> ast::def {
fn ty_param_bounds_and_ty_for_def(fcx: @fn_ctxt, sp: span, defn: ast::def) ->
ty_param_bounds_and_ty {
alt defn {
ast::def_arg(id, _) {
assert (fcx.locals.contains_key(id.node));
let typ = ty::mk_var(fcx.ccx.tcx, lookup_local(fcx, sp, id.node));
ast::def_arg(nid, _) {
assert (fcx.locals.contains_key(nid));
let typ = ty::mk_var(fcx.ccx.tcx, lookup_local(fcx, sp, nid));
ret {bounds: @[], ty: typ};
}
ast::def_local(id) {
assert (fcx.locals.contains_key(id.node));
let typ = ty::mk_var(fcx.ccx.tcx, lookup_local(fcx, sp, id.node));
ast::def_local(nid) {
assert (fcx.locals.contains_key(nid));
let typ = ty::mk_var(fcx.ccx.tcx, lookup_local(fcx, sp, nid));
ret {bounds: @[], ty: typ};
}
ast::def_self(id) {
@ -131,9 +131,9 @@ fn ty_param_bounds_and_ty_for_def(fcx: @fn_ctxt, sp: span, defn: ast::def) ->
ast::def_fn(id, _) | ast::def_const(id) |
ast::def_variant(_, id) | ast::def_class(id)
{ ret ty::lookup_item_type(fcx.ccx.tcx, id); }
ast::def_binding(id) {
assert (fcx.locals.contains_key(id.node));
let typ = ty::mk_var(fcx.ccx.tcx, lookup_local(fcx, sp, id.node));
ast::def_binding(nid) {
assert (fcx.locals.contains_key(nid));
let typ = ty::mk_var(fcx.ccx.tcx, lookup_local(fcx, sp, nid));
ret {bounds: @[], ty: typ};
}
ast::def_ty(_) | ast::def_prim_ty(_) {
@ -360,7 +360,7 @@ fn ast_ty_to_ty(tcx: ty::ctxt, mode: mode, &&ast_ty: @ast::ty) -> ty::t {
ty::mk_param(tcx, n, id)
}
ast::def_self(iface_id) {
alt check tcx.items.get(iface_id.node) {
alt check tcx.items.get(iface_id) {
ast_map::node_item(@{node: ast::item_iface(tps, _), _}, _) {
if vec::len(tps) != vec::len(path.node.types) {
tcx.sess.span_err(ast_ty.span, "incorrect number of type \
@ -2912,8 +2912,7 @@ fn check_constraints(fcx: @fn_ctxt, cs: [@ast::constr], args: [ast::arg]) {
fcx.ccx.tcx.sess.next_node_id();
fcx.ccx.tcx.def_map.insert
(arg_occ_node_id,
ast::def_arg(local_def(args[i].id),
args[i].mode));
ast::def_arg(args[i].id, args[i].mode));
{id: arg_occ_node_id,
node: ast::expr_path(@respan(a.span, p)),
span: a.span}

View File

@ -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),

View File

@ -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; }
}
}

View File

@ -145,6 +145,7 @@ fn build_session() -> (session::session, @mutable bool) {
no_trans: false,
no_asm_comments: false,
monomorphize: false,
inline: false,
warn_unused_imports: false
};