librustc: Remove all legacy pattern bindings from libsyntax and librustc. rs=refactoring
This commit is contained in:
parent
94be145169
commit
56ece46f7d
87 changed files with 937 additions and 923 deletions
|
@ -412,12 +412,12 @@ fn build_link_meta(sess: Session, c: ast::crate, output: &Path,
|
||||||
for linkage_metas.each |meta| {
|
for linkage_metas.each |meta| {
|
||||||
if attr::get_meta_item_name(*meta) == ~"name" {
|
if attr::get_meta_item_name(*meta) == ~"name" {
|
||||||
match attr::get_meta_item_value_str(*meta) {
|
match attr::get_meta_item_value_str(*meta) {
|
||||||
Some(v) => { name = Some(v); }
|
Some(ref v) => { name = Some((*v)); }
|
||||||
None => cmh_items.push(*meta)
|
None => cmh_items.push(*meta)
|
||||||
}
|
}
|
||||||
} else if attr::get_meta_item_name(*meta) == ~"vers" {
|
} else if attr::get_meta_item_name(*meta) == ~"vers" {
|
||||||
match attr::get_meta_item_value_str(*meta) {
|
match attr::get_meta_item_value_str(*meta) {
|
||||||
Some(v) => { vers = Some(v); }
|
Some(ref v) => { vers = Some((*v)); }
|
||||||
None => cmh_items.push(*meta)
|
None => cmh_items.push(*meta)
|
||||||
}
|
}
|
||||||
} else { cmh_items.push(*meta); }
|
} else { cmh_items.push(*meta); }
|
||||||
|
@ -443,12 +443,12 @@ fn build_link_meta(sess: Session, c: ast::crate, output: &Path,
|
||||||
symbol_hasher.reset();
|
symbol_hasher.reset();
|
||||||
for cmh_items.each |m| {
|
for cmh_items.each |m| {
|
||||||
match m.node {
|
match m.node {
|
||||||
ast::meta_name_value(key, value) => {
|
ast::meta_name_value(ref key, value) => {
|
||||||
symbol_hasher.write_str(len_and_str(key));
|
symbol_hasher.write_str(len_and_str((*key)));
|
||||||
symbol_hasher.write_str(len_and_str_lit(value));
|
symbol_hasher.write_str(len_and_str_lit(value));
|
||||||
}
|
}
|
||||||
ast::meta_word(name) => {
|
ast::meta_word(ref name) => {
|
||||||
symbol_hasher.write_str(len_and_str(name));
|
symbol_hasher.write_str(len_and_str((*name)));
|
||||||
}
|
}
|
||||||
ast::meta_list(_, _) => {
|
ast::meta_list(_, _) => {
|
||||||
// FIXME (#607): Implement this
|
// FIXME (#607): Implement this
|
||||||
|
@ -473,13 +473,13 @@ fn build_link_meta(sess: Session, c: ast::crate, output: &Path,
|
||||||
fn crate_meta_name(sess: Session, _crate: ast::crate,
|
fn crate_meta_name(sess: Session, _crate: ast::crate,
|
||||||
output: &Path, metas: provided_metas) -> ~str {
|
output: &Path, metas: provided_metas) -> ~str {
|
||||||
return match metas.name {
|
return match metas.name {
|
||||||
Some(v) => v,
|
Some(ref v) => (*v),
|
||||||
None => {
|
None => {
|
||||||
let name = match output.filestem() {
|
let name = match output.filestem() {
|
||||||
None => sess.fatal(fmt!("output file name `%s` doesn't\
|
None => sess.fatal(fmt!("output file name `%s` doesn't\
|
||||||
appear to have a stem",
|
appear to have a stem",
|
||||||
output.to_str())),
|
output.to_str())),
|
||||||
Some(s) => s
|
Some(ref s) => (*s)
|
||||||
};
|
};
|
||||||
warn_missing(sess, ~"name", name);
|
warn_missing(sess, ~"name", name);
|
||||||
name
|
name
|
||||||
|
@ -490,7 +490,7 @@ fn build_link_meta(sess: Session, c: ast::crate, output: &Path,
|
||||||
fn crate_meta_vers(sess: Session, _crate: ast::crate,
|
fn crate_meta_vers(sess: Session, _crate: ast::crate,
|
||||||
metas: provided_metas) -> ~str {
|
metas: provided_metas) -> ~str {
|
||||||
return match metas.vers {
|
return match metas.vers {
|
||||||
Some(v) => v,
|
Some(ref v) => (*v),
|
||||||
None => {
|
None => {
|
||||||
let vers = ~"0.0";
|
let vers = ~"0.0";
|
||||||
warn_missing(sess, ~"vers", vers);
|
warn_missing(sess, ~"vers", vers);
|
||||||
|
@ -534,7 +534,7 @@ fn symbol_hash(tcx: ty::ctxt, symbol_hasher: &hash::State, t: ty::t,
|
||||||
|
|
||||||
fn get_symbol_hash(ccx: @crate_ctxt, t: ty::t) -> ~str {
|
fn get_symbol_hash(ccx: @crate_ctxt, t: ty::t) -> ~str {
|
||||||
match ccx.type_hashcodes.find(t) {
|
match ccx.type_hashcodes.find(t) {
|
||||||
Some(h) => return h,
|
Some(ref h) => return (*h),
|
||||||
None => {
|
None => {
|
||||||
let hash = symbol_hash(ccx.tcx, ccx.symbol_hasher, t, ccx.link_meta);
|
let hash = symbol_hash(ccx.tcx, ccx.symbol_hasher, t, ccx.link_meta);
|
||||||
ccx.type_hashcodes.insert(t, hash);
|
ccx.type_hashcodes.insert(t, hash);
|
||||||
|
|
|
@ -39,7 +39,7 @@ fn anon_src() -> ~str { ~"<anon>" }
|
||||||
|
|
||||||
fn source_name(input: input) -> ~str {
|
fn source_name(input: input) -> ~str {
|
||||||
match input {
|
match input {
|
||||||
file_input(ifile) => ifile.to_str(),
|
file_input(ref ifile) => (*ifile).to_str(),
|
||||||
str_input(_) => anon_src()
|
str_input(_) => anon_src()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -121,13 +121,13 @@ enum input {
|
||||||
fn parse_input(sess: Session, cfg: ast::crate_cfg, input: input)
|
fn parse_input(sess: Session, cfg: ast::crate_cfg, input: input)
|
||||||
-> @ast::crate {
|
-> @ast::crate {
|
||||||
match input {
|
match input {
|
||||||
file_input(file) => {
|
file_input(ref file) => {
|
||||||
parse::parse_crate_from_file(&file, cfg, sess.parse_sess)
|
parse::parse_crate_from_file(&(*file), cfg, sess.parse_sess)
|
||||||
}
|
}
|
||||||
str_input(src) => {
|
str_input(ref src) => {
|
||||||
// FIXME (#2319): Don't really want to box the source string
|
// FIXME (#2319): Don't really want to box the source string
|
||||||
parse::parse_crate_from_source_str(
|
parse::parse_crate_from_source_str(
|
||||||
anon_src(), @src, cfg, sess.parse_sess)
|
anon_src(), @(*src), cfg, sess.parse_sess)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -337,10 +337,10 @@ fn pretty_print_input(sess: Session, cfg: ast::crate_cfg, input: input,
|
||||||
pp::space(s.s);
|
pp::space(s.s);
|
||||||
pprust::synth_comment(s, int::to_str(item.id, 10u));
|
pprust::synth_comment(s, int::to_str(item.id, 10u));
|
||||||
}
|
}
|
||||||
pprust::node_block(s, blk) => {
|
pprust::node_block(s, ref blk) => {
|
||||||
pp::space(s.s);
|
pp::space(s.s);
|
||||||
pprust::synth_comment(s,
|
pprust::synth_comment(s,
|
||||||
~"block " + int::to_str(blk.node.id, 10u));
|
~"block " + int::to_str((*blk).node.id, 10u));
|
||||||
}
|
}
|
||||||
pprust::node_expr(s, expr) => {
|
pprust::node_expr(s, expr) => {
|
||||||
pp::space(s.s);
|
pp::space(s.s);
|
||||||
|
@ -563,7 +563,7 @@ fn build_session_options(binary: ~str,
|
||||||
let target =
|
let target =
|
||||||
match target_opt {
|
match target_opt {
|
||||||
None => host_triple(),
|
None => host_triple(),
|
||||||
Some(s) => s
|
Some(ref s) => (*s)
|
||||||
};
|
};
|
||||||
|
|
||||||
let addl_lib_search_paths =
|
let addl_lib_search_paths =
|
||||||
|
@ -743,15 +743,15 @@ fn build_output_filenames(input: input,
|
||||||
// have to make up a name
|
// have to make up a name
|
||||||
// We want to toss everything after the final '.'
|
// We want to toss everything after the final '.'
|
||||||
let dirpath = match *odir {
|
let dirpath = match *odir {
|
||||||
Some(d) => d,
|
Some(ref d) => (*d),
|
||||||
None => match input {
|
None => match input {
|
||||||
str_input(_) => os::getcwd(),
|
str_input(_) => os::getcwd(),
|
||||||
file_input(ifile) => ifile.dir_path()
|
file_input(ref ifile) => (*ifile).dir_path()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let stem = match input {
|
let stem = match input {
|
||||||
file_input(ifile) => ifile.filestem().get(),
|
file_input(ref ifile) => (*ifile).filestem().get(),
|
||||||
str_input(_) => ~"rust_out"
|
str_input(_) => ~"rust_out"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -764,12 +764,12 @@ fn build_output_filenames(input: input,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Some(out_file) => {
|
Some(ref out_file) => {
|
||||||
out_path = out_file;
|
out_path = (*out_file);
|
||||||
obj_path = if stop_after_codegen {
|
obj_path = if stop_after_codegen {
|
||||||
out_file
|
(*out_file)
|
||||||
} else {
|
} else {
|
||||||
out_file.with_filetype(obj_suffix)
|
(*out_file).with_filetype(obj_suffix)
|
||||||
};
|
};
|
||||||
|
|
||||||
if sess.building_library {
|
if sess.building_library {
|
||||||
|
|
|
@ -1086,7 +1086,7 @@ fn type_to_str(names: type_names, ty: TypeRef) -> ~str {
|
||||||
fn type_to_str_inner(names: type_names, outer0: ~[TypeRef], ty: TypeRef) ->
|
fn type_to_str_inner(names: type_names, outer0: ~[TypeRef], ty: TypeRef) ->
|
||||||
~str {
|
~str {
|
||||||
match type_has_name(names, ty) {
|
match type_has_name(names, ty) {
|
||||||
option::Some(n) => return n,
|
option::Some(ref n) => return (*n),
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,7 @@ fn visit_item(e: env, i: @ast::item) {
|
||||||
if abi != ast::foreign_abi_cdecl &&
|
if abi != ast::foreign_abi_cdecl &&
|
||||||
abi != ast::foreign_abi_stdcall { return; }
|
abi != ast::foreign_abi_stdcall { return; }
|
||||||
}
|
}
|
||||||
either::Left(msg) => e.diag.span_fatal(i.span, msg)
|
either::Left(ref msg) => e.diag.span_fatal(i.span, (*msg))
|
||||||
}
|
}
|
||||||
|
|
||||||
let cstore = e.cstore;
|
let cstore = e.cstore;
|
||||||
|
@ -137,13 +137,13 @@ fn visit_item(e: env, i: @ast::item) {
|
||||||
let foreign_name =
|
let foreign_name =
|
||||||
match attr::first_attr_value_str_by_name(i.attrs,
|
match attr::first_attr_value_str_by_name(i.attrs,
|
||||||
~"link_name") {
|
~"link_name") {
|
||||||
Some(nn) => {
|
Some(ref nn) => {
|
||||||
if nn == ~"" {
|
if (*nn) == ~"" {
|
||||||
e.diag.span_fatal(
|
e.diag.span_fatal(
|
||||||
i.span,
|
i.span,
|
||||||
~"empty #[link_name] not allowed; use #[nolink].");
|
~"empty #[link_name] not allowed; use #[nolink].");
|
||||||
}
|
}
|
||||||
nn
|
(*nn)
|
||||||
}
|
}
|
||||||
None => *e.intr.get(i.ident)
|
None => *e.intr.get(i.ident)
|
||||||
};
|
};
|
||||||
|
@ -161,8 +161,8 @@ fn visit_item(e: env, i: @ast::item) {
|
||||||
|
|
||||||
for link_args.each |a| {
|
for link_args.each |a| {
|
||||||
match attr::get_meta_item_value_str(attr::attr_meta(*a)) {
|
match attr::get_meta_item_value_str(attr::attr_meta(*a)) {
|
||||||
Some(linkarg) => {
|
Some(ref linkarg) => {
|
||||||
cstore::add_used_link_args(cstore, linkarg);
|
cstore::add_used_link_args(cstore, (*linkarg));
|
||||||
}
|
}
|
||||||
None => {/* fallthrough */ }
|
None => {/* fallthrough */ }
|
||||||
}
|
}
|
||||||
|
@ -236,7 +236,7 @@ fn resolve_crate(e: env, ident: ast::ident, metas: ~[@ast::meta_item],
|
||||||
|
|
||||||
let cname =
|
let cname =
|
||||||
match attr::last_meta_item_value_str_by_name(metas, ~"name") {
|
match attr::last_meta_item_value_str_by_name(metas, ~"name") {
|
||||||
option::Some(v) => v,
|
option::Some(ref v) => (*v),
|
||||||
option::None => *e.intr.get(ident)
|
option::None => *e.intr.get(ident)
|
||||||
};
|
};
|
||||||
let cmeta = @{name: cname, data: cdata,
|
let cmeta = @{name: cname, data: cdata,
|
||||||
|
|
|
@ -603,7 +603,7 @@ fn maybe_get_item_ast(intr: @ident_interner, cdata: cmd, tcx: ty::ctxt,
|
||||||
let item_doc = lookup_item(id, cdata.data);
|
let item_doc = lookup_item(id, cdata.data);
|
||||||
let path = vec::init(item_path(intr, item_doc));
|
let path = vec::init(item_path(intr, item_doc));
|
||||||
match decode_inlined_item(cdata, tcx, path, item_doc) {
|
match decode_inlined_item(cdata, tcx, path, item_doc) {
|
||||||
Some(ii) => csearch::found(ii),
|
Some(ref ii) => csearch::found((*ii)),
|
||||||
None => {
|
None => {
|
||||||
match item_parent_item(item_doc) {
|
match item_parent_item(item_doc) {
|
||||||
Some(did) => {
|
Some(did) => {
|
||||||
|
@ -611,7 +611,7 @@ fn maybe_get_item_ast(intr: @ident_interner, cdata: cmd, tcx: ty::ctxt,
|
||||||
let parent_item = lookup_item(did.node, cdata.data);
|
let parent_item = lookup_item(did.node, cdata.data);
|
||||||
match decode_inlined_item(cdata, tcx, path,
|
match decode_inlined_item(cdata, tcx, path,
|
||||||
parent_item) {
|
parent_item) {
|
||||||
Some(ii) => csearch::found_parent(did, ii),
|
Some(ref ii) => csearch::found_parent(did, (*ii)),
|
||||||
None => csearch::not_found
|
None => csearch::not_found
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -635,7 +635,7 @@ fn get_enum_variants(intr: @ident_interner, cdata: cmd, id: ast::node_id,
|
||||||
tcx, cdata);
|
tcx, cdata);
|
||||||
let name = item_name(intr, item);
|
let name = item_name(intr, item);
|
||||||
let arg_tys = match ty::get(ctor_ty).sty {
|
let arg_tys = match ty::get(ctor_ty).sty {
|
||||||
ty::ty_fn(f) => f.sig.inputs.map(|a| a.ty),
|
ty::ty_fn(ref f) => (*f).sig.inputs.map(|a| a.ty),
|
||||||
|
|
||||||
// Nullary enum variant.
|
// Nullary enum variant.
|
||||||
_ => ~[],
|
_ => ~[],
|
||||||
|
@ -750,7 +750,7 @@ fn get_trait_methods(intr: @ident_interner, cdata: cmd, id: ast::node_id,
|
||||||
let ty = doc_type(mth, tcx, cdata);
|
let ty = doc_type(mth, tcx, cdata);
|
||||||
let def_id = item_def_id(mth, cdata);
|
let def_id = item_def_id(mth, cdata);
|
||||||
let fty = match ty::get(ty).sty {
|
let fty = match ty::get(ty).sty {
|
||||||
ty::ty_fn(f) => f,
|
ty::ty_fn(ref f) => (*f),
|
||||||
_ => {
|
_ => {
|
||||||
tcx.diag.handler().bug(
|
tcx.diag.handler().bug(
|
||||||
~"get_trait_methods: id has non-function type");
|
~"get_trait_methods: id has non-function type");
|
||||||
|
@ -781,7 +781,7 @@ fn get_provided_trait_methods(intr: @ident_interner, cdata: cmd,
|
||||||
|
|
||||||
let fty;
|
let fty;
|
||||||
match ty::get(ty).sty {
|
match ty::get(ty).sty {
|
||||||
ty::ty_fn(f) => fty = f,
|
ty::ty_fn(ref f) => fty = (*f),
|
||||||
_ => {
|
_ => {
|
||||||
tcx.diag.handler().bug(~"get_provided_trait_methods(): id \
|
tcx.diag.handler().bug(~"get_provided_trait_methods(): id \
|
||||||
has non-function type");
|
has non-function type");
|
||||||
|
@ -1104,7 +1104,7 @@ fn get_crate_vers(data: @~[u8]) -> ~str {
|
||||||
let attrs = decoder::get_crate_attributes(data);
|
let attrs = decoder::get_crate_attributes(data);
|
||||||
return match attr::last_meta_item_value_str_by_name(
|
return match attr::last_meta_item_value_str_by_name(
|
||||||
attr::find_linkage_metas(attrs), ~"vers") {
|
attr::find_linkage_metas(attrs), ~"vers") {
|
||||||
Some(ver) => ver,
|
Some(ref ver) => (*ver),
|
||||||
None => ~"0.0"
|
None => ~"0.0"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,7 +218,7 @@ fn encode_type(ecx: @encode_ctxt, ebml_w: Writer::Serializer, typ: ty::t) {
|
||||||
fn encode_symbol(ecx: @encode_ctxt, ebml_w: Writer::Serializer, id: node_id) {
|
fn encode_symbol(ecx: @encode_ctxt, ebml_w: Writer::Serializer, id: node_id) {
|
||||||
ebml_w.start_tag(tag_items_data_item_symbol);
|
ebml_w.start_tag(tag_items_data_item_symbol);
|
||||||
let sym = match ecx.item_symbols.find(id) {
|
let sym = match ecx.item_symbols.find(id) {
|
||||||
Some(x) => x,
|
Some(ref x) => (*x),
|
||||||
None => {
|
None => {
|
||||||
ecx.diag.handler().bug(
|
ecx.diag.handler().bug(
|
||||||
fmt!("encode_symbol: id not found %d", id));
|
fmt!("encode_symbol: id not found %d", id));
|
||||||
|
@ -341,9 +341,9 @@ fn encode_info_for_mod(ecx: @encode_ctxt, ebml_w: Writer::Serializer,
|
||||||
// Encode the reexports of this module.
|
// Encode the reexports of this module.
|
||||||
debug!("(encoding info for module) encoding reexports for %d", id);
|
debug!("(encoding info for module) encoding reexports for %d", id);
|
||||||
match ecx.reexports2.find(id) {
|
match ecx.reexports2.find(id) {
|
||||||
Some(exports) => {
|
Some(ref exports) => {
|
||||||
debug!("(encoding info for module) found reexports for %d", id);
|
debug!("(encoding info for module) found reexports for %d", id);
|
||||||
for exports.each |exp| {
|
for (*exports).each |exp| {
|
||||||
debug!("(encoding info for module) reexport '%s' for %d",
|
debug!("(encoding info for module) reexport '%s' for %d",
|
||||||
exp.name, id);
|
exp.name, id);
|
||||||
ebml_w.start_tag(tag_items_data_item_reexport);
|
ebml_w.start_tag(tag_items_data_item_reexport);
|
||||||
|
@ -483,8 +483,8 @@ fn encode_info_for_ctor(ecx: @encode_ctxt, ebml_w: Writer::Serializer,
|
||||||
encode_type(ecx, ebml_w, its_ty);
|
encode_type(ecx, ebml_w, its_ty);
|
||||||
encode_path(ecx, ebml_w, path, ast_map::path_name(ident));
|
encode_path(ecx, ebml_w, path, ast_map::path_name(ident));
|
||||||
match item {
|
match item {
|
||||||
Some(it) => {
|
Some(ref it) => {
|
||||||
(ecx.encode_inlined_item)(ecx, ebml_w, path, it);
|
(ecx.encode_inlined_item)(ecx, ebml_w, path, (*it));
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
encode_symbol(ecx, ebml_w, id);
|
encode_symbol(ecx, ebml_w, id);
|
||||||
|
@ -622,7 +622,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: Writer::Serializer,
|
||||||
encode_region_param(ecx, ebml_w, item);
|
encode_region_param(ecx, ebml_w, item);
|
||||||
ebml_w.end_tag();
|
ebml_w.end_tag();
|
||||||
}
|
}
|
||||||
item_enum(enum_definition, tps) => {
|
item_enum(ref enum_definition, tps) => {
|
||||||
add_to_index();
|
add_to_index();
|
||||||
do ebml_w.wr_tag(tag_items_data_item) {
|
do ebml_w.wr_tag(tag_items_data_item) {
|
||||||
encode_def_id(ebml_w, local_def(item.id));
|
encode_def_id(ebml_w, local_def(item.id));
|
||||||
|
@ -630,7 +630,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: Writer::Serializer,
|
||||||
encode_type_param_bounds(ebml_w, ecx, tps);
|
encode_type_param_bounds(ebml_w, ecx, tps);
|
||||||
encode_type(ecx, ebml_w, node_id_to_type(tcx, item.id));
|
encode_type(ecx, ebml_w, node_id_to_type(tcx, item.id));
|
||||||
encode_name(ecx, ebml_w, item.ident);
|
encode_name(ecx, ebml_w, item.ident);
|
||||||
for enum_definition.variants.each |v| {
|
for (*enum_definition).variants.each |v| {
|
||||||
encode_variant_id(ebml_w, local_def(v.node.id));
|
encode_variant_id(ebml_w, local_def(v.node.id));
|
||||||
}
|
}
|
||||||
(ecx.encode_inlined_item)(ecx, ebml_w, path, ii_item(item));
|
(ecx.encode_inlined_item)(ecx, ebml_w, path, ii_item(item));
|
||||||
|
@ -638,7 +638,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: Writer::Serializer,
|
||||||
encode_region_param(ecx, ebml_w, item);
|
encode_region_param(ecx, ebml_w, item);
|
||||||
}
|
}
|
||||||
encode_enum_variant_info(ecx, ebml_w, item.id,
|
encode_enum_variant_info(ecx, ebml_w, item.id,
|
||||||
enum_definition.variants, path, index, tps);
|
(*enum_definition).variants, path, index, tps);
|
||||||
}
|
}
|
||||||
item_class(struct_def, tps) => {
|
item_class(struct_def, tps) => {
|
||||||
/* First, encode the fields and methods
|
/* First, encode the fields and methods
|
||||||
|
@ -764,7 +764,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: Writer::Serializer,
|
||||||
vec::append(tps, m.tps));
|
vec::append(tps, m.tps));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
item_trait(tps, traits, ms) => {
|
item_trait(tps, traits, ref ms) => {
|
||||||
let provided_methods = dvec::DVec();
|
let provided_methods = dvec::DVec();
|
||||||
|
|
||||||
add_to_index();
|
add_to_index();
|
||||||
|
@ -778,12 +778,12 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: Writer::Serializer,
|
||||||
encode_attributes(ebml_w, item.attrs);
|
encode_attributes(ebml_w, item.attrs);
|
||||||
let mut i = 0u;
|
let mut i = 0u;
|
||||||
for vec::each(*ty::trait_methods(tcx, local_def(item.id))) |mty| {
|
for vec::each(*ty::trait_methods(tcx, local_def(item.id))) |mty| {
|
||||||
match ms[i] {
|
match (*ms)[i] {
|
||||||
required(ty_m) => {
|
required(ref ty_m) => {
|
||||||
ebml_w.start_tag(tag_item_trait_method);
|
ebml_w.start_tag(tag_item_trait_method);
|
||||||
encode_def_id(ebml_w, local_def(ty_m.id));
|
encode_def_id(ebml_w, local_def((*ty_m).id));
|
||||||
encode_name(ecx, ebml_w, mty.ident);
|
encode_name(ecx, ebml_w, mty.ident);
|
||||||
encode_type_param_bounds(ebml_w, ecx, ty_m.tps);
|
encode_type_param_bounds(ebml_w, ecx, (*ty_m).tps);
|
||||||
encode_type(ecx, ebml_w, ty::mk_fn(tcx, mty.fty));
|
encode_type(ecx, ebml_w, ty::mk_fn(tcx, mty.fty));
|
||||||
encode_family(ebml_w, purity_fn_family(mty.fty.meta.purity));
|
encode_family(ebml_w, purity_fn_family(mty.fty.meta.purity));
|
||||||
encode_self_type(ebml_w, mty.self_ty);
|
encode_self_type(ebml_w, mty.self_ty);
|
||||||
|
@ -816,7 +816,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: Writer::Serializer,
|
||||||
// method info, we output static methods with type signatures as
|
// method info, we output static methods with type signatures as
|
||||||
// written. Here, we output the *real* type signatures. I feel like
|
// written. Here, we output the *real* type signatures. I feel like
|
||||||
// maybe we should only ever handle the real type signatures.
|
// maybe we should only ever handle the real type signatures.
|
||||||
for vec::each(ms) |m| {
|
for vec::each((*ms)) |m| {
|
||||||
let ty_m = ast_util::trait_method_to_ty_method(*m);
|
let ty_m = ast_util::trait_method_to_ty_method(*m);
|
||||||
if ty_m.self_ty.node != ast::sty_static { loop; }
|
if ty_m.self_ty.node != ast::sty_static { loop; }
|
||||||
|
|
||||||
|
@ -971,19 +971,19 @@ fn write_int(writer: io::Writer, &&n: int) {
|
||||||
|
|
||||||
fn encode_meta_item(ebml_w: Writer::Serializer, mi: meta_item) {
|
fn encode_meta_item(ebml_w: Writer::Serializer, mi: meta_item) {
|
||||||
match mi.node {
|
match mi.node {
|
||||||
meta_word(name) => {
|
meta_word(ref name) => {
|
||||||
ebml_w.start_tag(tag_meta_item_word);
|
ebml_w.start_tag(tag_meta_item_word);
|
||||||
ebml_w.start_tag(tag_meta_item_name);
|
ebml_w.start_tag(tag_meta_item_name);
|
||||||
ebml_w.writer.write(str::to_bytes(name));
|
ebml_w.writer.write(str::to_bytes((*name)));
|
||||||
ebml_w.end_tag();
|
ebml_w.end_tag();
|
||||||
ebml_w.end_tag();
|
ebml_w.end_tag();
|
||||||
}
|
}
|
||||||
meta_name_value(name, value) => {
|
meta_name_value(ref name, value) => {
|
||||||
match value.node {
|
match value.node {
|
||||||
lit_str(value) => {
|
lit_str(value) => {
|
||||||
ebml_w.start_tag(tag_meta_item_name_value);
|
ebml_w.start_tag(tag_meta_item_name_value);
|
||||||
ebml_w.start_tag(tag_meta_item_name);
|
ebml_w.start_tag(tag_meta_item_name);
|
||||||
ebml_w.writer.write(str::to_bytes(name));
|
ebml_w.writer.write(str::to_bytes((*name)));
|
||||||
ebml_w.end_tag();
|
ebml_w.end_tag();
|
||||||
ebml_w.start_tag(tag_meta_item_value);
|
ebml_w.start_tag(tag_meta_item_value);
|
||||||
ebml_w.writer.write(str::to_bytes(*value));
|
ebml_w.writer.write(str::to_bytes(*value));
|
||||||
|
@ -993,10 +993,10 @@ fn encode_meta_item(ebml_w: Writer::Serializer, mi: meta_item) {
|
||||||
_ => {/* FIXME (#623): encode other variants */ }
|
_ => {/* FIXME (#623): encode other variants */ }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
meta_list(name, items) => {
|
meta_list(ref name, items) => {
|
||||||
ebml_w.start_tag(tag_meta_item_list);
|
ebml_w.start_tag(tag_meta_item_list);
|
||||||
ebml_w.start_tag(tag_meta_item_name);
|
ebml_w.start_tag(tag_meta_item_name);
|
||||||
ebml_w.writer.write(str::to_bytes(name));
|
ebml_w.writer.write(str::to_bytes((*name)));
|
||||||
ebml_w.end_tag();
|
ebml_w.end_tag();
|
||||||
for items.each |inner_item| {
|
for items.each |inner_item| {
|
||||||
encode_meta_item(ebml_w, **inner_item);
|
encode_meta_item(ebml_w, **inner_item);
|
||||||
|
|
|
@ -53,11 +53,11 @@ fn mk_filesearch(maybe_sysroot: Option<Path>,
|
||||||
make_target_lib_path(&self.sysroot,
|
make_target_lib_path(&self.sysroot,
|
||||||
self.target_triple));
|
self.target_triple));
|
||||||
match get_cargo_lib_path_nearest() {
|
match get_cargo_lib_path_nearest() {
|
||||||
result::Ok(p) => paths.push(p),
|
result::Ok(ref p) => paths.push((*p)),
|
||||||
result::Err(_) => ()
|
result::Err(_) => ()
|
||||||
}
|
}
|
||||||
match get_cargo_lib_path() {
|
match get_cargo_lib_path() {
|
||||||
result::Ok(p) => paths.push(p),
|
result::Ok(ref p) => paths.push((*p)),
|
||||||
result::Err(_) => ()
|
result::Err(_) => ()
|
||||||
}
|
}
|
||||||
paths
|
paths
|
||||||
|
@ -110,14 +110,14 @@ fn make_target_lib_path(sysroot: &Path,
|
||||||
|
|
||||||
fn get_default_sysroot() -> Path {
|
fn get_default_sysroot() -> Path {
|
||||||
match os::self_exe_path() {
|
match os::self_exe_path() {
|
||||||
option::Some(p) => p.pop(),
|
option::Some(ref p) => (*p).pop(),
|
||||||
option::None => fail ~"can't determine value for sysroot"
|
option::None => fail ~"can't determine value for sysroot"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_sysroot(maybe_sysroot: Option<Path>) -> Path {
|
fn get_sysroot(maybe_sysroot: Option<Path>) -> Path {
|
||||||
match maybe_sysroot {
|
match maybe_sysroot {
|
||||||
option::Some(sr) => sr,
|
option::Some(ref sr) => (*sr),
|
||||||
option::None => get_default_sysroot()
|
option::None => get_default_sysroot()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -128,9 +128,9 @@ fn get_cargo_sysroot() -> Result<Path, ~str> {
|
||||||
|
|
||||||
fn get_cargo_root() -> Result<Path, ~str> {
|
fn get_cargo_root() -> Result<Path, ~str> {
|
||||||
match os::getenv(~"CARGO_ROOT") {
|
match os::getenv(~"CARGO_ROOT") {
|
||||||
Some(_p) => result::Ok(Path(_p)),
|
Some(ref _p) => result::Ok(Path((*_p))),
|
||||||
None => match os::homedir() {
|
None => match os::homedir() {
|
||||||
Some(_q) => result::Ok(_q.push(".cargo")),
|
Some(ref _q) => result::Ok((*_q).push(".cargo")),
|
||||||
None => result::Err(~"no CARGO_ROOT or home directory")
|
None => result::Err(~"no CARGO_ROOT or home directory")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ type ctxt = {
|
||||||
|
|
||||||
fn load_library_crate(cx: ctxt) -> {ident: ~str, data: @~[u8]} {
|
fn load_library_crate(cx: ctxt) -> {ident: ~str, data: @~[u8]} {
|
||||||
match find_library_crate(cx) {
|
match find_library_crate(cx) {
|
||||||
Some(t) => return t,
|
Some(ref t) => return (*t),
|
||||||
None => {
|
None => {
|
||||||
cx.diag.span_fatal(
|
cx.diag.span_fatal(
|
||||||
cx.span, fmt!("can't find crate for `%s`",
|
cx.span, fmt!("can't find crate for `%s`",
|
||||||
|
@ -135,7 +135,7 @@ fn crate_name_from_metas(metas: ~[@ast::meta_item]) -> ~str {
|
||||||
match vec::last_opt(name_items) {
|
match vec::last_opt(name_items) {
|
||||||
Some(i) => {
|
Some(i) => {
|
||||||
match attr::get_meta_item_value_str(i) {
|
match attr::get_meta_item_value_str(i) {
|
||||||
Some(n) => n,
|
Some(ref n) => (*n),
|
||||||
// FIXME (#2406): Probably want a warning here since the user
|
// FIXME (#2406): Probably want a warning here since the user
|
||||||
// is using the wrong type of meta item.
|
// is using the wrong type of meta item.
|
||||||
_ => fail
|
_ => fail
|
||||||
|
|
|
@ -118,11 +118,11 @@ fn enc_mt(w: io::Writer, cx: @ctxt, mt: ty::mt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn enc_opt<T>(w: io::Writer, t: Option<T>, enc_f: fn(T)) {
|
fn enc_opt<T>(w: io::Writer, t: Option<T>, enc_f: fn(T)) {
|
||||||
match t {
|
match &t {
|
||||||
None => w.write_char('n'),
|
&None => w.write_char('n'),
|
||||||
Some(v) => {
|
&Some(ref v) => {
|
||||||
w.write_char('s');
|
w.write_char('s');
|
||||||
enc_f(v);
|
enc_f((*v));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -237,18 +237,18 @@ fn enc_sty(w: io::Writer, cx: @ctxt, st: ty::sty) {
|
||||||
ty_f64 => w.write_str(&"MF"),
|
ty_f64 => w.write_str(&"MF"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ty::ty_enum(def, substs) => {
|
ty::ty_enum(def, ref substs) => {
|
||||||
w.write_str(&"t[");
|
w.write_str(&"t[");
|
||||||
w.write_str((cx.ds)(def));
|
w.write_str((cx.ds)(def));
|
||||||
w.write_char('|');
|
w.write_char('|');
|
||||||
enc_substs(w, cx, substs);
|
enc_substs(w, cx, (*substs));
|
||||||
w.write_char(']');
|
w.write_char(']');
|
||||||
}
|
}
|
||||||
ty::ty_trait(def, substs, vstore) => {
|
ty::ty_trait(def, ref substs, vstore) => {
|
||||||
w.write_str(&"x[");
|
w.write_str(&"x[");
|
||||||
w.write_str((cx.ds)(def));
|
w.write_str((cx.ds)(def));
|
||||||
w.write_char('|');
|
w.write_char('|');
|
||||||
enc_substs(w, cx, substs);
|
enc_substs(w, cx, (*substs));
|
||||||
enc_vstore(w, cx, vstore);
|
enc_vstore(w, cx, vstore);
|
||||||
w.write_char(']');
|
w.write_char(']');
|
||||||
}
|
}
|
||||||
|
@ -284,8 +284,8 @@ fn enc_sty(w: io::Writer, cx: @ctxt, st: ty::sty) {
|
||||||
}
|
}
|
||||||
w.write_char(']');
|
w.write_char(']');
|
||||||
}
|
}
|
||||||
ty::ty_fn(f) => {
|
ty::ty_fn(ref f) => {
|
||||||
enc_ty_fn(w, cx, f);
|
enc_ty_fn(w, cx, (*f));
|
||||||
}
|
}
|
||||||
ty::ty_infer(ty::TyVar(id)) => {
|
ty::ty_infer(ty::TyVar(id)) => {
|
||||||
w.write_char('X');
|
w.write_char('X');
|
||||||
|
@ -316,7 +316,7 @@ fn enc_sty(w: io::Writer, cx: @ctxt, st: ty::sty) {
|
||||||
enc_proto(w, p);
|
enc_proto(w, p);
|
||||||
}
|
}
|
||||||
ty::ty_opaque_box => w.write_char('B'),
|
ty::ty_opaque_box => w.write_char('B'),
|
||||||
ty::ty_class(def, substs) => {
|
ty::ty_class(def, ref substs) => {
|
||||||
debug!("~~~~ %s", ~"a[");
|
debug!("~~~~ %s", ~"a[");
|
||||||
w.write_str(&"a[");
|
w.write_str(&"a[");
|
||||||
let s = (cx.ds)(def);
|
let s = (cx.ds)(def);
|
||||||
|
@ -324,7 +324,7 @@ fn enc_sty(w: io::Writer, cx: @ctxt, st: ty::sty) {
|
||||||
w.write_str(s);
|
w.write_str(s);
|
||||||
debug!("~~~~ %s", ~"|");
|
debug!("~~~~ %s", ~"|");
|
||||||
w.write_char('|');
|
w.write_char('|');
|
||||||
enc_substs(w, cx, substs);
|
enc_substs(w, cx, (*substs));
|
||||||
debug!("~~~~ %s", ~"]");
|
debug!("~~~~ %s", ~"]");
|
||||||
w.write_char(']');
|
w.write_char(']');
|
||||||
}
|
}
|
||||||
|
|
|
@ -282,11 +282,11 @@ fn simplify_ast(ii: ast::inlined_item) -> ast::inlined_item {
|
||||||
ast::ii_foreign(i) => {
|
ast::ii_foreign(i) => {
|
||||||
ast::ii_foreign(fld.fold_foreign_item(i))
|
ast::ii_foreign(fld.fold_foreign_item(i))
|
||||||
}
|
}
|
||||||
ast::ii_dtor(dtor, nm, tps, parent_id) => {
|
ast::ii_dtor(ref dtor, nm, tps, parent_id) => {
|
||||||
let dtor_body = fld.fold_block(dtor.node.body);
|
let dtor_body = fld.fold_block((*dtor).node.body);
|
||||||
ast::ii_dtor({node: {body: dtor_body,
|
ast::ii_dtor({node: {body: dtor_body,
|
||||||
.. dtor.node},
|
.. (*dtor).node},
|
||||||
.. dtor}, nm, tps, parent_id)
|
.. (*dtor)}, nm, tps, parent_id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -315,16 +315,16 @@ fn renumber_ast(xcx: extended_decode_ctxt, ii: ast::inlined_item)
|
||||||
ast::ii_foreign(i) => {
|
ast::ii_foreign(i) => {
|
||||||
ast::ii_foreign(fld.fold_foreign_item(i))
|
ast::ii_foreign(fld.fold_foreign_item(i))
|
||||||
}
|
}
|
||||||
ast::ii_dtor(dtor, nm, tps, parent_id) => {
|
ast::ii_dtor(ref dtor, nm, tps, parent_id) => {
|
||||||
let dtor_body = fld.fold_block(dtor.node.body);
|
let dtor_body = fld.fold_block((*dtor).node.body);
|
||||||
let dtor_attrs = fld.fold_attributes(dtor.node.attrs);
|
let dtor_attrs = fld.fold_attributes((*dtor).node.attrs);
|
||||||
let new_params = fold::fold_ty_params(tps, fld);
|
let new_params = fold::fold_ty_params(tps, fld);
|
||||||
let dtor_id = fld.new_id(dtor.node.id);
|
let dtor_id = fld.new_id((*dtor).node.id);
|
||||||
let new_parent = xcx.tr_def_id(parent_id);
|
let new_parent = xcx.tr_def_id(parent_id);
|
||||||
let new_self = fld.new_id(dtor.node.self_id);
|
let new_self = fld.new_id((*dtor).node.self_id);
|
||||||
ast::ii_dtor({node: {id: dtor_id, attrs: dtor_attrs,
|
ast::ii_dtor({node: {id: dtor_id, attrs: dtor_attrs,
|
||||||
self_id: new_self, body: dtor_body},
|
self_id: new_self, body: dtor_body},
|
||||||
.. dtor},
|
.. (*dtor)},
|
||||||
nm, new_params, new_parent)
|
nm, new_params, new_parent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -497,8 +497,8 @@ impl method_origin: tr {
|
||||||
typeck::method_static(did) => {
|
typeck::method_static(did) => {
|
||||||
typeck::method_static(did.tr(xcx))
|
typeck::method_static(did.tr(xcx))
|
||||||
}
|
}
|
||||||
typeck::method_param(mp) => {
|
typeck::method_param(ref mp) => {
|
||||||
typeck::method_param({trait_id:mp.trait_id.tr(xcx),.. mp})
|
typeck::method_param({trait_id:(*mp).trait_id.tr(xcx),.. (*mp)})
|
||||||
}
|
}
|
||||||
typeck::method_trait(did, m, vstore) => {
|
typeck::method_trait(did, m, vstore) => {
|
||||||
typeck::method_trait(did.tr(xcx), m, vstore)
|
typeck::method_trait(did.tr(xcx), m, vstore)
|
||||||
|
|
|
@ -51,9 +51,9 @@ impl purity_cause : cmp::Eq {
|
||||||
_ => false
|
_ => false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pc_cmt(e0a) => {
|
pc_cmt(ref e0a) => {
|
||||||
match (*other) {
|
match (*other) {
|
||||||
pc_cmt(e0b) => e0a == e0b,
|
pc_cmt(ref e0b) => (*e0a) == (*e0b),
|
||||||
_ => false
|
_ => false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ impl check_loan_ctxt {
|
||||||
loop {
|
loop {
|
||||||
match pure_map.find(scope_id) {
|
match pure_map.find(scope_id) {
|
||||||
None => (),
|
None => (),
|
||||||
Some(e) => return Some(pc_cmt(e))
|
Some(ref e) => return Some(pc_cmt((*e)))
|
||||||
}
|
}
|
||||||
|
|
||||||
match region_map.find(scope_id) {
|
match region_map.find(scope_id) {
|
||||||
|
@ -224,14 +224,14 @@ impl check_loan_ctxt {
|
||||||
|
|
||||||
let callee_ty = ty::node_id_to_type(tcx, callee_id);
|
let callee_ty = ty::node_id_to_type(tcx, callee_id);
|
||||||
match ty::get(callee_ty).sty {
|
match ty::get(callee_ty).sty {
|
||||||
ty::ty_fn(fn_ty) => {
|
ty::ty_fn(ref fn_ty) => {
|
||||||
match fn_ty.meta.purity {
|
match (*fn_ty).meta.purity {
|
||||||
ast::pure_fn => return, // case (c) above
|
ast::pure_fn => return, // case (c) above
|
||||||
ast::impure_fn | ast::unsafe_fn | ast::extern_fn => {
|
ast::impure_fn | ast::unsafe_fn | ast::extern_fn => {
|
||||||
self.report_purity_error(
|
self.report_purity_error(
|
||||||
pc, callee_span,
|
pc, callee_span,
|
||||||
fmt!("access to %s function",
|
fmt!("access to %s function",
|
||||||
pprust::purity_to_str(fn_ty.meta.purity)));
|
pprust::purity_to_str((*fn_ty).meta.purity)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -369,7 +369,7 @@ impl check_loan_ctxt {
|
||||||
// is not visible from the outside
|
// is not visible from the outside
|
||||||
match self.purity(ex.id) {
|
match self.purity(ex.id) {
|
||||||
None => (),
|
None => (),
|
||||||
Some(pc @ pc_cmt(_)) => {
|
Some(pc_cmt(_)) => {
|
||||||
// Subtle: Issue #3162. If we are enforcing purity
|
// Subtle: Issue #3162. If we are enforcing purity
|
||||||
// because there is a reference to aliasable, mutable data
|
// because there is a reference to aliasable, mutable data
|
||||||
// that we require to be immutable, we can't allow writes
|
// that we require to be immutable, we can't allow writes
|
||||||
|
@ -377,7 +377,9 @@ impl check_loan_ctxt {
|
||||||
// because that aliasable data might have been located on
|
// because that aliasable data might have been located on
|
||||||
// the current stack frame, we don't know.
|
// the current stack frame, we don't know.
|
||||||
self.report_purity_error(
|
self.report_purity_error(
|
||||||
pc, ex.span, at.ing_form(self.bccx.cmt_to_str(cmt)));
|
self.purity(ex.id).get(),
|
||||||
|
ex.span,
|
||||||
|
at.ing_form(self.bccx.cmt_to_str(cmt)));
|
||||||
}
|
}
|
||||||
Some(pc_pure_fn) => {
|
Some(pc_pure_fn) => {
|
||||||
if cmt.lp.is_none() {
|
if cmt.lp.is_none() {
|
||||||
|
@ -446,13 +448,13 @@ impl check_loan_ctxt {
|
||||||
sp,
|
sp,
|
||||||
fmt!("%s prohibited in pure context", msg));
|
fmt!("%s prohibited in pure context", msg));
|
||||||
}
|
}
|
||||||
pc_cmt(e) => {
|
pc_cmt(ref e) => {
|
||||||
if self.reported.insert(e.cmt.id, ()) {
|
if self.reported.insert((*e).cmt.id, ()) {
|
||||||
self.tcx().sess.span_err(
|
self.tcx().sess.span_err(
|
||||||
e.cmt.span,
|
(*e).cmt.span,
|
||||||
fmt!("illegal borrow unless pure: %s",
|
fmt!("illegal borrow unless pure: %s",
|
||||||
self.bccx.bckerr_to_str(e)));
|
self.bccx.bckerr_to_str((*e))));
|
||||||
self.bccx.note_and_explain_bckerr(e);
|
self.bccx.note_and_explain_bckerr((*e));
|
||||||
self.tcx().sess.span_note(
|
self.tcx().sess.span_note(
|
||||||
sp,
|
sp,
|
||||||
fmt!("impure due to %s", msg));
|
fmt!("impure due to %s", msg));
|
||||||
|
@ -538,12 +540,12 @@ impl check_loan_ctxt {
|
||||||
args: ~[@ast::expr]) {
|
args: ~[@ast::expr]) {
|
||||||
match self.purity(expr.id) {
|
match self.purity(expr.id) {
|
||||||
None => {}
|
None => {}
|
||||||
Some(pc) => {
|
Some(ref pc) => {
|
||||||
self.check_pure_callee_or_arg(
|
self.check_pure_callee_or_arg(
|
||||||
pc, callee, callee_id, callee_span);
|
(*pc), callee, callee_id, callee_span);
|
||||||
for args.each |arg| {
|
for args.each |arg| {
|
||||||
self.check_pure_callee_or_arg(
|
self.check_pure_callee_or_arg(
|
||||||
pc, Some(*arg), arg.id, arg.span);
|
(*pc), Some(*arg), arg.id, arg.span);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,8 +150,8 @@ fn req_loans_in_expr(ex: @ast::expr,
|
||||||
}
|
}
|
||||||
|
|
||||||
match self.bccx.method_map.find(ex.id) {
|
match self.bccx.method_map.find(ex.id) {
|
||||||
Some(method_map_entry) => {
|
Some(ref method_map_entry) => {
|
||||||
match method_map_entry.explicit_self {
|
match (*method_map_entry).explicit_self {
|
||||||
ast::sty_by_ref => {
|
ast::sty_by_ref => {
|
||||||
let rcvr_cmt = self.bccx.cat_expr(rcvr);
|
let rcvr_cmt = self.bccx.cat_expr(rcvr);
|
||||||
self.guarantee_valid(rcvr_cmt, m_imm, scope_r);
|
self.guarantee_valid(rcvr_cmt, m_imm, scope_r);
|
||||||
|
@ -167,9 +167,9 @@ fn req_loans_in_expr(ex: @ast::expr,
|
||||||
visit::visit_expr(ex, self, vt);
|
visit::visit_expr(ex, self, vt);
|
||||||
}
|
}
|
||||||
|
|
||||||
ast::expr_match(ex_v, arms) => {
|
ast::expr_match(ex_v, ref arms) => {
|
||||||
let cmt = self.bccx.cat_expr(ex_v);
|
let cmt = self.bccx.cat_expr(ex_v);
|
||||||
for arms.each |arm| {
|
for (*arms).each |arm| {
|
||||||
for arm.pats.each |pat| {
|
for arm.pats.each |pat| {
|
||||||
self.gather_pat(cmt, *pat, arm.body.node.id, ex.id);
|
self.gather_pat(cmt, *pat, arm.body.node.id, ex.id);
|
||||||
}
|
}
|
||||||
|
@ -228,19 +228,19 @@ fn req_loans_in_expr(ex: @ast::expr,
|
||||||
}
|
}
|
||||||
|
|
||||||
// see explanation attached to the `root_ub` field:
|
// see explanation attached to the `root_ub` field:
|
||||||
ast::expr_while(cond, body) => {
|
ast::expr_while(cond, ref body) => {
|
||||||
// during the condition, can only root for the condition
|
// during the condition, can only root for the condition
|
||||||
self.root_ub = cond.id;
|
self.root_ub = cond.id;
|
||||||
(vt.visit_expr)(cond, self, vt);
|
(vt.visit_expr)(cond, self, vt);
|
||||||
|
|
||||||
// during body, can only root for the body
|
// during body, can only root for the body
|
||||||
self.root_ub = body.node.id;
|
self.root_ub = (*body).node.id;
|
||||||
(vt.visit_block)(body, self, vt);
|
(vt.visit_block)((*body), self, vt);
|
||||||
}
|
}
|
||||||
|
|
||||||
// see explanation attached to the `root_ub` field:
|
// see explanation attached to the `root_ub` field:
|
||||||
ast::expr_loop(body, _) => {
|
ast::expr_loop(ref body, _) => {
|
||||||
self.root_ub = body.node.id;
|
self.root_ub = (*body).node.id;
|
||||||
visit::visit_expr(ex, self, vt);
|
visit::visit_expr(ex, self, vt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -331,7 +331,7 @@ impl gather_loan_ctxt {
|
||||||
// error will be reported.
|
// error will be reported.
|
||||||
Some(_) => {
|
Some(_) => {
|
||||||
match self.bccx.loan(cmt, scope_r, req_mutbl) {
|
match self.bccx.loan(cmt, scope_r, req_mutbl) {
|
||||||
Err(e) => { self.bccx.report(e); }
|
Err(ref e) => { self.bccx.report((*e)); }
|
||||||
Ok(move loans) => {
|
Ok(move loans) => {
|
||||||
self.add_loans(cmt, req_mutbl, scope_r, move loans);
|
self.add_loans(cmt, req_mutbl, scope_r, move loans);
|
||||||
}
|
}
|
||||||
|
@ -364,8 +364,8 @@ impl gather_loan_ctxt {
|
||||||
// rooted. good.
|
// rooted. good.
|
||||||
self.bccx.stable_paths += 1;
|
self.bccx.stable_paths += 1;
|
||||||
}
|
}
|
||||||
Ok(pc_if_pure(e)) => {
|
Ok(pc_if_pure(ref e)) => {
|
||||||
debug!("result of preserve: %?", pc_if_pure(e));
|
debug!("result of preserve: %?", pc_if_pure((*e)));
|
||||||
|
|
||||||
// we are only able to guarantee the validity if
|
// we are only able to guarantee the validity if
|
||||||
// the scope is pure
|
// the scope is pure
|
||||||
|
@ -374,7 +374,7 @@ impl gather_loan_ctxt {
|
||||||
// if the scope is some block/expr in the
|
// if the scope is some block/expr in the
|
||||||
// fn, then just require that this scope
|
// fn, then just require that this scope
|
||||||
// be pure
|
// be pure
|
||||||
self.req_maps.pure_map.insert(pure_id, e);
|
self.req_maps.pure_map.insert(pure_id, (*e));
|
||||||
self.bccx.req_pure_paths += 1;
|
self.bccx.req_pure_paths += 1;
|
||||||
|
|
||||||
debug!("requiring purity for scope %?",
|
debug!("requiring purity for scope %?",
|
||||||
|
@ -390,14 +390,14 @@ impl gather_loan_ctxt {
|
||||||
// otherwise, we can't enforce purity for
|
// otherwise, we can't enforce purity for
|
||||||
// that scope, so give up and report an
|
// that scope, so give up and report an
|
||||||
// error
|
// error
|
||||||
self.bccx.report(e);
|
self.bccx.report((*e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(ref e) => {
|
||||||
// we cannot guarantee the validity of this pointer
|
// we cannot guarantee the validity of this pointer
|
||||||
debug!("result of preserve: error");
|
debug!("result of preserve: error");
|
||||||
self.bccx.report(e);
|
self.bccx.report((*e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ impl borrowck_ctxt {
|
||||||
loans: ~[]
|
loans: ~[]
|
||||||
};
|
};
|
||||||
match lc.loan(cmt, mutbl) {
|
match lc.loan(cmt, mutbl) {
|
||||||
Err(e) => Err(e),
|
Err(ref e) => Err((*e)),
|
||||||
Ok(()) => {
|
Ok(()) => {
|
||||||
let LoanContext {loans, _} = move lc;
|
let LoanContext {loans, _} = move lc;
|
||||||
Ok(loans)
|
Ok(loans)
|
||||||
|
|
|
@ -500,7 +500,7 @@ impl borrowck_ctxt {
|
||||||
fn report_if_err(bres: bckres<()>) {
|
fn report_if_err(bres: bckres<()>) {
|
||||||
match bres {
|
match bres {
|
||||||
Ok(()) => (),
|
Ok(()) => (),
|
||||||
Err(e) => self.report(e)
|
Err(ref e) => self.report((*e))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -178,9 +178,9 @@ priv impl &preserve_ctxt {
|
||||||
debug!("must root @T, otherwise purity req'd");
|
debug!("must root @T, otherwise purity req'd");
|
||||||
self.attempt_root(cmt, base, derefs)
|
self.attempt_root(cmt, base, derefs)
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(ref e) => {
|
||||||
debug!("must root @T, err: %s",
|
debug!("must root @T, err: %s",
|
||||||
self.bccx.bckerr_to_str(e));
|
self.bccx.bckerr_to_str((*e)));
|
||||||
self.attempt_root(cmt, base, derefs)
|
self.attempt_root(cmt, base, derefs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -274,13 +274,13 @@ priv impl &preserve_ctxt {
|
||||||
}
|
}
|
||||||
|
|
||||||
// the base requires purity too, that's fine
|
// the base requires purity too, that's fine
|
||||||
Ok(pc_if_pure(e)) => {
|
Ok(pc_if_pure(ref e)) => {
|
||||||
Ok(pc_if_pure(e))
|
Ok(pc_if_pure((*e)))
|
||||||
}
|
}
|
||||||
|
|
||||||
// base is not stable, doesn't matter
|
// base is not stable, doesn't matter
|
||||||
Err(e) => {
|
Err(ref e) => {
|
||||||
Err(e)
|
Err((*e))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,13 +35,13 @@ fn check_crate(tcx: ty::ctxt, crate: @crate) {
|
||||||
fn check_expr(tcx: ty::ctxt, ex: @expr, &&s: (), v: visit::vt<()>) {
|
fn check_expr(tcx: ty::ctxt, ex: @expr, &&s: (), v: visit::vt<()>) {
|
||||||
visit::visit_expr(ex, s, v);
|
visit::visit_expr(ex, s, v);
|
||||||
match ex.node {
|
match ex.node {
|
||||||
expr_match(scrut, arms) => {
|
expr_match(scrut, ref arms) => {
|
||||||
check_arms(tcx, arms);
|
check_arms(tcx, (*arms));
|
||||||
/* Check for exhaustiveness */
|
/* Check for exhaustiveness */
|
||||||
// Check for empty enum, because is_useful only works on inhabited
|
// Check for empty enum, because is_useful only works on inhabited
|
||||||
// types.
|
// types.
|
||||||
let pat_ty = node_id_to_type(tcx, scrut.id);
|
let pat_ty = node_id_to_type(tcx, scrut.id);
|
||||||
if arms.is_empty() {
|
if (*arms).is_empty() {
|
||||||
if !type_is_empty(tcx, pat_ty) {
|
if !type_is_empty(tcx, pat_ty) {
|
||||||
// We know the type is inhabited, so this must be wrong
|
// We know the type is inhabited, so this must be wrong
|
||||||
tcx.sess.span_err(ex.span, fmt!("non-exhaustive patterns: \
|
tcx.sess.span_err(ex.span, fmt!("non-exhaustive patterns: \
|
||||||
|
@ -52,14 +52,14 @@ fn check_expr(tcx: ty::ctxt, ex: @expr, &&s: (), v: visit::vt<()>) {
|
||||||
}
|
}
|
||||||
match ty::get(pat_ty).sty {
|
match ty::get(pat_ty).sty {
|
||||||
ty_enum(did, _) => {
|
ty_enum(did, _) => {
|
||||||
if (*enum_variants(tcx, did)).is_empty() && arms.is_empty() {
|
if (*enum_variants(tcx, did)).is_empty() && (*arms).is_empty() {
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => { /* We assume only enum types can be uninhabited */ }
|
_ => { /* We assume only enum types can be uninhabited */ }
|
||||||
}
|
}
|
||||||
let arms = vec::concat(vec::filter_map(arms, unguarded_pat));
|
let arms = vec::concat(vec::filter_map((*arms), unguarded_pat));
|
||||||
check_exhaustive(tcx, ex.span, arms);
|
check_exhaustive(tcx, ex.span, arms);
|
||||||
}
|
}
|
||||||
_ => ()
|
_ => ()
|
||||||
|
@ -95,17 +95,17 @@ fn check_exhaustive(tcx: ty::ctxt, sp: span, pats: ~[@pat]) {
|
||||||
let ext = match is_useful(tcx, vec::map(pats, |p| ~[*p]), ~[wild()]) {
|
let ext = match is_useful(tcx, vec::map(pats, |p| ~[*p]), ~[wild()]) {
|
||||||
not_useful => return, // This is good, wildcard pattern isn't reachable
|
not_useful => return, // This is good, wildcard pattern isn't reachable
|
||||||
useful_ => None,
|
useful_ => None,
|
||||||
useful(ty, ctor) => {
|
useful(ty, ref ctor) => {
|
||||||
match ty::get(ty).sty {
|
match ty::get(ty).sty {
|
||||||
ty::ty_bool => {
|
ty::ty_bool => {
|
||||||
match ctor {
|
match (*ctor) {
|
||||||
val(const_bool(true)) => Some(~"true"),
|
val(const_bool(true)) => Some(~"true"),
|
||||||
val(const_bool(false)) => Some(~"false"),
|
val(const_bool(false)) => Some(~"false"),
|
||||||
_ => None
|
_ => None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ty::ty_enum(id, _) => {
|
ty::ty_enum(id, _) => {
|
||||||
let vid = match ctor { variant(id) => id,
|
let vid = match (*ctor) { variant(id) => id,
|
||||||
_ => fail ~"check_exhaustive: non-variant ctor" };
|
_ => fail ~"check_exhaustive: non-variant ctor" };
|
||||||
match vec::find(*ty::enum_variants(tcx, id),
|
match vec::find(*ty::enum_variants(tcx, id),
|
||||||
|v| v.id == vid) {
|
|v| v.id == vid) {
|
||||||
|
@ -118,7 +118,7 @@ fn check_exhaustive(tcx: ty::ctxt, sp: span, pats: ~[@pat]) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let msg = ~"non-exhaustive patterns" + match ext {
|
let msg = ~"non-exhaustive patterns" + match ext {
|
||||||
Some(s) => ~": " + s + ~" not covered",
|
Some(ref s) => ~": " + (*s) + ~" not covered",
|
||||||
None => ~""
|
None => ~""
|
||||||
};
|
};
|
||||||
tcx.sess.span_err(sp, msg);
|
tcx.sess.span_err(sp, msg);
|
||||||
|
@ -140,9 +140,9 @@ impl ctor : cmp::Eq {
|
||||||
match ((*self), (*other)) {
|
match ((*self), (*other)) {
|
||||||
(single, single) => true,
|
(single, single) => true,
|
||||||
(variant(did_self), variant(did_other)) => did_self == did_other,
|
(variant(did_self), variant(did_other)) => did_self == did_other,
|
||||||
(val(cv_self), val(cv_other)) => cv_self == cv_other,
|
(val(ref cv_self), val(ref cv_other)) => (*cv_self) == (*cv_other),
|
||||||
(range(cv0_self, cv1_self), range(cv0_other, cv1_other)) => {
|
(range(ref cv0_self, ref cv1_self), range(ref cv0_other, ref cv1_other)) => {
|
||||||
cv0_self == cv0_other && cv1_self == cv1_other
|
(*cv0_self) == (*cv0_other) && (*cv1_self) == (*cv1_other)
|
||||||
}
|
}
|
||||||
(single, _) | (variant(_), _) | (val(_), _) | (range(*), _) => {
|
(single, _) | (variant(_), _) | (val(_), _) | (range(*), _) => {
|
||||||
false
|
false
|
||||||
|
@ -186,7 +186,7 @@ fn is_useful(tcx: ty::ctxt, m: matrix, v: ~[@pat]) -> useful {
|
||||||
is_useful_specialized(tcx, m, v, val(const_bool(false)),
|
is_useful_specialized(tcx, m, v, val(const_bool(false)),
|
||||||
0u, left_ty)
|
0u, left_ty)
|
||||||
}
|
}
|
||||||
u => u
|
ref u => (*u)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ty::ty_enum(eid, _) => {
|
ty::ty_enum(eid, _) => {
|
||||||
|
@ -194,7 +194,7 @@ fn is_useful(tcx: ty::ctxt, m: matrix, v: ~[@pat]) -> useful {
|
||||||
match is_useful_specialized(tcx, m, v, variant(va.id),
|
match is_useful_specialized(tcx, m, v, variant(va.id),
|
||||||
va.args.len(), left_ty) {
|
va.args.len(), left_ty) {
|
||||||
not_useful => (),
|
not_useful => (),
|
||||||
u => return u
|
ref u => return (*u)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
not_useful
|
not_useful
|
||||||
|
@ -205,18 +205,18 @@ fn is_useful(tcx: ty::ctxt, m: matrix, v: ~[@pat]) -> useful {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(ctor) => {
|
Some(ref ctor) => {
|
||||||
match is_useful(tcx, vec::filter_map(m, |r| default(tcx, *r) ),
|
match is_useful(tcx, vec::filter_map(m, |r| default(tcx, *r) ),
|
||||||
vec::tail(v)) {
|
vec::tail(v)) {
|
||||||
useful_ => useful(left_ty, ctor),
|
useful_ => useful(left_ty, (*ctor)),
|
||||||
u => u
|
ref u => (*u)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(v0_ctor) => {
|
Some(ref v0_ctor) => {
|
||||||
let arity = ctor_arity(tcx, v0_ctor, left_ty);
|
let arity = ctor_arity(tcx, (*v0_ctor), left_ty);
|
||||||
is_useful_specialized(tcx, m, v, v0_ctor, arity, left_ty)
|
is_useful_specialized(tcx, m, v, (*v0_ctor), arity, left_ty)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -228,7 +228,7 @@ fn is_useful_specialized(tcx: ty::ctxt, m: matrix, v: ~[@pat], ctor: ctor,
|
||||||
tcx, ms, specialize(tcx, v, ctor, arity, lty).get());
|
tcx, ms, specialize(tcx, v, ctor, arity, lty).get());
|
||||||
match could_be_useful {
|
match could_be_useful {
|
||||||
useful_ => useful(lty, ctor),
|
useful_ => useful(lty, ctor),
|
||||||
u => u
|
ref u => (*u)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -362,10 +362,10 @@ fn specialize(tcx: ty::ctxt, r: ~[@pat], ctor_id: ctor, arity: uint,
|
||||||
let const_expr = lookup_const_by_id(tcx, did).get();
|
let const_expr = lookup_const_by_id(tcx, did).get();
|
||||||
let e_v = eval_const_expr(tcx, const_expr);
|
let e_v = eval_const_expr(tcx, const_expr);
|
||||||
let match_ = match ctor_id {
|
let match_ = match ctor_id {
|
||||||
val(v) => compare_const_vals(e_v, v) == 0,
|
val(ref v) => compare_const_vals(e_v, (*v)) == 0,
|
||||||
range(c_lo, c_hi) => {
|
range(ref c_lo, ref c_hi) => {
|
||||||
compare_const_vals(c_lo, e_v) >= 0 &&
|
compare_const_vals((*c_lo), e_v) >= 0 &&
|
||||||
compare_const_vals(c_hi, e_v) <= 0
|
compare_const_vals((*c_hi), e_v) <= 0
|
||||||
}
|
}
|
||||||
single => true,
|
single => true,
|
||||||
_ => fail ~"type error"
|
_ => fail ~"type error"
|
||||||
|
@ -456,10 +456,10 @@ fn specialize(tcx: ty::ctxt, r: ~[@pat], ctor_id: ctor, arity: uint,
|
||||||
pat_lit(expr) => {
|
pat_lit(expr) => {
|
||||||
let e_v = eval_const_expr(tcx, expr);
|
let e_v = eval_const_expr(tcx, expr);
|
||||||
let match_ = match ctor_id {
|
let match_ = match ctor_id {
|
||||||
val(v) => compare_const_vals(e_v, v) == 0,
|
val(ref v) => compare_const_vals(e_v, (*v)) == 0,
|
||||||
range(c_lo, c_hi) => {
|
range(ref c_lo, ref c_hi) => {
|
||||||
compare_const_vals(c_lo, e_v) >= 0 &&
|
compare_const_vals((*c_lo), e_v) >= 0 &&
|
||||||
compare_const_vals(c_hi, e_v) <= 0
|
compare_const_vals((*c_hi), e_v) <= 0
|
||||||
}
|
}
|
||||||
single => true,
|
single => true,
|
||||||
_ => fail ~"type error"
|
_ => fail ~"type error"
|
||||||
|
@ -468,8 +468,8 @@ fn specialize(tcx: ty::ctxt, r: ~[@pat], ctor_id: ctor, arity: uint,
|
||||||
}
|
}
|
||||||
pat_range(lo, hi) => {
|
pat_range(lo, hi) => {
|
||||||
let (c_lo, c_hi) = match ctor_id {
|
let (c_lo, c_hi) = match ctor_id {
|
||||||
val(v) => (v, v),
|
val(ref v) => ((*v), (*v)),
|
||||||
range(lo, hi) => (lo, hi),
|
range(ref lo, ref hi) => ((*lo), (*hi)),
|
||||||
single => return Some(vec::tail(r)),
|
single => return Some(vec::tail(r)),
|
||||||
_ => fail ~"type error"
|
_ => fail ~"type error"
|
||||||
};
|
};
|
||||||
|
|
|
@ -35,8 +35,8 @@ fn check_item(sess: Session, ast_map: ast_map::map,
|
||||||
(v.visit_expr)(ex, true, v);
|
(v.visit_expr)(ex, true, v);
|
||||||
check_item_recursion(sess, ast_map, def_map, it);
|
check_item_recursion(sess, ast_map, def_map, it);
|
||||||
}
|
}
|
||||||
item_enum(enum_definition, _) => {
|
item_enum(ref enum_definition, _) => {
|
||||||
for enum_definition.variants.each |var| {
|
for (*enum_definition).variants.each |var| {
|
||||||
do option::iter(&var.node.disr_expr) |ex| {
|
do option::iter(&var.node.disr_expr) |ex| {
|
||||||
(v.visit_expr)(*ex, true, v);
|
(v.visit_expr)(*ex, true, v);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,23 +22,23 @@ fn check_crate(tcx: ty::ctxt, crate: @crate) {
|
||||||
},
|
},
|
||||||
visit_expr: |e: @expr, cx: ctx, v: visit::vt<ctx>| {
|
visit_expr: |e: @expr, cx: ctx, v: visit::vt<ctx>| {
|
||||||
match e.node {
|
match e.node {
|
||||||
expr_while(e, b) => {
|
expr_while(e, ref b) => {
|
||||||
(v.visit_expr)(e, cx, v);
|
(v.visit_expr)(e, cx, v);
|
||||||
(v.visit_block)(b, {in_loop: true,.. cx}, v);
|
(v.visit_block)((*b), {in_loop: true,.. cx}, v);
|
||||||
}
|
}
|
||||||
expr_loop(b, _) => {
|
expr_loop(ref b, _) => {
|
||||||
(v.visit_block)(b, {in_loop: true,.. cx}, v);
|
(v.visit_block)((*b), {in_loop: true,.. cx}, v);
|
||||||
}
|
}
|
||||||
expr_fn(_, _, _, _) => {
|
expr_fn(_, _, _, _) => {
|
||||||
visit::visit_expr(e, {in_loop: false, can_ret: true}, v);
|
visit::visit_expr(e, {in_loop: false, can_ret: true}, v);
|
||||||
}
|
}
|
||||||
expr_fn_block(_, b, _) => {
|
expr_fn_block(_, ref b, _) => {
|
||||||
(v.visit_block)(b, {in_loop: false, can_ret: false}, v);
|
(v.visit_block)((*b), {in_loop: false, can_ret: false}, v);
|
||||||
}
|
}
|
||||||
expr_loop_body(@{node: expr_fn_block(_, b, _), _}) => {
|
expr_loop_body(@{node: expr_fn_block(_, ref b, _), _}) => {
|
||||||
let proto = ty::ty_fn_proto(ty::expr_ty(tcx, e));
|
let proto = ty::ty_fn_proto(ty::expr_ty(tcx, e));
|
||||||
let blk = (proto == ProtoBorrowed);
|
let blk = (proto == ProtoBorrowed);
|
||||||
(v.visit_block)(b, {in_loop: true, can_ret: blk}, v);
|
(v.visit_block)((*b), {in_loop: true, can_ret: blk}, v);
|
||||||
}
|
}
|
||||||
expr_break(_) => {
|
expr_break(_) => {
|
||||||
if !cx.in_loop {
|
if !cx.in_loop {
|
||||||
|
|
|
@ -107,9 +107,9 @@ fn classify(e: @expr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ast::expr_struct(_, fs, None) |
|
ast::expr_struct(_, ref fs, None) |
|
||||||
ast::expr_rec(fs, None) => {
|
ast::expr_rec(ref fs, None) => {
|
||||||
let cs = do vec::map(fs) |f| {
|
let cs = do vec::map((*fs)) |f| {
|
||||||
if f.node.mutbl == ast::m_imm {
|
if f.node.mutbl == ast::m_imm {
|
||||||
classify(f.node.expr, def_map, tcx)
|
classify(f.node.expr, def_map, tcx)
|
||||||
} else {
|
} else {
|
||||||
|
@ -222,7 +222,7 @@ impl const_val : cmp::Eq {
|
||||||
(const_float(a), const_float(b)) => a == b,
|
(const_float(a), const_float(b)) => a == b,
|
||||||
(const_int(a), const_int(b)) => a == b,
|
(const_int(a), const_int(b)) => a == b,
|
||||||
(const_uint(a), const_uint(b)) => a == b,
|
(const_uint(a), const_uint(b)) => a == b,
|
||||||
(const_str(a), const_str(b)) => a == b,
|
(const_str(ref a), const_str(ref b)) => (*a) == (*b),
|
||||||
(const_bool(a), const_bool(b)) => a == b,
|
(const_bool(a), const_bool(b)) => a == b,
|
||||||
(const_float(_), _) | (const_int(_), _) | (const_uint(_), _) |
|
(const_float(_), _) | (const_int(_), _) | (const_uint(_), _) |
|
||||||
(const_str(_), _) | (const_bool(_), _) => false
|
(const_str(_), _) | (const_bool(_), _) => false
|
||||||
|
@ -233,8 +233,8 @@ impl const_val : cmp::Eq {
|
||||||
|
|
||||||
fn eval_const_expr(tcx: middle::ty::ctxt, e: @expr) -> const_val {
|
fn eval_const_expr(tcx: middle::ty::ctxt, e: @expr) -> const_val {
|
||||||
match eval_const_expr_partial(tcx, e) {
|
match eval_const_expr_partial(tcx, e) {
|
||||||
Ok(r) => r,
|
Ok(ref r) => (*r),
|
||||||
Err(s) => fail s
|
Err(ref s) => fail (*s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,7 +250,7 @@ fn eval_const_expr_partial(tcx: middle::ty::ctxt, e: @expr)
|
||||||
Ok(const_uint(i)) => Ok(const_uint(-i)),
|
Ok(const_uint(i)) => Ok(const_uint(-i)),
|
||||||
Ok(const_str(_)) => Err(~"Negate on string"),
|
Ok(const_str(_)) => Err(~"Negate on string"),
|
||||||
Ok(const_bool(_)) => Err(~"Negate on boolean"),
|
Ok(const_bool(_)) => Err(~"Negate on boolean"),
|
||||||
err => err
|
ref err => (*err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
expr_unary(not, inner) => {
|
expr_unary(not, inner) => {
|
||||||
|
@ -438,10 +438,10 @@ fn compare_const_vals(a: const_val, b: const_val) -> int {
|
||||||
1
|
1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(const_str(a), const_str(b)) => {
|
(const_str(ref a), const_str(ref b)) => {
|
||||||
if a == b {
|
if (*a) == (*b) {
|
||||||
0
|
0
|
||||||
} else if a < b {
|
} else if (*a) < (*b) {
|
||||||
-1
|
-1
|
||||||
} else {
|
} else {
|
||||||
1
|
1
|
||||||
|
|
|
@ -308,8 +308,8 @@ fn check_expr(e: @expr, cx: ctx, v: visit::vt<ctx>) {
|
||||||
check_copy_ex(cx, ls, false, reason);
|
check_copy_ex(cx, ls, false, reason);
|
||||||
check_copy_ex(cx, rs, false, reason);
|
check_copy_ex(cx, rs, false, reason);
|
||||||
}
|
}
|
||||||
expr_rec(fields, def) | expr_struct(_, fields, def) => {
|
expr_rec(ref fields, def) | expr_struct(_, ref fields, def) => {
|
||||||
for fields.each |field| { maybe_copy(cx, field.node.expr,
|
for (*fields).each |field| { maybe_copy(cx, field.node.expr,
|
||||||
Some(("record or struct fields require \
|
Some(("record or struct fields require \
|
||||||
copyable arguments", ""))); }
|
copyable arguments", ""))); }
|
||||||
match def {
|
match def {
|
||||||
|
@ -318,13 +318,13 @@ fn check_expr(e: @expr, cx: ctx, v: visit::vt<ctx>) {
|
||||||
let t = ty::expr_ty(cx.tcx, ex);
|
let t = ty::expr_ty(cx.tcx, ex);
|
||||||
let ty_fields = match ty::get(t).sty {
|
let ty_fields = match ty::get(t).sty {
|
||||||
ty::ty_rec(f) => f,
|
ty::ty_rec(f) => f,
|
||||||
ty::ty_class(did, substs) =>
|
ty::ty_class(did, ref substs) =>
|
||||||
ty::class_items_as_fields(cx.tcx, did, &substs),
|
ty::class_items_as_fields(cx.tcx, did, &(*substs)),
|
||||||
_ => cx.tcx.sess.span_bug(ex.span,
|
_ => cx.tcx.sess.span_bug(ex.span,
|
||||||
~"bad base expr type in record")
|
~"bad base expr type in record")
|
||||||
};
|
};
|
||||||
for ty_fields.each |tf| {
|
for ty_fields.each |tf| {
|
||||||
if !vec::any(fields, |f| f.node.ident == tf.ident ) &&
|
if !vec::any((*fields), |f| f.node.ident == tf.ident ) &&
|
||||||
!ty::kind_can_be_copied(ty::type_kind(cx.tcx, tf.mt.ty)) {
|
!ty::kind_can_be_copied(ty::type_kind(cx.tcx, tf.mt.ty)) {
|
||||||
cx.tcx.sess.span_err(e.span,
|
cx.tcx.sess.span_err(e.span,
|
||||||
~"copying a noncopyable value");
|
~"copying a noncopyable value");
|
||||||
|
@ -593,7 +593,7 @@ fn check_cast_for_escaping_regions(
|
||||||
// worries.
|
// worries.
|
||||||
let target_ty = ty::expr_ty(cx.tcx, target);
|
let target_ty = ty::expr_ty(cx.tcx, target);
|
||||||
let target_substs = match ty::get(target_ty).sty {
|
let target_substs = match ty::get(target_ty).sty {
|
||||||
ty::ty_trait(_, substs, _) => {substs}
|
ty::ty_trait(_, ref substs, _) => {(*substs)}
|
||||||
_ => { return; /* not a cast to a trait */ }
|
_ => { return; /* not a cast to a trait */ }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -153,10 +153,10 @@ impl LanguageItemCollector {
|
||||||
fn match_and_collect_meta_item(item_def_id: def_id,
|
fn match_and_collect_meta_item(item_def_id: def_id,
|
||||||
meta_item: meta_item) {
|
meta_item: meta_item) {
|
||||||
match meta_item.node {
|
match meta_item.node {
|
||||||
meta_name_value(key, literal) => {
|
meta_name_value(ref key, literal) => {
|
||||||
match literal.node {
|
match literal.node {
|
||||||
lit_str(value) => {
|
lit_str(value) => {
|
||||||
self.match_and_collect_item(item_def_id, key, *value);
|
self.match_and_collect_item(item_def_id, (*key), *value);
|
||||||
}
|
}
|
||||||
_ => {} // Skip.
|
_ => {} // Skip.
|
||||||
}
|
}
|
||||||
|
|
|
@ -303,8 +303,8 @@ impl ctxt {
|
||||||
ast::meta_list(_, metas) => {
|
ast::meta_list(_, metas) => {
|
||||||
for metas.each |meta| {
|
for metas.each |meta| {
|
||||||
match meta.node {
|
match meta.node {
|
||||||
ast::meta_word(lintname) => {
|
ast::meta_word(ref lintname) => {
|
||||||
triples.push((*meta, *level, lintname));
|
triples.push((*meta, *level, *lintname));
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
self.sess.span_err(
|
self.sess.span_err(
|
||||||
|
@ -547,9 +547,9 @@ fn check_item_type_limits(cx: ty::ctxt, it: @ast::item) {
|
||||||
let visit = item_stopping_visitor(visit::mk_simple_visitor(@{
|
let visit = item_stopping_visitor(visit::mk_simple_visitor(@{
|
||||||
visit_expr: fn@(e: @ast::expr) {
|
visit_expr: fn@(e: @ast::expr) {
|
||||||
match e.node {
|
match e.node {
|
||||||
ast::expr_binary(binop, @l, @r) => {
|
ast::expr_binary(ref binop, @ref l, @ref r) => {
|
||||||
if is_comparison(binop)
|
if is_comparison(*binop)
|
||||||
&& !check_limits(cx, binop, &l, &r) {
|
&& !check_limits(cx, *binop, l, r) {
|
||||||
cx.sess.span_lint(
|
cx.sess.span_lint(
|
||||||
type_limits, e.id, it.id, e.span,
|
type_limits, e.id, it.id, e.span,
|
||||||
~"comparison is useless due to type limits");
|
~"comparison is useless due to type limits");
|
||||||
|
@ -756,7 +756,7 @@ fn check_item_non_camel_case_types(cx: ty::ctxt, it: @ast::item) {
|
||||||
ast::item_trait(*) => {
|
ast::item_trait(*) => {
|
||||||
check_case(cx, it.ident, it.id, it.id, it.span)
|
check_case(cx, it.ident, it.id, it.id, it.span)
|
||||||
}
|
}
|
||||||
ast::item_enum(enum_definition, _) => {
|
ast::item_enum(ref enum_definition, _) => {
|
||||||
check_case(cx, it.ident, it.id, it.id, it.span);
|
check_case(cx, it.ident, it.id, it.id, it.span);
|
||||||
for enum_definition.variants.each |variant| {
|
for enum_definition.variants.each |variant| {
|
||||||
check_case(cx, variant.node.name,
|
check_case(cx, variant.node.name,
|
||||||
|
@ -782,6 +782,7 @@ fn check_pat(tcx: ty::ctxt, pat: @ast::pat) {
|
||||||
span,
|
span,
|
||||||
fmt!("binding `%s` should use ref or copy mode",
|
fmt!("binding `%s` should use ref or copy mode",
|
||||||
tcx.sess.str_of(path_to_ident(path))));
|
tcx.sess.str_of(path_to_ident(path))));
|
||||||
|
tcx.bad_bindings.insert(id, ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -806,7 +807,7 @@ fn check_fn(tcx: ty::ctxt, fk: visit::fn_kind, decl: ast::fn_decl,
|
||||||
fn check_fn_deprecated_modes(tcx: ty::ctxt, fn_ty: ty::t, decl: ast::fn_decl,
|
fn check_fn_deprecated_modes(tcx: ty::ctxt, fn_ty: ty::t, decl: ast::fn_decl,
|
||||||
span: span, id: ast::node_id) {
|
span: span, id: ast::node_id) {
|
||||||
match ty::get(fn_ty).sty {
|
match ty::get(fn_ty).sty {
|
||||||
ty::ty_fn(fn_ty) => {
|
ty::ty_fn(ref fn_ty) => {
|
||||||
let mut counter = 0;
|
let mut counter = 0;
|
||||||
for vec::each2(fn_ty.sig.inputs, decl.inputs) |arg_ty, arg_ast| {
|
for vec::each2(fn_ty.sig.inputs, decl.inputs) |arg_ty, arg_ast| {
|
||||||
counter += 1;
|
counter += 1;
|
||||||
|
|
|
@ -1058,7 +1058,7 @@ impl Liveness {
|
||||||
self.propagate_through_expr(e, succ)
|
self.propagate_through_expr(e, succ)
|
||||||
}
|
}
|
||||||
|
|
||||||
expr_fn(_, _, blk, _) | expr_fn_block(_, blk, _) => {
|
expr_fn(_, _, ref blk, _) | expr_fn_block(_, ref blk, _) => {
|
||||||
debug!("%s is an expr_fn or expr_fn_block",
|
debug!("%s is an expr_fn or expr_fn_block",
|
||||||
expr_to_str(expr, self.tcx.sess.intr()));
|
expr_to_str(expr, self.tcx.sess.intr()));
|
||||||
|
|
||||||
|
@ -1066,7 +1066,7 @@ impl Liveness {
|
||||||
The next-node for a break is the successor of the entire
|
The next-node for a break is the successor of the entire
|
||||||
loop. The next-node for a continue is the top of this loop.
|
loop. The next-node for a continue is the top of this loop.
|
||||||
*/
|
*/
|
||||||
self.with_loop_nodes(blk.node.id, succ,
|
self.with_loop_nodes((*blk).node.id, succ,
|
||||||
self.live_node(expr.id, expr.span), || {
|
self.live_node(expr.id, expr.span), || {
|
||||||
|
|
||||||
// the construction of a closure itself is not important,
|
// the construction of a closure itself is not important,
|
||||||
|
@ -1081,7 +1081,7 @@ impl Liveness {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
expr_if(cond, then, els) => {
|
expr_if(cond, ref then, els) => {
|
||||||
//
|
//
|
||||||
// (cond)
|
// (cond)
|
||||||
// |
|
// |
|
||||||
|
@ -1096,24 +1096,24 @@ impl Liveness {
|
||||||
// ( succ )
|
// ( succ )
|
||||||
//
|
//
|
||||||
let else_ln = self.propagate_through_opt_expr(els, succ);
|
let else_ln = self.propagate_through_opt_expr(els, succ);
|
||||||
let then_ln = self.propagate_through_block(then, succ);
|
let then_ln = self.propagate_through_block((*then), succ);
|
||||||
let ln = self.live_node(expr.id, expr.span);
|
let ln = self.live_node(expr.id, expr.span);
|
||||||
self.init_from_succ(ln, else_ln);
|
self.init_from_succ(ln, else_ln);
|
||||||
self.merge_from_succ(ln, then_ln, false);
|
self.merge_from_succ(ln, then_ln, false);
|
||||||
self.propagate_through_expr(cond, ln)
|
self.propagate_through_expr(cond, ln)
|
||||||
}
|
}
|
||||||
|
|
||||||
expr_while(cond, blk) => {
|
expr_while(cond, ref blk) => {
|
||||||
self.propagate_through_loop(expr, Some(cond), blk, succ)
|
self.propagate_through_loop(expr, Some(cond), (*blk), succ)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note that labels have been resolved, so we don't need to look
|
// Note that labels have been resolved, so we don't need to look
|
||||||
// at the label ident
|
// at the label ident
|
||||||
expr_loop(blk, _) => {
|
expr_loop(ref blk, _) => {
|
||||||
self.propagate_through_loop(expr, None, blk, succ)
|
self.propagate_through_loop(expr, None, (*blk), succ)
|
||||||
}
|
}
|
||||||
|
|
||||||
expr_match(e, arms) => {
|
expr_match(e, ref arms) => {
|
||||||
//
|
//
|
||||||
// (e)
|
// (e)
|
||||||
// |
|
// |
|
||||||
|
@ -1131,7 +1131,7 @@ impl Liveness {
|
||||||
let ln = self.live_node(expr.id, expr.span);
|
let ln = self.live_node(expr.id, expr.span);
|
||||||
self.init_empty(ln, succ);
|
self.init_empty(ln, succ);
|
||||||
let mut first_merge = true;
|
let mut first_merge = true;
|
||||||
for arms.each |arm| {
|
for (*arms).each |arm| {
|
||||||
let body_succ =
|
let body_succ =
|
||||||
self.propagate_through_block(arm.body, succ);
|
self.propagate_through_block(arm.body, succ);
|
||||||
let guard_succ =
|
let guard_succ =
|
||||||
|
@ -1223,16 +1223,16 @@ impl Liveness {
|
||||||
self.propagate_through_expr(element, succ)
|
self.propagate_through_expr(element, succ)
|
||||||
}
|
}
|
||||||
|
|
||||||
expr_rec(fields, with_expr) => {
|
expr_rec(ref fields, with_expr) => {
|
||||||
let succ = self.propagate_through_opt_expr(with_expr, succ);
|
let succ = self.propagate_through_opt_expr(with_expr, succ);
|
||||||
do fields.foldr(succ) |field, succ| {
|
do (*fields).foldr(succ) |field, succ| {
|
||||||
self.propagate_through_expr(field.node.expr, succ)
|
self.propagate_through_expr(field.node.expr, succ)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
expr_struct(_, fields, with_expr) => {
|
expr_struct(_, ref fields, with_expr) => {
|
||||||
let succ = self.propagate_through_opt_expr(with_expr, succ);
|
let succ = self.propagate_through_opt_expr(with_expr, succ);
|
||||||
do fields.foldr(succ) |field, succ| {
|
do (*fields).foldr(succ) |field, succ| {
|
||||||
self.propagate_through_expr(field.node.expr, succ)
|
self.propagate_through_expr(field.node.expr, succ)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1294,8 +1294,8 @@ impl Liveness {
|
||||||
succ
|
succ
|
||||||
}
|
}
|
||||||
|
|
||||||
expr_block(blk) => {
|
expr_block(ref blk) => {
|
||||||
self.propagate_through_block(blk, succ)
|
self.propagate_through_block((*blk), succ)
|
||||||
}
|
}
|
||||||
|
|
||||||
expr_mac(*) => {
|
expr_mac(*) => {
|
||||||
|
|
|
@ -315,7 +315,7 @@ fn opt_deref_kind(t: ty::t) -> Option<deref_kind> {
|
||||||
Some(deref_ptr(uniq_ptr))
|
Some(deref_ptr(uniq_ptr))
|
||||||
}
|
}
|
||||||
|
|
||||||
ty::ty_fn(f) if f.meta.proto == ast::ProtoUniq => {
|
ty::ty_fn(ref f) if (*f).meta.proto == ast::ProtoUniq => {
|
||||||
Some(deref_ptr(uniq_ptr))
|
Some(deref_ptr(uniq_ptr))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,8 +325,8 @@ fn opt_deref_kind(t: ty::t) -> Option<deref_kind> {
|
||||||
Some(deref_ptr(region_ptr(r)))
|
Some(deref_ptr(region_ptr(r)))
|
||||||
}
|
}
|
||||||
|
|
||||||
ty::ty_fn(f) if f.meta.proto == ast::ProtoBorrowed => {
|
ty::ty_fn(ref f) if (*f).meta.proto == ast::ProtoBorrowed => {
|
||||||
Some(deref_ptr(region_ptr(f.meta.region)))
|
Some(deref_ptr(region_ptr((*f).meta.region)))
|
||||||
}
|
}
|
||||||
|
|
||||||
ty::ty_box(*) |
|
ty::ty_box(*) |
|
||||||
|
@ -335,7 +335,7 @@ fn opt_deref_kind(t: ty::t) -> Option<deref_kind> {
|
||||||
Some(deref_ptr(gc_ptr))
|
Some(deref_ptr(gc_ptr))
|
||||||
}
|
}
|
||||||
|
|
||||||
ty::ty_fn(f) if f.meta.proto == ast::ProtoBox => {
|
ty::ty_fn(ref f) if (*f).meta.proto == ast::ProtoBox => {
|
||||||
Some(deref_ptr(gc_ptr))
|
Some(deref_ptr(gc_ptr))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,14 +131,14 @@ fn check_crate(tcx: ty::ctxt, method_map: &method_map, crate: @ast::crate) {
|
||||||
match tcx.items.find(trait_id.node) {
|
match tcx.items.find(trait_id.node) {
|
||||||
Some(node_item(item, _)) => {
|
Some(node_item(item, _)) => {
|
||||||
match item.node {
|
match item.node {
|
||||||
item_trait(_, _, methods) => {
|
item_trait(_, _, ref methods) => {
|
||||||
if method_num >= methods.len() {
|
if method_num >= (*methods).len() {
|
||||||
tcx.sess.span_bug(span, ~"method \
|
tcx.sess.span_bug(span, ~"method \
|
||||||
number \
|
number \
|
||||||
out of \
|
out of \
|
||||||
range?!");
|
range?!");
|
||||||
}
|
}
|
||||||
match methods[method_num] {
|
match (*methods)[method_num] {
|
||||||
provided(method)
|
provided(method)
|
||||||
if method.vis == private &&
|
if method.vis == private &&
|
||||||
!privileged_items
|
!privileged_items
|
||||||
|
@ -212,10 +212,10 @@ fn check_crate(tcx: ty::ctxt, method_map: &method_map, crate: @ast::crate) {
|
||||||
field access");
|
field access");
|
||||||
check_field(expr.span, id, ident);
|
check_field(expr.span, id, ident);
|
||||||
}
|
}
|
||||||
Some(entry) => {
|
Some(ref entry) => {
|
||||||
debug!("(privacy checking) checking \
|
debug!("(privacy checking) checking \
|
||||||
impl method");
|
impl method");
|
||||||
check_method(expr.span, &entry.origin);
|
check_method(expr.span, &(*entry).origin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -233,22 +233,22 @@ fn check_crate(tcx: ty::ctxt, method_map: &method_map, crate: @ast::crate) {
|
||||||
~"method call not in \
|
~"method call not in \
|
||||||
method map");
|
method map");
|
||||||
}
|
}
|
||||||
Some(entry) => {
|
Some(ref entry) => {
|
||||||
debug!("(privacy checking) checking \
|
debug!("(privacy checking) checking \
|
||||||
impl method");
|
impl method");
|
||||||
check_method(expr.span, &entry.origin);
|
check_method(expr.span, &(*entry).origin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
expr_struct(_, fields, _) => {
|
expr_struct(_, ref fields, _) => {
|
||||||
match ty::get(ty::expr_ty(tcx, expr)).sty {
|
match ty::get(ty::expr_ty(tcx, expr)).sty {
|
||||||
ty_class(id, _) => {
|
ty_class(id, _) => {
|
||||||
if id.crate != local_crate ||
|
if id.crate != local_crate ||
|
||||||
!privileged_items.contains(&(id.node)) {
|
!privileged_items.contains(&(id.node)) {
|
||||||
for fields.each |field| {
|
for (*fields).each |field| {
|
||||||
debug!("(privacy checking) checking \
|
debug!("(privacy checking) checking \
|
||||||
field in struct literal");
|
field in struct literal");
|
||||||
check_field(expr.span, id,
|
check_field(expr.span, id,
|
||||||
|
@ -261,7 +261,7 @@ fn check_crate(tcx: ty::ctxt, method_map: &method_map, crate: @ast::crate) {
|
||||||
!privileged_items.contains(&(id.node)) {
|
!privileged_items.contains(&(id.node)) {
|
||||||
match tcx.def_map.get(expr.id) {
|
match tcx.def_map.get(expr.id) {
|
||||||
def_variant(_, variant_id) => {
|
def_variant(_, variant_id) => {
|
||||||
for fields.each |field| {
|
for (*fields).each |field| {
|
||||||
debug!("(privacy checking) \
|
debug!("(privacy checking) \
|
||||||
checking field in \
|
checking field in \
|
||||||
struct variant \
|
struct variant \
|
||||||
|
|
|
@ -697,8 +697,8 @@ fn determine_rp_in_ty(ty: @ast::Ty,
|
||||||
visit_mt(mt, cx, visitor);
|
visit_mt(mt, cx, visitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
ast::ty_rec(fields) => {
|
ast::ty_rec(ref fields) => {
|
||||||
for fields.each |field| {
|
for (*fields).each |field| {
|
||||||
visit_mt(field.node.mt, cx, visitor);
|
visit_mt(field.node.mt, cx, visitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -635,7 +635,7 @@ impl NameBindings {
|
||||||
/// Returns the module node if applicable.
|
/// Returns the module node if applicable.
|
||||||
fn get_module_if_available() -> Option<@Module> {
|
fn get_module_if_available() -> Option<@Module> {
|
||||||
match self.type_def {
|
match self.type_def {
|
||||||
Some(type_def) => type_def.module_def,
|
Some(ref type_def) => (*type_def).module_def,
|
||||||
None => None
|
None => None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -666,14 +666,14 @@ impl NameBindings {
|
||||||
TypeNS => {
|
TypeNS => {
|
||||||
match self.type_def {
|
match self.type_def {
|
||||||
None => None,
|
None => None,
|
||||||
Some(type_def) => {
|
Some(ref type_def) => {
|
||||||
// FIXME (#3784): This is reallllly questionable.
|
// FIXME (#3784): This is reallllly questionable.
|
||||||
// Perhaps the right thing to do is to merge def_mod
|
// Perhaps the right thing to do is to merge def_mod
|
||||||
// and def_ty.
|
// and def_ty.
|
||||||
match type_def.type_def {
|
match (*type_def).type_def {
|
||||||
Some(type_def) => Some(type_def),
|
Some(type_def) => Some(type_def),
|
||||||
None => {
|
None => {
|
||||||
match type_def.module_def {
|
match (*type_def).module_def {
|
||||||
Some(module_def) => {
|
Some(module_def) => {
|
||||||
module_def.def_id.map(|def_id|
|
module_def.def_id.map(|def_id|
|
||||||
def_mod(*def_id))
|
def_mod(*def_id))
|
||||||
|
@ -699,7 +699,7 @@ impl NameBindings {
|
||||||
TypeNS => {
|
TypeNS => {
|
||||||
match self.type_def {
|
match self.type_def {
|
||||||
None => None,
|
None => None,
|
||||||
Some(type_def) => Some(type_def.privacy)
|
Some(ref type_def) => Some((*type_def).privacy)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ValueNS => {
|
ValueNS => {
|
||||||
|
@ -1166,14 +1166,14 @@ impl Resolver {
|
||||||
(privacy, def_ty(local_def(item.id)), sp);
|
(privacy, def_ty(local_def(item.id)), sp);
|
||||||
}
|
}
|
||||||
|
|
||||||
item_enum(enum_definition, _) => {
|
item_enum(ref enum_definition, _) => {
|
||||||
let (name_bindings, new_parent) =
|
let (name_bindings, new_parent) =
|
||||||
self.add_child(ident, parent, ForbidDuplicateTypes, sp);
|
self.add_child(ident, parent, ForbidDuplicateTypes, sp);
|
||||||
|
|
||||||
(*name_bindings).define_type
|
(*name_bindings).define_type
|
||||||
(privacy, def_ty(local_def(item.id)), sp);
|
(privacy, def_ty(local_def(item.id)), sp);
|
||||||
|
|
||||||
for enum_definition.variants.each |variant| {
|
for (*enum_definition).variants.each |variant| {
|
||||||
self.build_reduced_graph_for_variant(*variant,
|
self.build_reduced_graph_for_variant(*variant,
|
||||||
local_def(item.id),
|
local_def(item.id),
|
||||||
// inherited => privacy of the enum item
|
// inherited => privacy of the enum item
|
||||||
|
@ -1277,7 +1277,7 @@ impl Resolver {
|
||||||
visit_item(item, parent, visitor);
|
visit_item(item, parent, visitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
item_trait(_, _, methods) => {
|
item_trait(_, _, ref methods) => {
|
||||||
let (name_bindings, new_parent) =
|
let (name_bindings, new_parent) =
|
||||||
self.add_child(ident, parent, ForbidDuplicateTypes, sp);
|
self.add_child(ident, parent, ForbidDuplicateTypes, sp);
|
||||||
|
|
||||||
|
@ -1287,7 +1287,7 @@ impl Resolver {
|
||||||
// We only need to create the module if the trait has static
|
// We only need to create the module if the trait has static
|
||||||
// methods, so check that first.
|
// methods, so check that first.
|
||||||
let mut has_static_methods = false;
|
let mut has_static_methods = false;
|
||||||
for methods.each |method| {
|
for (*methods).each |method| {
|
||||||
let ty_m = trait_method_to_ty_method(*method);
|
let ty_m = trait_method_to_ty_method(*method);
|
||||||
match ty_m.self_ty.node {
|
match ty_m.self_ty.node {
|
||||||
sty_static => {
|
sty_static => {
|
||||||
|
@ -1315,7 +1315,7 @@ impl Resolver {
|
||||||
|
|
||||||
// Add the names of all the methods to the trait info.
|
// Add the names of all the methods to the trait info.
|
||||||
let method_names = @HashMap();
|
let method_names = @HashMap();
|
||||||
for methods.each |method| {
|
for (*methods).each |method| {
|
||||||
let ty_m = trait_method_to_ty_method(*method);
|
let ty_m = trait_method_to_ty_method(*method);
|
||||||
|
|
||||||
let ident = ty_m.ident;
|
let ident = ty_m.ident;
|
||||||
|
@ -1403,11 +1403,11 @@ impl Resolver {
|
||||||
variant.span);
|
variant.span);
|
||||||
self.structs.insert(local_def(variant.node.id), ());
|
self.structs.insert(local_def(variant.node.id), ());
|
||||||
}
|
}
|
||||||
enum_variant_kind(enum_definition) => {
|
enum_variant_kind(ref enum_definition) => {
|
||||||
(*child).define_type(privacy,
|
(*child).define_type(privacy,
|
||||||
def_ty(local_def(variant.node.id)),
|
def_ty(local_def(variant.node.id)),
|
||||||
variant.span);
|
variant.span);
|
||||||
for enum_definition.variants.each |variant| {
|
for (*enum_definition).variants.each |variant| {
|
||||||
self.build_reduced_graph_for_variant(*variant, item_id,
|
self.build_reduced_graph_for_variant(*variant, item_id,
|
||||||
parent_privacy,
|
parent_privacy,
|
||||||
parent, visitor);
|
parent, visitor);
|
||||||
|
@ -1475,8 +1475,8 @@ impl Resolver {
|
||||||
subclass,
|
subclass,
|
||||||
view_path.span);
|
view_path.span);
|
||||||
}
|
}
|
||||||
view_path_list(_, source_idents, _) => {
|
view_path_list(_, ref source_idents, _) => {
|
||||||
for source_idents.each |source_ident| {
|
for (*source_idents).each |source_ident| {
|
||||||
let name = source_ident.node.name;
|
let name = source_ident.node.name;
|
||||||
let subclass = @SingleImport(name,
|
let subclass = @SingleImport(name,
|
||||||
name,
|
name,
|
||||||
|
@ -1527,9 +1527,9 @@ impl Resolver {
|
||||||
unsupported");
|
unsupported");
|
||||||
}
|
}
|
||||||
|
|
||||||
view_path_list(path, path_list_idents, _) => {
|
view_path_list(path, ref path_list_idents, _) => {
|
||||||
if path.idents.len() == 1u &&
|
if path.idents.len() == 1u &&
|
||||||
path_list_idents.len() == 0 {
|
(*path_list_idents).len() == 0 {
|
||||||
|
|
||||||
self.session.span_warn(view_item.span,
|
self.session.span_warn(view_item.span,
|
||||||
~"this syntax for \
|
~"this syntax for \
|
||||||
|
@ -1546,7 +1546,7 @@ impl Resolver {
|
||||||
in this module");
|
in this module");
|
||||||
}
|
}
|
||||||
|
|
||||||
for path_list_idents.each |path_list_ident| {
|
for (*path_list_idents).each |path_list_ident| {
|
||||||
let ident = path_list_ident.node.name;
|
let ident = path_list_ident.node.name;
|
||||||
let id = path_list_ident.node.id;
|
let id = path_list_ident.node.id;
|
||||||
module_.exported_names.insert(ident, id);
|
module_.exported_names.insert(ident, id);
|
||||||
|
@ -2838,8 +2838,8 @@ impl Resolver {
|
||||||
match self.resolve_item_in_lexical_scope(module_, name, TypeNS) {
|
match self.resolve_item_in_lexical_scope(module_, name, TypeNS) {
|
||||||
Success(target) => {
|
Success(target) => {
|
||||||
match target.bindings.type_def {
|
match target.bindings.type_def {
|
||||||
Some(type_def) => {
|
Some(ref type_def) => {
|
||||||
match type_def.module_def {
|
match (*type_def).module_def {
|
||||||
None => {
|
None => {
|
||||||
error!("!!! (resolving module in lexical \
|
error!("!!! (resolving module in lexical \
|
||||||
scope) module wasn't actually a \
|
scope) module wasn't actually a \
|
||||||
|
@ -3541,9 +3541,9 @@ impl Resolver {
|
||||||
|
|
||||||
// enum item: resolve all the variants' discrs,
|
// enum item: resolve all the variants' discrs,
|
||||||
// then resolve the ty params
|
// then resolve the ty params
|
||||||
item_enum(enum_def, type_parameters) => {
|
item_enum(ref enum_def, type_parameters) => {
|
||||||
|
|
||||||
for enum_def.variants.each() |variant| {
|
for (*enum_def).variants.each() |variant| {
|
||||||
do variant.node.disr_expr.iter() |dis_expr| {
|
do variant.node.disr_expr.iter() |dis_expr| {
|
||||||
// resolve the discriminator expr
|
// resolve the discriminator expr
|
||||||
// as a constant
|
// as a constant
|
||||||
|
@ -3588,7 +3588,7 @@ impl Resolver {
|
||||||
visitor);
|
visitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
item_trait(type_parameters, traits, methods) => {
|
item_trait(type_parameters, traits, ref methods) => {
|
||||||
// Create a new rib for the self type.
|
// Create a new rib for the self type.
|
||||||
let self_type_rib = @Rib(NormalRibKind);
|
let self_type_rib = @Rib(NormalRibKind);
|
||||||
(*self.type_ribs).push(self_type_rib);
|
(*self.type_ribs).push(self_type_rib);
|
||||||
|
@ -3623,30 +3623,30 @@ impl Resolver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for methods.each |method| {
|
for (*methods).each |method| {
|
||||||
// Create a new rib for the method-specific type
|
// Create a new rib for the method-specific type
|
||||||
// parameters.
|
// parameters.
|
||||||
//
|
//
|
||||||
// XXX: Do we need a node ID here?
|
// XXX: Do we need a node ID here?
|
||||||
|
|
||||||
match *method {
|
match *method {
|
||||||
required(ty_m) => {
|
required(ref ty_m) => {
|
||||||
do self.with_type_parameter_rib
|
do self.with_type_parameter_rib
|
||||||
(HasTypeParameters(&ty_m.tps,
|
(HasTypeParameters(&(*ty_m).tps,
|
||||||
item.id,
|
item.id,
|
||||||
type_parameters.len(),
|
type_parameters.len(),
|
||||||
MethodRibKind(item.id, Required))) {
|
MethodRibKind(item.id, Required))) {
|
||||||
|
|
||||||
// Resolve the method-specific type
|
// Resolve the method-specific type
|
||||||
// parameters.
|
// parameters.
|
||||||
self.resolve_type_parameters(ty_m.tps,
|
self.resolve_type_parameters((*ty_m).tps,
|
||||||
visitor);
|
visitor);
|
||||||
|
|
||||||
for ty_m.decl.inputs.each |argument| {
|
for (*ty_m).decl.inputs.each |argument| {
|
||||||
self.resolve_type(argument.ty, visitor);
|
self.resolve_type(argument.ty, visitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.resolve_type(ty_m.decl.output, visitor);
|
self.resolve_type((*ty_m).decl.output, visitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
provided(m) => {
|
provided(m) => {
|
||||||
|
@ -3705,7 +3705,7 @@ impl Resolver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
item_fn(fn_decl, _, ty_params, block) => {
|
item_fn(fn_decl, _, ty_params, ref block) => {
|
||||||
// If this is the main function, we must record it in the
|
// If this is the main function, we must record it in the
|
||||||
// session.
|
// session.
|
||||||
//
|
//
|
||||||
|
@ -3726,7 +3726,7 @@ impl Resolver {
|
||||||
item.id,
|
item.id,
|
||||||
0,
|
0,
|
||||||
OpaqueFunctionRibKind),
|
OpaqueFunctionRibKind),
|
||||||
block,
|
(*block),
|
||||||
NoSelfBinding,
|
NoSelfBinding,
|
||||||
NoCaptureClause,
|
NoCaptureClause,
|
||||||
visitor);
|
visitor);
|
||||||
|
@ -3966,13 +3966,13 @@ impl Resolver {
|
||||||
None => {
|
None => {
|
||||||
// Nothing to do.
|
// Nothing to do.
|
||||||
}
|
}
|
||||||
Some(destructor) => {
|
Some(ref destructor) => {
|
||||||
self.resolve_function(NormalRibKind,
|
self.resolve_function(NormalRibKind,
|
||||||
None,
|
None,
|
||||||
NoTypeParameters,
|
NoTypeParameters,
|
||||||
destructor.node.body,
|
(*destructor).node.body,
|
||||||
HasSelfBinding
|
HasSelfBinding
|
||||||
(destructor.node.self_id),
|
((*destructor).node.self_id),
|
||||||
NoCaptureClause,
|
NoCaptureClause,
|
||||||
visitor);
|
visitor);
|
||||||
}
|
}
|
||||||
|
@ -4892,12 +4892,12 @@ impl Resolver {
|
||||||
visit_expr(expr, (), visitor);
|
visit_expr(expr, (), visitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
expr_fn(_, fn_decl, block, capture_clause) |
|
expr_fn(_, fn_decl, ref block, capture_clause) |
|
||||||
expr_fn_block(fn_decl, block, capture_clause) => {
|
expr_fn_block(fn_decl, ref block, capture_clause) => {
|
||||||
self.resolve_function(FunctionRibKind(expr.id, block.node.id),
|
self.resolve_function(FunctionRibKind(expr.id, (*block).node.id),
|
||||||
Some(@fn_decl),
|
Some(@fn_decl),
|
||||||
NoTypeParameters,
|
NoTypeParameters,
|
||||||
block,
|
(*block),
|
||||||
NoSelfBinding,
|
NoSelfBinding,
|
||||||
HasCaptureClause(capture_clause),
|
HasCaptureClause(capture_clause),
|
||||||
visitor);
|
visitor);
|
||||||
|
|
|
@ -765,7 +765,7 @@ fn extract_variant_args(bcx: block, pat_id: ast::node_id,
|
||||||
let _icx = bcx.insn_ctxt("alt::extract_variant_args");
|
let _icx = bcx.insn_ctxt("alt::extract_variant_args");
|
||||||
let ccx = bcx.fcx.ccx;
|
let ccx = bcx.fcx.ccx;
|
||||||
let enum_ty_substs = match ty::get(node_id_type(bcx, pat_id)).sty {
|
let enum_ty_substs = match ty::get(node_id_type(bcx, pat_id)).sty {
|
||||||
ty::ty_enum(id, substs) => { assert id == vdefs.enm; substs.tps }
|
ty::ty_enum(id, ref substs) => { assert id == vdefs.enm; (*substs).tps }
|
||||||
_ => bcx.sess().bug(~"extract_variant_args: pattern has non-enum type")
|
_ => bcx.sess().bug(~"extract_variant_args: pattern has non-enum type")
|
||||||
};
|
};
|
||||||
let mut blobptr = val;
|
let mut blobptr = val;
|
||||||
|
|
|
@ -576,14 +576,14 @@ fn iter_structural_ty(cx: block, av: ValueRef, t: ty::t,
|
||||||
cx = f(cx, llfld_a, *arg);
|
cx = f(cx, llfld_a, *arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ty::ty_enum(tid, substs) => {
|
ty::ty_enum(tid, ref substs) => {
|
||||||
let variants = ty::enum_variants(cx.tcx(), tid);
|
let variants = ty::enum_variants(cx.tcx(), tid);
|
||||||
let n_variants = (*variants).len();
|
let n_variants = (*variants).len();
|
||||||
|
|
||||||
// Cast the enums to types we can GEP into.
|
// Cast the enums to types we can GEP into.
|
||||||
if n_variants == 1u {
|
if n_variants == 1u {
|
||||||
return iter_variant(cx, av, variants[0],
|
return iter_variant(cx, av, variants[0],
|
||||||
substs.tps, tid, f);
|
(*substs).tps, tid, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
let ccx = cx.ccx();
|
let ccx = cx.ccx();
|
||||||
|
@ -608,7 +608,7 @@ fn iter_structural_ty(cx: block, av: ValueRef, t: ty::t,
|
||||||
AddCase(llswitch, C_int(ccx, variant.disr_val), variant_cx.llbb);
|
AddCase(llswitch, C_int(ccx, variant.disr_val), variant_cx.llbb);
|
||||||
let variant_cx =
|
let variant_cx =
|
||||||
iter_variant(variant_cx, llunion_a_ptr, *variant,
|
iter_variant(variant_cx, llunion_a_ptr, *variant,
|
||||||
substs.tps, tid, f);
|
(*substs).tps, tid, f);
|
||||||
Br(variant_cx, next_cx.llbb);
|
Br(variant_cx, next_cx.llbb);
|
||||||
}
|
}
|
||||||
return next_cx;
|
return next_cx;
|
||||||
|
@ -754,8 +754,8 @@ fn need_invoke(bcx: block) -> bool {
|
||||||
let mut cur = bcx;
|
let mut cur = bcx;
|
||||||
loop {
|
loop {
|
||||||
match cur.kind {
|
match cur.kind {
|
||||||
block_scope(inf) => {
|
block_scope(ref inf) => {
|
||||||
for vec::each(inf.cleanups) |cleanup| {
|
for vec::each((*inf).cleanups) |cleanup| {
|
||||||
match *cleanup {
|
match *cleanup {
|
||||||
clean(_, cleanup_type) | clean_temp(_, _, cleanup_type) => {
|
clean(_, cleanup_type) | clean_temp(_, _, cleanup_type) => {
|
||||||
if cleanup_type == normal_exit_and_unwind {
|
if cleanup_type == normal_exit_and_unwind {
|
||||||
|
@ -789,9 +789,9 @@ fn in_lpad_scope_cx(bcx: block, f: fn(scope_info)) {
|
||||||
let mut bcx = bcx;
|
let mut bcx = bcx;
|
||||||
loop {
|
loop {
|
||||||
match bcx.kind {
|
match bcx.kind {
|
||||||
block_scope(inf) => {
|
block_scope(ref inf) => {
|
||||||
if inf.cleanups.len() > 0u || bcx.parent.is_none() {
|
if (*inf).cleanups.len() > 0u || bcx.parent.is_none() {
|
||||||
f(inf); return;
|
f((*inf)); return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => ()
|
_ => ()
|
||||||
|
@ -1159,15 +1159,15 @@ fn cleanup_and_leave(bcx: block, upto: Option<BasicBlockRef>,
|
||||||
}
|
}
|
||||||
|
|
||||||
match cur.kind {
|
match cur.kind {
|
||||||
block_scope(inf) if inf.cleanups.len() > 0u => {
|
block_scope(ref inf) if (*inf).cleanups.len() > 0u => {
|
||||||
for vec::find(inf.cleanup_paths,
|
for vec::find((*inf).cleanup_paths,
|
||||||
|cp| cp.target == leave).each |cp| {
|
|cp| cp.target == leave).each |cp| {
|
||||||
Br(bcx, cp.dest);
|
Br(bcx, cp.dest);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let sub_cx = sub_block(bcx, ~"cleanup");
|
let sub_cx = sub_block(bcx, ~"cleanup");
|
||||||
Br(bcx, sub_cx.llbb);
|
Br(bcx, sub_cx.llbb);
|
||||||
inf.cleanup_paths.push({target: leave, dest: sub_cx.llbb});
|
(*inf).cleanup_paths.push({target: leave, dest: sub_cx.llbb});
|
||||||
bcx = trans_block_cleanups_(sub_cx, block_cleanups(cur), is_lpad);
|
bcx = trans_block_cleanups_(sub_cx, block_cleanups(cur), is_lpad);
|
||||||
}
|
}
|
||||||
_ => ()
|
_ => ()
|
||||||
|
@ -1831,8 +1831,8 @@ fn trans_enum_def(ccx: @crate_ctxt, enum_definition: ast::enum_def,
|
||||||
trans_struct_def(ccx, struct_def, tps, path,
|
trans_struct_def(ccx, struct_def, tps, path,
|
||||||
variant.node.name, variant.node.id);
|
variant.node.name, variant.node.id);
|
||||||
}
|
}
|
||||||
ast::enum_variant_kind(enum_definition) => {
|
ast::enum_variant_kind(ref enum_definition) => {
|
||||||
trans_enum_def(ccx, enum_definition, id, tps, degen, path, vi,
|
trans_enum_def(ccx, (*enum_definition), id, tps, degen, path, vi,
|
||||||
i);
|
i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1847,21 +1847,21 @@ fn trans_item(ccx: @crate_ctxt, item: ast::item) {
|
||||||
_ => fail ~"trans_item",
|
_ => fail ~"trans_item",
|
||||||
};
|
};
|
||||||
match item.node {
|
match item.node {
|
||||||
ast::item_fn(decl, purity, tps, body) => {
|
ast::item_fn(decl, purity, tps, ref body) => {
|
||||||
if purity == ast::extern_fn {
|
if purity == ast::extern_fn {
|
||||||
let llfndecl = get_item_val(ccx, item.id);
|
let llfndecl = get_item_val(ccx, item.id);
|
||||||
foreign::trans_foreign_fn(ccx,
|
foreign::trans_foreign_fn(ccx,
|
||||||
vec::append(
|
vec::append(
|
||||||
*path,
|
*path,
|
||||||
~[path_name(item.ident)]),
|
~[path_name(item.ident)]),
|
||||||
decl, body, llfndecl, item.id);
|
decl, (*body), llfndecl, item.id);
|
||||||
} else if tps.is_empty() {
|
} else if tps.is_empty() {
|
||||||
let llfndecl = get_item_val(ccx, item.id);
|
let llfndecl = get_item_val(ccx, item.id);
|
||||||
trans_fn(ccx,
|
trans_fn(ccx,
|
||||||
vec::append(*path, ~[path_name(item.ident)]),
|
vec::append(*path, ~[path_name(item.ident)]),
|
||||||
decl, body, llfndecl, no_self, None, item.id, None);
|
decl, (*body), llfndecl, no_self, None, item.id, None);
|
||||||
} else {
|
} else {
|
||||||
for vec::each(body.node.stmts) |stmt| {
|
for vec::each((*body).node.stmts) |stmt| {
|
||||||
match stmt.node {
|
match stmt.node {
|
||||||
ast::stmt_decl(@{node: ast::decl_item(i), _}, _) => {
|
ast::stmt_decl(@{node: ast::decl_item(i), _}, _) => {
|
||||||
trans_item(ccx, *i);
|
trans_item(ccx, *i);
|
||||||
|
@ -1882,12 +1882,12 @@ fn trans_item(ccx: @crate_ctxt, item: ast::item) {
|
||||||
ast::item_mod(m) => {
|
ast::item_mod(m) => {
|
||||||
trans_mod(ccx, m);
|
trans_mod(ccx, m);
|
||||||
}
|
}
|
||||||
ast::item_enum(enum_definition, tps) => {
|
ast::item_enum(ref enum_definition, tps) => {
|
||||||
if tps.len() == 0u {
|
if tps.len() == 0u {
|
||||||
let degen = enum_definition.variants.len() == 1u;
|
let degen = (*enum_definition).variants.len() == 1u;
|
||||||
let vi = ty::enum_variants(ccx.tcx, local_def(item.id));
|
let vi = ty::enum_variants(ccx.tcx, local_def(item.id));
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
trans_enum_def(ccx, enum_definition, item.id, tps, degen, path,
|
trans_enum_def(ccx, (*enum_definition), item.id, tps, degen, path,
|
||||||
vi, &mut i);
|
vi, &mut i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1895,7 +1895,7 @@ fn trans_item(ccx: @crate_ctxt, item: ast::item) {
|
||||||
ast::item_foreign_mod(foreign_mod) => {
|
ast::item_foreign_mod(foreign_mod) => {
|
||||||
let abi = match attr::foreign_abi(item.attrs) {
|
let abi = match attr::foreign_abi(item.attrs) {
|
||||||
either::Right(abi_) => abi_,
|
either::Right(abi_) => abi_,
|
||||||
either::Left(msg) => ccx.sess.span_fatal(item.span, msg)
|
either::Left(ref msg) => ccx.sess.span_fatal(item.span, (*msg))
|
||||||
};
|
};
|
||||||
foreign::trans_foreign_mod(ccx, foreign_mod, abi);
|
foreign::trans_foreign_mod(ccx, foreign_mod, abi);
|
||||||
}
|
}
|
||||||
|
@ -2073,7 +2073,7 @@ fn get_dtor_symbol(ccx: @crate_ctxt, path: path, id: ast::node_id,
|
||||||
substs: Option<param_substs>) -> ~str {
|
substs: Option<param_substs>) -> ~str {
|
||||||
let t = ty::node_id_to_type(ccx.tcx, id);
|
let t = ty::node_id_to_type(ccx.tcx, id);
|
||||||
match ccx.item_symbols.find(id) {
|
match ccx.item_symbols.find(id) {
|
||||||
Some(s) => s,
|
Some(ref s) => (*s),
|
||||||
None if substs.is_none() => {
|
None if substs.is_none() => {
|
||||||
let s = mangle_exported_name(
|
let s = mangle_exported_name(
|
||||||
ccx,
|
ccx,
|
||||||
|
@ -2205,17 +2205,17 @@ fn get_item_val(ccx: @crate_ctxt, id: ast::node_id) -> ValueRef {
|
||||||
llfn
|
llfn
|
||||||
}
|
}
|
||||||
|
|
||||||
ast_map::node_variant(v, enm, pth) => {
|
ast_map::node_variant(ref v, enm, pth) => {
|
||||||
let llfn;
|
let llfn;
|
||||||
match v.node.kind {
|
match (*v).node.kind {
|
||||||
ast::tuple_variant_kind(args) => {
|
ast::tuple_variant_kind(args) => {
|
||||||
assert args.len() != 0u;
|
assert args.len() != 0u;
|
||||||
let pth = vec::append(*pth,
|
let pth = vec::append(*pth,
|
||||||
~[path_name(enm.ident),
|
~[path_name(enm.ident),
|
||||||
path_name(v.node.name)]);
|
path_name((*v).node.name)]);
|
||||||
llfn = match enm.node {
|
llfn = match enm.node {
|
||||||
ast::item_enum(_, _) => {
|
ast::item_enum(_, _) => {
|
||||||
register_fn(ccx, v.span, pth, id)
|
register_fn(ccx, (*v).span, pth, id)
|
||||||
}
|
}
|
||||||
_ => fail ~"node_variant, shouldn't happen"
|
_ => fail ~"node_variant, shouldn't happen"
|
||||||
};
|
};
|
||||||
|
@ -2302,12 +2302,12 @@ fn register_deriving_method(ccx: @crate_ctxt,
|
||||||
fn trans_constant(ccx: @crate_ctxt, it: @ast::item) {
|
fn trans_constant(ccx: @crate_ctxt, it: @ast::item) {
|
||||||
let _icx = ccx.insn_ctxt("trans_constant");
|
let _icx = ccx.insn_ctxt("trans_constant");
|
||||||
match it.node {
|
match it.node {
|
||||||
ast::item_enum(enum_definition, _) => {
|
ast::item_enum(ref enum_definition, _) => {
|
||||||
let vi = ty::enum_variants(ccx.tcx, {crate: ast::local_crate,
|
let vi = ty::enum_variants(ccx.tcx, {crate: ast::local_crate,
|
||||||
node: it.id});
|
node: it.id});
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
let path = item_path(ccx, it);
|
let path = item_path(ccx, it);
|
||||||
for vec::each(enum_definition.variants) |variant| {
|
for vec::each((*enum_definition).variants) |variant| {
|
||||||
let p = vec::append(path, ~[path_name(variant.node.name),
|
let p = vec::append(path, ~[path_name(variant.node.name),
|
||||||
path_name(special_idents::descrim)]);
|
path_name(special_idents::descrim)]);
|
||||||
let s = mangle_exported_name(ccx, p, ty::mk_int(ccx.tcx));
|
let s = mangle_exported_name(ccx, p, ty::mk_int(ccx.tcx));
|
||||||
|
|
|
@ -62,9 +62,9 @@ fn trans(bcx: block, expr: @ast::expr) -> Callee {
|
||||||
}
|
}
|
||||||
ast::expr_field(base, _, _) => {
|
ast::expr_field(base, _, _) => {
|
||||||
match bcx.ccx().maps.method_map.find(expr.id) {
|
match bcx.ccx().maps.method_map.find(expr.id) {
|
||||||
Some(origin) => { // An impl method
|
Some(ref origin) => { // An impl method
|
||||||
return meth::trans_method_callee(bcx, expr.id,
|
return meth::trans_method_callee(bcx, expr.id,
|
||||||
base, origin);
|
base, (*origin));
|
||||||
}
|
}
|
||||||
None => {} // not a method, just a field
|
None => {} // not a method, just a field
|
||||||
}
|
}
|
||||||
|
@ -316,11 +316,11 @@ fn trans_method_call(in_cx: block,
|
||||||
expr_ty(in_cx, call_ex),
|
expr_ty(in_cx, call_ex),
|
||||||
|cx| {
|
|cx| {
|
||||||
match cx.ccx().maps.method_map.find(call_ex.id) {
|
match cx.ccx().maps.method_map.find(call_ex.id) {
|
||||||
Some(origin) => {
|
Some(ref origin) => {
|
||||||
meth::trans_method_callee(cx,
|
meth::trans_method_callee(cx,
|
||||||
call_ex.callee_id,
|
call_ex.callee_id,
|
||||||
rcvr,
|
rcvr,
|
||||||
origin)
|
(*origin))
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
cx.tcx().sess.span_bug(call_ex.span,
|
cx.tcx().sess.span_bug(call_ex.span,
|
||||||
|
@ -427,9 +427,9 @@ fn trans_call_inner(
|
||||||
ArgExprs(args) => {
|
ArgExprs(args) => {
|
||||||
args.len() > 0u && match vec::last(args).node {
|
args.len() > 0u && match vec::last(args).node {
|
||||||
ast::expr_loop_body(@{
|
ast::expr_loop_body(@{
|
||||||
node: ast::expr_fn_block(_, body, _),
|
node: ast::expr_fn_block(_, ref body, _),
|
||||||
_
|
_
|
||||||
}) => body_contains_ret(body),
|
}) => body_contains_ret((*body)),
|
||||||
_ => false
|
_ => false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -622,14 +622,14 @@ fn trans_arg_expr(bcx: block,
|
||||||
Some(_) => {
|
Some(_) => {
|
||||||
match arg_expr.node {
|
match arg_expr.node {
|
||||||
ast::expr_loop_body(
|
ast::expr_loop_body(
|
||||||
blk @ @{node:ast::expr_fn_block(decl, body, cap), _}) =>
|
blk @ @{node:ast::expr_fn_block(decl, ref body, cap), _}) =>
|
||||||
{
|
{
|
||||||
let scratch_ty = expr_ty(bcx, blk);
|
let scratch_ty = expr_ty(bcx, blk);
|
||||||
let scratch = alloc_ty(bcx, scratch_ty);
|
let scratch = alloc_ty(bcx, scratch_ty);
|
||||||
let arg_ty = expr_ty(bcx, arg_expr);
|
let arg_ty = expr_ty(bcx, arg_expr);
|
||||||
let proto = ty::ty_fn_proto(arg_ty);
|
let proto = ty::ty_fn_proto(arg_ty);
|
||||||
let bcx = closure::trans_expr_fn(
|
let bcx = closure::trans_expr_fn(
|
||||||
bcx, proto, decl, body, blk.id,
|
bcx, proto, decl, (*body), blk.id,
|
||||||
cap, Some(ret_flag), expr::SaveIn(scratch));
|
cap, Some(ret_flag), expr::SaveIn(scratch));
|
||||||
DatumBlock {bcx: bcx,
|
DatumBlock {bcx: bcx,
|
||||||
datum: Datum {val: scratch,
|
datum: Datum {val: scratch,
|
||||||
|
|
|
@ -444,7 +444,7 @@ fn revoke_clean(cx: block, val: ValueRef) {
|
||||||
fn block_cleanups(bcx: block) -> ~[cleanup] {
|
fn block_cleanups(bcx: block) -> ~[cleanup] {
|
||||||
match bcx.kind {
|
match bcx.kind {
|
||||||
block_non_scope => ~[],
|
block_non_scope => ~[],
|
||||||
block_scope(inf) => inf.cleanups
|
block_scope(ref inf) => (*inf).cleanups
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -601,10 +601,10 @@ fn in_scope_cx(cx: block, f: fn(scope_info)) {
|
||||||
let mut cur = cx;
|
let mut cur = cx;
|
||||||
loop {
|
loop {
|
||||||
match cur.kind {
|
match cur.kind {
|
||||||
block_scope(inf) => {
|
block_scope(ref inf) => {
|
||||||
debug!("in_scope_cx: selected cur=%s (cx=%s)",
|
debug!("in_scope_cx: selected cur=%s (cx=%s)",
|
||||||
cur.to_str(), cx.to_str());
|
cur.to_str(), cx.to_str());
|
||||||
f(inf);
|
f((*inf));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_ => ()
|
_ => ()
|
||||||
|
|
|
@ -323,9 +323,9 @@ fn const_expr(cx: @crate_ctxt, e: @ast::expr) -> ValueRef {
|
||||||
ast::expr_tup(es) => {
|
ast::expr_tup(es) => {
|
||||||
C_struct(es.map(|e| const_expr(cx, *e)))
|
C_struct(es.map(|e| const_expr(cx, *e)))
|
||||||
}
|
}
|
||||||
ast::expr_rec(fs, None) => {
|
ast::expr_rec(ref fs, None) => {
|
||||||
C_struct([C_struct(
|
C_struct([C_struct(
|
||||||
fs.map(|f| const_expr(cx, f.node.expr)))])
|
(*fs).map(|f| const_expr(cx, f.node.expr)))])
|
||||||
}
|
}
|
||||||
ast::expr_struct(_, ref fs, _) => {
|
ast::expr_struct(_, ref fs, _) => {
|
||||||
let ety = ty::expr_ty(cx.tcx, e);
|
let ety = ty::expr_ty(cx.tcx, e);
|
||||||
|
@ -334,7 +334,7 @@ fn const_expr(cx: @crate_ctxt, e: @ast::expr) -> ValueRef {
|
||||||
None) |_hd, field_tys| {
|
None) |_hd, field_tys| {
|
||||||
field_tys.map(|field_ty| {
|
field_tys.map(|field_ty| {
|
||||||
match fs.find(|f| field_ty.ident == f.node.ident) {
|
match fs.find(|f| field_ty.ident == f.node.ident) {
|
||||||
Some(f) => const_expr(cx, f.node.expr),
|
Some(ref f) => const_expr(cx, (*f).node.expr),
|
||||||
None => {
|
None => {
|
||||||
cx.tcx.sess.span_bug(
|
cx.tcx.sess.span_bug(
|
||||||
e.span, ~"missing struct field");
|
e.span, ~"missing struct field");
|
||||||
|
|
|
@ -75,8 +75,8 @@ fn trans_if(bcx: block,
|
||||||
let elseif_blk = ast_util::block_from_expr(elexpr);
|
let elseif_blk = ast_util::block_from_expr(elexpr);
|
||||||
trans_block(else_bcx_in, elseif_blk, dest)
|
trans_block(else_bcx_in, elseif_blk, dest)
|
||||||
}
|
}
|
||||||
ast::expr_block(blk) => {
|
ast::expr_block(ref blk) => {
|
||||||
trans_block(else_bcx_in, blk, dest)
|
trans_block(else_bcx_in, (*blk), dest)
|
||||||
}
|
}
|
||||||
// would be nice to have a constraint on ifs
|
// would be nice to have a constraint on ifs
|
||||||
_ => bcx.tcx().sess.bug(~"strange alternative in if")
|
_ => bcx.tcx().sess.bug(~"strange alternative in if")
|
||||||
|
|
|
@ -452,11 +452,11 @@ fn trans_rvalue_stmt_unadjusted(bcx: block, expr: @ast::expr) -> block {
|
||||||
ast::expr_assert(a) => {
|
ast::expr_assert(a) => {
|
||||||
return controlflow::trans_check_expr(bcx, expr, a, ~"Assertion");
|
return controlflow::trans_check_expr(bcx, expr, a, ~"Assertion");
|
||||||
}
|
}
|
||||||
ast::expr_while(cond, body) => {
|
ast::expr_while(cond, ref body) => {
|
||||||
return controlflow::trans_while(bcx, cond, body);
|
return controlflow::trans_while(bcx, cond, (*body));
|
||||||
}
|
}
|
||||||
ast::expr_loop(body, opt_label) => {
|
ast::expr_loop(ref body, opt_label) => {
|
||||||
return controlflow::trans_loop(bcx, body, opt_label);
|
return controlflow::trans_loop(bcx, (*body), opt_label);
|
||||||
}
|
}
|
||||||
ast::expr_assign(dst, src) => {
|
ast::expr_assign(dst, src) => {
|
||||||
let src_datum = unpack_datum!(bcx, trans_to_datum(bcx, src));
|
let src_datum = unpack_datum!(bcx, trans_to_datum(bcx, src));
|
||||||
|
@ -504,20 +504,20 @@ fn trans_rvalue_dps_unadjusted(bcx: block, expr: @ast::expr,
|
||||||
return trans_def_dps_unadjusted(bcx, expr,
|
return trans_def_dps_unadjusted(bcx, expr,
|
||||||
bcx.def(expr.id), dest);
|
bcx.def(expr.id), dest);
|
||||||
}
|
}
|
||||||
ast::expr_if(cond, thn, els) => {
|
ast::expr_if(cond, ref thn, els) => {
|
||||||
return controlflow::trans_if(bcx, cond, thn, els, dest);
|
return controlflow::trans_if(bcx, cond, (*thn), els, dest);
|
||||||
}
|
}
|
||||||
ast::expr_match(discr, arms) => {
|
ast::expr_match(discr, ref arms) => {
|
||||||
return alt::trans_alt(bcx, expr, discr, arms, dest);
|
return alt::trans_alt(bcx, expr, discr, (*arms), dest);
|
||||||
}
|
}
|
||||||
ast::expr_block(blk) => {
|
ast::expr_block(ref blk) => {
|
||||||
return do base::with_scope(bcx, blk.info(),
|
return do base::with_scope(bcx, (*blk).info(),
|
||||||
~"block-expr body") |bcx| {
|
~"block-expr body") |bcx| {
|
||||||
controlflow::trans_block(bcx, blk, dest)
|
controlflow::trans_block(bcx, (*blk), dest)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
ast::expr_rec(fields, base) | ast::expr_struct(_, fields, base) => {
|
ast::expr_rec(ref fields, base) | ast::expr_struct(_, ref fields, base) => {
|
||||||
return trans_rec_or_struct(bcx, fields, base, expr.id, dest);
|
return trans_rec_or_struct(bcx, (*fields), base, expr.id, dest);
|
||||||
}
|
}
|
||||||
ast::expr_tup(args) => {
|
ast::expr_tup(args) => {
|
||||||
return trans_tup(bcx, args, dest);
|
return trans_tup(bcx, args, dest);
|
||||||
|
@ -534,14 +534,14 @@ fn trans_rvalue_dps_unadjusted(bcx: block, expr: @ast::expr,
|
||||||
ast::expr_vec(*) | ast::expr_repeat(*) => {
|
ast::expr_vec(*) | ast::expr_repeat(*) => {
|
||||||
return tvec::trans_fixed_vstore(bcx, expr, expr, dest);
|
return tvec::trans_fixed_vstore(bcx, expr, expr, dest);
|
||||||
}
|
}
|
||||||
ast::expr_fn(proto, decl, body, cap_clause) => {
|
ast::expr_fn(proto, decl, ref body, cap_clause) => {
|
||||||
// Don't use this function for anything real. Use the one in
|
// Don't use this function for anything real. Use the one in
|
||||||
// astconv instead.
|
// astconv instead.
|
||||||
return closure::trans_expr_fn(bcx, proto,
|
return closure::trans_expr_fn(bcx, proto,
|
||||||
decl, body, expr.id, cap_clause,
|
decl, (*body), expr.id, cap_clause,
|
||||||
None, dest);
|
None, dest);
|
||||||
}
|
}
|
||||||
ast::expr_fn_block(decl, body, cap_clause) => {
|
ast::expr_fn_block(decl, ref body, cap_clause) => {
|
||||||
let expr_ty = expr_ty(bcx, expr);
|
let expr_ty = expr_ty(bcx, expr);
|
||||||
match ty::get(expr_ty).sty {
|
match ty::get(expr_ty).sty {
|
||||||
ty::ty_fn(ref fn_ty) => {
|
ty::ty_fn(ref fn_ty) => {
|
||||||
|
@ -549,7 +549,7 @@ fn trans_rvalue_dps_unadjusted(bcx: block, expr: @ast::expr,
|
||||||
expr_to_str(expr, tcx.sess.intr()),
|
expr_to_str(expr, tcx.sess.intr()),
|
||||||
ty_to_str(tcx, expr_ty));
|
ty_to_str(tcx, expr_ty));
|
||||||
return closure::trans_expr_fn(
|
return closure::trans_expr_fn(
|
||||||
bcx, fn_ty.meta.proto, decl, body,
|
bcx, fn_ty.meta.proto, decl, (*body),
|
||||||
expr.id, cap_clause, None,
|
expr.id, cap_clause, None,
|
||||||
dest);
|
dest);
|
||||||
}
|
}
|
||||||
|
@ -563,9 +563,9 @@ fn trans_rvalue_dps_unadjusted(bcx: block, expr: @ast::expr,
|
||||||
match ty::get(expr_ty(bcx, expr)).sty {
|
match ty::get(expr_ty(bcx, expr)).sty {
|
||||||
ty::ty_fn(ref fn_ty) => {
|
ty::ty_fn(ref fn_ty) => {
|
||||||
match blk.node {
|
match blk.node {
|
||||||
ast::expr_fn_block(decl, body, cap) => {
|
ast::expr_fn_block(decl, ref body, cap) => {
|
||||||
return closure::trans_expr_fn(
|
return closure::trans_expr_fn(
|
||||||
bcx, fn_ty.meta.proto, decl, body, blk.id,
|
bcx, fn_ty.meta.proto, decl, (*body), blk.id,
|
||||||
cap, Some(None), dest);
|
cap, Some(None), dest);
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
|
|
@ -435,7 +435,7 @@ fn decl_x86_64_fn(tys: x86_64_tys,
|
||||||
fn link_name(ccx: @crate_ctxt, i: @ast::foreign_item) -> ~str {
|
fn link_name(ccx: @crate_ctxt, i: @ast::foreign_item) -> ~str {
|
||||||
match attr::first_attr_value_str_by_name(i.attrs, ~"link_name") {
|
match attr::first_attr_value_str_by_name(i.attrs, ~"link_name") {
|
||||||
None => ccx.sess.str_of(i.ident),
|
None => ccx.sess.str_of(i.ident),
|
||||||
option::Some(ln) => ln
|
option::Some(ref ln) => (*ln)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -608,10 +608,10 @@ fn trans_foreign_mod(ccx: @crate_ctxt,
|
||||||
let n = vec::len(tys.arg_tys);
|
let n = vec::len(tys.arg_tys);
|
||||||
|
|
||||||
match tys.x86_64_tys {
|
match tys.x86_64_tys {
|
||||||
Some(x86_64) => {
|
Some(ref x86_64) => {
|
||||||
let mut atys = x86_64.arg_tys;
|
let mut atys = (*x86_64).arg_tys;
|
||||||
let mut attrs = x86_64.attrs;
|
let mut attrs = (*x86_64).attrs;
|
||||||
if x86_64.sret {
|
if (*x86_64).sret {
|
||||||
let llretptr = GEPi(bcx, llargbundle, [0u, n]);
|
let llretptr = GEPi(bcx, llargbundle, [0u, n]);
|
||||||
let llretloc = Load(bcx, llretptr);
|
let llretloc = Load(bcx, llretptr);
|
||||||
llargvals = ~[llretloc];
|
llargvals = ~[llretloc];
|
||||||
|
@ -649,8 +649,8 @@ fn trans_foreign_mod(ccx: @crate_ctxt,
|
||||||
llargbundle: ValueRef, llretval: ValueRef) {
|
llargbundle: ValueRef, llretval: ValueRef) {
|
||||||
let _icx = bcx.insn_ctxt("foreign::shim::build_ret");
|
let _icx = bcx.insn_ctxt("foreign::shim::build_ret");
|
||||||
match tys.x86_64_tys {
|
match tys.x86_64_tys {
|
||||||
Some(x86_64) => {
|
Some(ref x86_64) => {
|
||||||
for vec::eachi(x86_64.attrs) |i, a| {
|
for vec::eachi((*x86_64).attrs) |i, a| {
|
||||||
match *a {
|
match *a {
|
||||||
Some(attr) => {
|
Some(attr) => {
|
||||||
llvm::LLVMAddInstrAttribute(
|
llvm::LLVMAddInstrAttribute(
|
||||||
|
@ -660,15 +660,15 @@ fn trans_foreign_mod(ccx: @crate_ctxt,
|
||||||
_ => ()
|
_ => ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if x86_64.sret || !tys.ret_def {
|
if (*x86_64).sret || !tys.ret_def {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let n = vec::len(tys.arg_tys);
|
let n = vec::len(tys.arg_tys);
|
||||||
let llretptr = GEPi(bcx, llargbundle, [0u, n]);
|
let llretptr = GEPi(bcx, llargbundle, [0u, n]);
|
||||||
let llretloc = Load(bcx, llretptr);
|
let llretloc = Load(bcx, llretptr);
|
||||||
if x86_64.ret_ty.cast {
|
if (*x86_64).ret_ty.cast {
|
||||||
let tmp_ptr = BitCast(bcx, llretloc,
|
let tmp_ptr = BitCast(bcx, llretloc,
|
||||||
T_ptr(x86_64.ret_ty.ty));
|
T_ptr((*x86_64).ret_ty.ty));
|
||||||
Store(bcx, llretval, tmp_ptr);
|
Store(bcx, llretval, tmp_ptr);
|
||||||
} else {
|
} else {
|
||||||
Store(bcx, llretval, llretloc);
|
Store(bcx, llretval, llretloc);
|
||||||
|
@ -700,8 +700,8 @@ fn trans_foreign_mod(ccx: @crate_ctxt,
|
||||||
cc: lib::llvm::CallConv) -> ValueRef {
|
cc: lib::llvm::CallConv) -> ValueRef {
|
||||||
// Declare the "prototype" for the base function F:
|
// Declare the "prototype" for the base function F:
|
||||||
match tys.x86_64_tys {
|
match tys.x86_64_tys {
|
||||||
Some(x86_64) => {
|
Some(ref x86_64) => {
|
||||||
do decl_x86_64_fn(x86_64) |fnty| {
|
do decl_x86_64_fn((*x86_64)) |fnty| {
|
||||||
decl_fn(ccx.llmod, lname, cc, fnty)
|
decl_fn(ccx.llmod, lname, cc, fnty)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1110,17 +1110,17 @@ fn trans_foreign_fn(ccx: @crate_ctxt, path: ast_map::path, decl: ast::fn_decl,
|
||||||
llwrapfn: ValueRef, llargbundle: ValueRef) {
|
llwrapfn: ValueRef, llargbundle: ValueRef) {
|
||||||
let _icx = bcx.insn_ctxt("foreign::foreign::wrap::build_args");
|
let _icx = bcx.insn_ctxt("foreign::foreign::wrap::build_args");
|
||||||
match tys.x86_64_tys {
|
match tys.x86_64_tys {
|
||||||
option::Some(x86_64) => {
|
option::Some(ref x86_64) => {
|
||||||
let mut atys = x86_64.arg_tys;
|
let mut atys = (*x86_64).arg_tys;
|
||||||
let mut attrs = x86_64.attrs;
|
let mut attrs = (*x86_64).attrs;
|
||||||
let mut j = 0u;
|
let mut j = 0u;
|
||||||
let llretptr = if x86_64.sret {
|
let llretptr = if (*x86_64).sret {
|
||||||
atys = vec::tail(atys);
|
atys = vec::tail(atys);
|
||||||
attrs = vec::tail(attrs);
|
attrs = vec::tail(attrs);
|
||||||
j = 1u;
|
j = 1u;
|
||||||
get_param(llwrapfn, 0u)
|
get_param(llwrapfn, 0u)
|
||||||
} else if x86_64.ret_ty.cast {
|
} else if (*x86_64).ret_ty.cast {
|
||||||
let retptr = alloca(bcx, x86_64.ret_ty.ty);
|
let retptr = alloca(bcx, (*x86_64).ret_ty.ty);
|
||||||
BitCast(bcx, retptr, T_ptr(tys.ret_ty))
|
BitCast(bcx, retptr, T_ptr(tys.ret_ty))
|
||||||
} else {
|
} else {
|
||||||
alloca(bcx, tys.ret_ty)
|
alloca(bcx, tys.ret_ty)
|
||||||
|
@ -1164,16 +1164,16 @@ fn trans_foreign_fn(ccx: @crate_ctxt, path: ast_map::path, decl: ast::fn_decl,
|
||||||
llargbundle: ValueRef) {
|
llargbundle: ValueRef) {
|
||||||
let _icx = bcx.insn_ctxt("foreign::foreign::wrap::build_ret");
|
let _icx = bcx.insn_ctxt("foreign::foreign::wrap::build_ret");
|
||||||
match tys.x86_64_tys {
|
match tys.x86_64_tys {
|
||||||
option::Some(x86_64) => {
|
option::Some(ref x86_64) => {
|
||||||
if x86_64.sret || !tys.ret_def {
|
if (*x86_64).sret || !tys.ret_def {
|
||||||
RetVoid(bcx);
|
RetVoid(bcx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let n = vec::len(tys.arg_tys);
|
let n = vec::len(tys.arg_tys);
|
||||||
let llretval = load_inbounds(bcx, llargbundle, ~[0u, n]);
|
let llretval = load_inbounds(bcx, llargbundle, ~[0u, n]);
|
||||||
let llretval = if x86_64.ret_ty.cast {
|
let llretval = if (*x86_64).ret_ty.cast {
|
||||||
let retptr = BitCast(bcx, llretval,
|
let retptr = BitCast(bcx, llretval,
|
||||||
T_ptr(x86_64.ret_ty.ty));
|
T_ptr((*x86_64).ret_ty.ty));
|
||||||
Load(bcx, retptr)
|
Load(bcx, retptr)
|
||||||
} else {
|
} else {
|
||||||
Load(bcx, llretval)
|
Load(bcx, llretval)
|
||||||
|
@ -1233,7 +1233,7 @@ fn abi_of_foreign_fn(ccx: @crate_ctxt, i: @ast::foreign_item)
|
||||||
},
|
},
|
||||||
Some(_) => match attr::foreign_abi(i.attrs) {
|
Some(_) => match attr::foreign_abi(i.attrs) {
|
||||||
either::Right(abi) => abi,
|
either::Right(abi) => abi,
|
||||||
either::Left(msg) => ccx.sess.span_fatal(i.span, msg)
|
either::Left(ref msg) => ccx.sess.span_fatal(i.span, (*msg))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,9 +103,9 @@ fn maybe_instantiate_inline(ccx: @crate_ctxt, fn_id: ast::def_id,
|
||||||
}
|
}
|
||||||
local_def(mth.id)
|
local_def(mth.id)
|
||||||
}
|
}
|
||||||
csearch::found(ast::ii_dtor(dtor, _, _, _)) => {
|
csearch::found(ast::ii_dtor(ref dtor, _, _, _)) => {
|
||||||
ccx.external.insert(fn_id, Some(dtor.node.id));
|
ccx.external.insert(fn_id, Some((*dtor).node.id));
|
||||||
local_def(dtor.node.id)
|
local_def((*dtor).node.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ fn monomorphic_fn(ccx: @crate_ctxt,
|
||||||
// Get the path so that we can create a symbol
|
// Get the path so that we can create a symbol
|
||||||
let (pt, name, span) = match map_node {
|
let (pt, name, span) = match map_node {
|
||||||
ast_map::node_item(i, pt) => (pt, i.ident, i.span),
|
ast_map::node_item(i, pt) => (pt, i.ident, i.span),
|
||||||
ast_map::node_variant(v, enm, pt) => (pt, v.node.name, enm.span),
|
ast_map::node_variant(ref v, enm, pt) => (pt, (*v).node.name, enm.span),
|
||||||
ast_map::node_method(m, _, pt) => (pt, m.ident, m.span),
|
ast_map::node_method(m, _, pt) => (pt, m.ident, m.span),
|
||||||
ast_map::node_foreign_item(i, ast::foreign_abi_rust_intrinsic, pt)
|
ast_map::node_foreign_item(i, ast::foreign_abi_rust_intrinsic, pt)
|
||||||
=> (pt, i.ident, i.span),
|
=> (pt, i.ident, i.span),
|
||||||
|
@ -152,10 +152,10 @@ fn monomorphic_fn(ccx: @crate_ctxt,
|
||||||
});
|
});
|
||||||
|
|
||||||
let lldecl = match map_node {
|
let lldecl = match map_node {
|
||||||
ast_map::node_item(i@@{node: ast::item_fn(decl, _, _, body), _}, _) => {
|
ast_map::node_item(i@@{node: ast::item_fn(decl, _, _, ref body), _}, _) => {
|
||||||
let d = mk_lldecl();
|
let d = mk_lldecl();
|
||||||
set_inline_hint_if_appr(i.attrs, d);
|
set_inline_hint_if_appr(i.attrs, d);
|
||||||
trans_fn(ccx, pt, decl, body, d, no_self, psubsts, fn_id.node, None);
|
trans_fn(ccx, pt, decl, (*body), d, no_self, psubsts, fn_id.node, None);
|
||||||
d
|
d
|
||||||
}
|
}
|
||||||
ast_map::node_item(*) => {
|
ast_map::node_item(*) => {
|
||||||
|
@ -167,15 +167,15 @@ fn monomorphic_fn(ccx: @crate_ctxt,
|
||||||
ref_id);
|
ref_id);
|
||||||
d
|
d
|
||||||
}
|
}
|
||||||
ast_map::node_variant(v, enum_item, _) => {
|
ast_map::node_variant(ref v, enum_item, _) => {
|
||||||
let tvs = ty::enum_variants(ccx.tcx, local_def(enum_item.id));
|
let tvs = ty::enum_variants(ccx.tcx, local_def(enum_item.id));
|
||||||
let this_tv = option::get(vec::find(*tvs, |tv| {
|
let this_tv = option::get(vec::find(*tvs, |tv| {
|
||||||
tv.id.node == fn_id.node}));
|
tv.id.node == fn_id.node}));
|
||||||
let d = mk_lldecl();
|
let d = mk_lldecl();
|
||||||
set_inline_hint(d);
|
set_inline_hint(d);
|
||||||
match v.node.kind {
|
match (*v).node.kind {
|
||||||
ast::tuple_variant_kind(args) => {
|
ast::tuple_variant_kind(args) => {
|
||||||
trans_enum_variant(ccx, enum_item.id, v, args,
|
trans_enum_variant(ccx, enum_item.id, (*v), args,
|
||||||
this_tv.disr_val, (*tvs).len() == 1u,
|
this_tv.disr_val, (*tvs).len() == 1u,
|
||||||
psubsts, d);
|
psubsts, d);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,8 +45,8 @@ fn find_reachable(crate_mod: _mod, exp_map2: resolve::ExportMap2,
|
||||||
fn traverse_exports(cx: ctx, mod_id: node_id) -> bool {
|
fn traverse_exports(cx: ctx, mod_id: node_id) -> bool {
|
||||||
let mut found_export = false;
|
let mut found_export = false;
|
||||||
match cx.exp_map2.find(mod_id) {
|
match cx.exp_map2.find(mod_id) {
|
||||||
Some(exp2s) => {
|
Some(ref exp2s) => {
|
||||||
for exp2s.each |e2| {
|
for (*exp2s).each |e2| {
|
||||||
found_export = true;
|
found_export = true;
|
||||||
traverse_def_id(cx, e2.def_id)
|
traverse_def_id(cx, e2.def_id)
|
||||||
};
|
};
|
||||||
|
@ -60,7 +60,7 @@ fn traverse_def_id(cx: ctx, did: def_id) {
|
||||||
if did.crate != local_crate { return; }
|
if did.crate != local_crate { return; }
|
||||||
let n = match cx.tcx.items.find(did.node) {
|
let n = match cx.tcx.items.find(did.node) {
|
||||||
None => return, // This can happen for self, for example
|
None => return, // This can happen for self, for example
|
||||||
Some(n) => n
|
Some(ref n) => (*n)
|
||||||
};
|
};
|
||||||
match n {
|
match n {
|
||||||
ast_map::node_item(item, _) => traverse_public_item(cx, item),
|
ast_map::node_item(item, _) => traverse_public_item(cx, item),
|
||||||
|
@ -68,7 +68,7 @@ fn traverse_def_id(cx: ctx, did: def_id) {
|
||||||
ast_map::node_foreign_item(item, _, _) => {
|
ast_map::node_foreign_item(item, _, _) => {
|
||||||
cx.rmap.insert(item.id, ());
|
cx.rmap.insert(item.id, ());
|
||||||
}
|
}
|
||||||
ast_map::node_variant(v, _, _) => { cx.rmap.insert(v.node.id, ()); }
|
ast_map::node_variant(ref v, _, _) => { cx.rmap.insert((*v).node.id, ()); }
|
||||||
_ => ()
|
_ => ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,10 +94,10 @@ fn traverse_public_item(cx: ctx, item: @item) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
item_fn(_, _, tps, blk) => {
|
item_fn(_, _, tps, ref blk) => {
|
||||||
if tps.len() > 0u ||
|
if tps.len() > 0u ||
|
||||||
attr::find_inline_attr(item.attrs) != attr::ia_none {
|
attr::find_inline_attr(item.attrs) != attr::ia_none {
|
||||||
traverse_inline_body(cx, blk);
|
traverse_inline_body(cx, (*blk));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
item_impl(tps, _, _, ms) => {
|
item_impl(tps, _, _, ms) => {
|
||||||
|
|
|
@ -113,13 +113,13 @@ fn type_of(cx: @crate_ctxt, t: ty::t) -> TypeRef {
|
||||||
ty::ty_estr(ty::vstore_uniq) => {
|
ty::ty_estr(ty::vstore_uniq) => {
|
||||||
T_unique_ptr(T_unique(cx, T_vec(cx, T_i8())))
|
T_unique_ptr(T_unique(cx, T_vec(cx, T_i8())))
|
||||||
}
|
}
|
||||||
ty::ty_enum(did, substs) => {
|
ty::ty_enum(did, ref substs) => {
|
||||||
// Only create the named struct, but don't fill it in. We
|
// Only create the named struct, but don't fill it in. We
|
||||||
// fill it in *after* placing it into the type cache. This
|
// fill it in *after* placing it into the type cache. This
|
||||||
// avoids creating more than one copy of the enum when one
|
// avoids creating more than one copy of the enum when one
|
||||||
// of the enum's variants refers to the enum itself.
|
// of the enum's variants refers to the enum itself.
|
||||||
|
|
||||||
common::T_named_struct(llvm_type_name(cx, an_enum, did, substs.tps))
|
common::T_named_struct(llvm_type_name(cx, an_enum, did, (*substs).tps))
|
||||||
}
|
}
|
||||||
ty::ty_estr(ty::vstore_box) => {
|
ty::ty_estr(ty::vstore_box) => {
|
||||||
T_box_ptr(T_box(cx, T_vec(cx, T_i8())))
|
T_box_ptr(T_box(cx, T_vec(cx, T_i8())))
|
||||||
|
@ -179,12 +179,12 @@ fn type_of(cx: @crate_ctxt, t: ty::t) -> TypeRef {
|
||||||
T_struct(tys)
|
T_struct(tys)
|
||||||
}
|
}
|
||||||
ty::ty_opaque_closure_ptr(_) => T_opaque_box_ptr(cx),
|
ty::ty_opaque_closure_ptr(_) => T_opaque_box_ptr(cx),
|
||||||
ty::ty_class(did, substs) => {
|
ty::ty_class(did, ref substs) => {
|
||||||
// Only create the named struct, but don't fill it in. We fill it
|
// Only create the named struct, but don't fill it in. We fill it
|
||||||
// in *after* placing it into the type cache. This prevents
|
// in *after* placing it into the type cache. This prevents
|
||||||
// infinite recursion with recursive class types.
|
// infinite recursion with recursive class types.
|
||||||
|
|
||||||
common::T_named_struct(llvm_type_name(cx, a_class, did, substs.tps))
|
common::T_named_struct(llvm_type_name(cx, a_class, did, (*substs).tps))
|
||||||
}
|
}
|
||||||
ty::ty_self => cx.tcx.sess.unimpl(~"type_of: ty_self"),
|
ty::ty_self => cx.tcx.sess.unimpl(~"type_of: ty_self"),
|
||||||
ty::ty_infer(*) => cx.tcx.sess.bug(~"type_of with ty_infer"),
|
ty::ty_infer(*) => cx.tcx.sess.bug(~"type_of with ty_infer"),
|
||||||
|
|
|
@ -80,14 +80,14 @@ fn type_uses_for(ccx: @crate_ctxt, fn_id: def_id, n_tps: uint)
|
||||||
return uses;
|
return uses;
|
||||||
}
|
}
|
||||||
let map_node = match ccx.tcx.items.find(fn_id_loc.node) {
|
let map_node = match ccx.tcx.items.find(fn_id_loc.node) {
|
||||||
Some(x) => x,
|
Some(ref x) => (*x),
|
||||||
None => ccx.sess.bug(fmt!("type_uses_for: unbound item ID %?",
|
None => ccx.sess.bug(fmt!("type_uses_for: unbound item ID %?",
|
||||||
fn_id_loc))
|
fn_id_loc))
|
||||||
};
|
};
|
||||||
match map_node {
|
match map_node {
|
||||||
ast_map::node_item(@{node: item_fn(_, _, _, body), _}, _) |
|
ast_map::node_item(@{node: item_fn(_, _, _, ref body), _}, _) |
|
||||||
ast_map::node_method(@{body, _}, _, _) => {
|
ast_map::node_method(@{body: ref body, _}, _, _) => {
|
||||||
handle_body(cx, body);
|
handle_body(cx, (*body));
|
||||||
}
|
}
|
||||||
ast_map::node_trait_method(*) => {
|
ast_map::node_trait_method(*) => {
|
||||||
// This will be a static trait method. For now, we just assume
|
// This will be a static trait method. For now, we just assume
|
||||||
|
@ -157,12 +157,12 @@ fn type_needs_inner(cx: ctx, use_: uint, ty: ty::t,
|
||||||
*/
|
*/
|
||||||
ty::ty_fn(_) | ty::ty_ptr(_) | ty::ty_rptr(_, _)
|
ty::ty_fn(_) | ty::ty_ptr(_) | ty::ty_rptr(_, _)
|
||||||
| ty::ty_trait(_, _, _) => false,
|
| ty::ty_trait(_, _, _) => false,
|
||||||
ty::ty_enum(did, substs) => {
|
ty::ty_enum(did, ref substs) => {
|
||||||
if option::is_none(&list::find(enums_seen, |id| *id == did)) {
|
if option::is_none(&list::find(enums_seen, |id| *id == did)) {
|
||||||
let seen = @Cons(did, enums_seen);
|
let seen = @Cons(did, enums_seen);
|
||||||
for vec::each(*ty::enum_variants(cx.ccx.tcx, did)) |v| {
|
for vec::each(*ty::enum_variants(cx.ccx.tcx, did)) |v| {
|
||||||
for vec::each(v.args) |aty| {
|
for vec::each(v.args) |aty| {
|
||||||
let t = ty::subst(cx.ccx.tcx, &substs, *aty);
|
let t = ty::subst(cx.ccx.tcx, &(*substs), *aty);
|
||||||
type_needs_inner(cx, use_, t, seen);
|
type_needs_inner(cx, use_, t, seen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -429,7 +429,10 @@ type ctxt =
|
||||||
destructor_for_type: HashMap<ast::def_id, ast::def_id>,
|
destructor_for_type: HashMap<ast::def_id, ast::def_id>,
|
||||||
|
|
||||||
// A method will be in this list if and only if it is a destructor.
|
// A method will be in this list if and only if it is a destructor.
|
||||||
destructors: HashMap<ast::def_id, ()>
|
destructors: HashMap<ast::def_id, ()>,
|
||||||
|
|
||||||
|
// Records the value mode (read, copy, or move) for every value.
|
||||||
|
value_modes: HashMap<ast::node_id, ValueMode>,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum tbox_flag {
|
enum tbox_flag {
|
||||||
|
@ -918,7 +921,7 @@ fn mk_ctxt(s: session::Session,
|
||||||
let mut legacy_modes = false;
|
let mut legacy_modes = false;
|
||||||
for crate.node.attrs.each |attribute| {
|
for crate.node.attrs.each |attribute| {
|
||||||
match attribute.node.value.node {
|
match attribute.node.value.node {
|
||||||
ast::meta_word(w) if w == ~"legacy_modes" => {
|
ast::meta_word(ref w) if (*w) == ~"legacy_modes" => {
|
||||||
legacy_modes = true;
|
legacy_modes = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -968,7 +971,8 @@ fn mk_ctxt(s: session::Session,
|
||||||
automatically_derived_methods: HashMap(),
|
automatically_derived_methods: HashMap(),
|
||||||
automatically_derived_methods_for_impl: HashMap(),
|
automatically_derived_methods_for_impl: HashMap(),
|
||||||
destructor_for_type: HashMap(),
|
destructor_for_type: HashMap(),
|
||||||
destructors: HashMap()}
|
destructors: HashMap(),
|
||||||
|
value_modes: HashMap()}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1182,7 +1186,7 @@ pure fn mach_sty(cfg: @session::config, t: t) -> sty {
|
||||||
ty_int(ast::ty_i) => ty_int(cfg.int_type),
|
ty_int(ast::ty_i) => ty_int(cfg.int_type),
|
||||||
ty_uint(ast::ty_u) => ty_uint(cfg.uint_type),
|
ty_uint(ast::ty_u) => ty_uint(cfg.uint_type),
|
||||||
ty_float(ast::ty_f) => ty_float(cfg.float_type),
|
ty_float(ast::ty_f) => ty_float(cfg.float_type),
|
||||||
s => s
|
ref s => (*s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1255,9 +1259,9 @@ fn maybe_walk_ty(ty: t, f: fn(t) -> bool) {
|
||||||
ty_ptr(tm) | ty_rptr(_, tm) => {
|
ty_ptr(tm) | ty_rptr(_, tm) => {
|
||||||
maybe_walk_ty(tm.ty, f);
|
maybe_walk_ty(tm.ty, f);
|
||||||
}
|
}
|
||||||
ty_enum(_, substs) | ty_class(_, substs) |
|
ty_enum(_, ref substs) | ty_class(_, ref substs) |
|
||||||
ty_trait(_, substs, _) => {
|
ty_trait(_, ref substs, _) => {
|
||||||
for substs.tps.each |subty| { maybe_walk_ty(*subty, f); }
|
for (*substs).tps.each |subty| { maybe_walk_ty(*subty, f); }
|
||||||
}
|
}
|
||||||
ty_rec(fields) => {
|
ty_rec(fields) => {
|
||||||
for fields.each |fl| { maybe_walk_ty(fl.mt.ty, f); }
|
for fields.each |fl| { maybe_walk_ty(fl.mt.ty, f); }
|
||||||
|
@ -2913,7 +2917,7 @@ fn is_fn_ty(fty: t) -> bool {
|
||||||
fn ty_region(ty: t) -> Region {
|
fn ty_region(ty: t) -> Region {
|
||||||
match get(ty).sty {
|
match get(ty).sty {
|
||||||
ty_rptr(r, _) => r,
|
ty_rptr(r, _) => r,
|
||||||
s => fail fmt!("ty_region() invoked on non-rptr: %?", s)
|
ref s => fail fmt!("ty_region() invoked on non-rptr: %?", (*s))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3246,10 +3250,10 @@ fn canon<T:Copy cmp::Eq>(tbl: HashMap<ast::node_id, ast::inferable<T>>,
|
||||||
match m0 {
|
match m0 {
|
||||||
ast::infer(id) => match tbl.find(id) {
|
ast::infer(id) => match tbl.find(id) {
|
||||||
None => m0,
|
None => m0,
|
||||||
Some(m1) => {
|
Some(ref m1) => {
|
||||||
let cm1 = canon(tbl, m1);
|
let cm1 = canon(tbl, (*m1));
|
||||||
// path compression:
|
// path compression:
|
||||||
if cm1 != m1 { tbl.insert(id, cm1); }
|
if cm1 != (*m1) { tbl.insert(id, cm1); }
|
||||||
cm1
|
cm1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -3440,11 +3444,11 @@ fn type_err_to_str(cx: ctxt, err: &type_err) -> ~str {
|
||||||
but found bound lifetime parameter %s",
|
but found bound lifetime parameter %s",
|
||||||
bound_region_to_str(cx, br))
|
bound_region_to_str(cx, br))
|
||||||
}
|
}
|
||||||
terr_vstores_differ(k, values) => {
|
terr_vstores_differ(k, ref values) => {
|
||||||
fmt!("%s storage differs: expected %s but found %s",
|
fmt!("%s storage differs: expected %s but found %s",
|
||||||
terr_vstore_kind_to_str(k),
|
terr_vstore_kind_to_str(k),
|
||||||
vstore_to_str(cx, values.expected),
|
vstore_to_str(cx, (*values).expected),
|
||||||
vstore_to_str(cx, values.found))
|
vstore_to_str(cx, (*values).found))
|
||||||
}
|
}
|
||||||
terr_in_field(err, fname) => {
|
terr_in_field(err, fname) => {
|
||||||
fmt!("in field `%s`, %s", cx.sess.str_of(fname),
|
fmt!("in field `%s`, %s", cx.sess.str_of(fname),
|
||||||
|
@ -3515,8 +3519,8 @@ fn store_trait_methods(cx: ctxt, id: ast::node_id, ms: @~[method]) {
|
||||||
fn provided_trait_methods(cx: ctxt, id: ast::def_id) -> ~[ast::ident] {
|
fn provided_trait_methods(cx: ctxt, id: ast::def_id) -> ~[ast::ident] {
|
||||||
if is_local(id) {
|
if is_local(id) {
|
||||||
match cx.items.find(id.node) {
|
match cx.items.find(id.node) {
|
||||||
Some(ast_map::node_item(@{node: item_trait(_, _, ms),_}, _)) =>
|
Some(ast_map::node_item(@{node: item_trait(_, _, ref ms),_}, _)) =>
|
||||||
match ast_util::split_trait_methods(ms) {
|
match ast_util::split_trait_methods((*ms)) {
|
||||||
(_, p) => p.map(|method| method.ident)
|
(_, p) => p.map(|method| method.ident)
|
||||||
},
|
},
|
||||||
_ => cx.sess.bug(fmt!("provided_trait_methods: %? is not a trait",
|
_ => cx.sess.bug(fmt!("provided_trait_methods: %? is not a trait",
|
||||||
|
@ -3543,10 +3547,10 @@ fn trait_supertraits(cx: ctxt, id: ast::def_id) -> @~[InstantiatedTraitRef] {
|
||||||
let result = dvec::DVec();
|
let result = dvec::DVec();
|
||||||
for csearch::get_supertraits(cx, id).each |trait_type| {
|
for csearch::get_supertraits(cx, id).each |trait_type| {
|
||||||
match get(*trait_type).sty {
|
match get(*trait_type).sty {
|
||||||
ty_trait(def_id, substs, _) => {
|
ty_trait(def_id, ref substs, _) => {
|
||||||
result.push(InstantiatedTraitRef {
|
result.push(InstantiatedTraitRef {
|
||||||
def_id: def_id,
|
def_id: def_id,
|
||||||
tpt: { substs: substs, ty: *trait_type }
|
tpt: { substs: (*substs), ty: *trait_type }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
_ => cx.sess.bug(~"trait_supertraits: trait ref wasn't a trait")
|
_ => cx.sess.bug(~"trait_supertraits: trait ref wasn't a trait")
|
||||||
|
@ -3583,7 +3587,7 @@ fn impl_traits(cx: ctxt, id: ast::def_id, vstore: vstore) -> ~[t] {
|
||||||
fn vstoreify(cx: ctxt, ty: t, vstore: vstore) -> t {
|
fn vstoreify(cx: ctxt, ty: t, vstore: vstore) -> t {
|
||||||
match ty::get(ty).sty {
|
match ty::get(ty).sty {
|
||||||
ty::ty_trait(_, _, trait_vstore) if vstore == trait_vstore => ty,
|
ty::ty_trait(_, _, trait_vstore) if vstore == trait_vstore => ty,
|
||||||
ty::ty_trait(did, substs, _) => mk_trait(cx, did, substs, vstore),
|
ty::ty_trait(did, ref substs, _) => mk_trait(cx, did, (*substs), vstore),
|
||||||
_ => cx.sess.bug(~"impl_traits: not a trait")
|
_ => cx.sess.bug(~"impl_traits: not a trait")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3706,10 +3710,10 @@ fn ty_dtor(cx: ctxt, class_id: def_id) -> DtorKind {
|
||||||
if is_local(class_id) {
|
if is_local(class_id) {
|
||||||
match cx.items.find(class_id.node) {
|
match cx.items.find(class_id.node) {
|
||||||
Some(ast_map::node_item(@{
|
Some(ast_map::node_item(@{
|
||||||
node: ast::item_class(@{ dtor: Some(dtor), _ }, _),
|
node: ast::item_class(@{ dtor: Some(ref dtor), _ }, _),
|
||||||
_
|
_
|
||||||
}, _)) =>
|
}, _)) =>
|
||||||
LegacyDtor(local_def(dtor.node.id)),
|
LegacyDtor(local_def((*dtor).node.id)),
|
||||||
_ =>
|
_ =>
|
||||||
NoDtor
|
NoDtor
|
||||||
}
|
}
|
||||||
|
@ -3756,9 +3760,9 @@ fn item_path(cx: ctxt, id: ast::def_id) -> ast_map::path {
|
||||||
vec::append_one(*path, ast_map::path_name(method.ident))
|
vec::append_one(*path, ast_map::path_name(method.ident))
|
||||||
}
|
}
|
||||||
|
|
||||||
ast_map::node_variant(variant, _, path) => {
|
ast_map::node_variant(ref variant, _, path) => {
|
||||||
vec::append_one(vec::init(*path),
|
vec::append_one(vec::init(*path),
|
||||||
ast_map::path_name(variant.node.name))
|
ast_map::path_name((*variant).node.name))
|
||||||
}
|
}
|
||||||
|
|
||||||
ast_map::node_dtor(_, _, _, path) => {
|
ast_map::node_dtor(_, _, _, path) => {
|
||||||
|
@ -3805,9 +3809,9 @@ fn enum_variants(cx: ctxt, id: ast::def_id) -> @~[VariantInfo] {
|
||||||
expr, since check_enum_variants also updates the enum_var_cache
|
expr, since check_enum_variants also updates the enum_var_cache
|
||||||
*/
|
*/
|
||||||
match cx.items.get(id.node) {
|
match cx.items.get(id.node) {
|
||||||
ast_map::node_item(@{node: ast::item_enum(enum_definition, _), _},
|
ast_map::node_item(@{node: ast::item_enum(ref enum_definition, _), _},
|
||||||
_) => {
|
_) => {
|
||||||
let variants = enum_definition.variants;
|
let variants = (*enum_definition).variants;
|
||||||
let mut disr_val = -1;
|
let mut disr_val = -1;
|
||||||
@vec::map(variants, |variant| {
|
@vec::map(variants, |variant| {
|
||||||
match variant.node.kind {
|
match variant.node.kind {
|
||||||
|
@ -3921,8 +3925,8 @@ fn lookup_class_fields(cx: ctxt, did: ast::def_id) -> ~[field_ty] {
|
||||||
_ => cx.sess.bug(~"class ID bound to non-class")
|
_ => cx.sess.bug(~"class ID bound to non-class")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(ast_map::node_variant(variant, _, _)) => {
|
Some(ast_map::node_variant(ref variant, _, _)) => {
|
||||||
match variant.node.kind {
|
match (*variant).node.kind {
|
||||||
ast::struct_variant_kind(struct_def) => {
|
ast::struct_variant_kind(struct_def) => {
|
||||||
class_field_tys(struct_def.fields)
|
class_field_tys(struct_def.fields)
|
||||||
}
|
}
|
||||||
|
@ -4180,24 +4184,24 @@ fn normalize_ty(cx: ctxt, t: t) -> t {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
ty_enum(did, r) =>
|
ty_enum(did, ref r) =>
|
||||||
match r.self_r {
|
match (*r).self_r {
|
||||||
Some(_) =>
|
Some(_) =>
|
||||||
// Use re_static since trans doesn't care about regions
|
// Use re_static since trans doesn't care about regions
|
||||||
mk_enum(cx, did,
|
mk_enum(cx, did,
|
||||||
{self_r: Some(ty::re_static),
|
{self_r: Some(ty::re_static),
|
||||||
self_ty: None,
|
self_ty: None,
|
||||||
tps: r.tps}),
|
tps: (*r).tps}),
|
||||||
None =>
|
None =>
|
||||||
t
|
t
|
||||||
},
|
},
|
||||||
|
|
||||||
ty_class(did, r) =>
|
ty_class(did, ref r) =>
|
||||||
match r.self_r {
|
match (*r).self_r {
|
||||||
Some(_) =>
|
Some(_) =>
|
||||||
// Ditto.
|
// Ditto.
|
||||||
mk_class(cx, did, {self_r: Some(ty::re_static), self_ty: None,
|
mk_class(cx, did, {self_r: Some(ty::re_static), self_ty: None,
|
||||||
tps: r.tps}),
|
tps: (*r).tps}),
|
||||||
None =>
|
None =>
|
||||||
t
|
t
|
||||||
},
|
},
|
||||||
|
@ -4544,9 +4548,9 @@ impl sty : cmp::Eq {
|
||||||
_ => false
|
_ => false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ty_enum(e0a, e1a) => {
|
ty_enum(e0a, ref e1a) => {
|
||||||
match (*other) {
|
match (*other) {
|
||||||
ty_enum(e0b, e1b) => e0a == e0b && e1a == e1b,
|
ty_enum(e0b, ref e1b) => e0a == e0b && (*e1a) == (*e1b),
|
||||||
_ => false
|
_ => false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4586,22 +4590,22 @@ impl sty : cmp::Eq {
|
||||||
_ => false
|
_ => false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ty_fn(e0a) => {
|
ty_fn(ref e0a) => {
|
||||||
match (*other) {
|
match (*other) {
|
||||||
ty_fn(e0b) => e0a == e0b,
|
ty_fn(ref e0b) => (*e0a) == (*e0b),
|
||||||
_ => false
|
_ => false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ty_trait(e0a, e1a, e2a) => {
|
ty_trait(e0a, ref e1a, e2a) => {
|
||||||
match (*other) {
|
match (*other) {
|
||||||
ty_trait(e0b, e1b, e2b) =>
|
ty_trait(e0b, ref e1b, e2b) =>
|
||||||
e0a == e0b && e1a == e1b && e2a == e2b,
|
e0a == e0b && (*e1a) == (*e1b) && e2a == e2b,
|
||||||
_ => false
|
_ => false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ty_class(e0a, e1a) => {
|
ty_class(e0a, ref e1a) => {
|
||||||
match (*other) {
|
match (*other) {
|
||||||
ty_class(e0b, e1b) => e0a == e0b && e1a == e1b,
|
ty_class(e0b, ref e1b) => e0a == e0b && (*e1a) == (*e1b),
|
||||||
_ => false
|
_ => false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,8 +72,8 @@ fn get_region_reporting_err(tcx: ty::ctxt,
|
||||||
|
|
||||||
match res {
|
match res {
|
||||||
result::Ok(r) => r,
|
result::Ok(r) => r,
|
||||||
result::Err(e) => {
|
result::Err(ref e) => {
|
||||||
tcx.sess.span_err(span, e);
|
tcx.sess.span_err(span, (*e));
|
||||||
ty::re_static
|
ty::re_static
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -204,7 +204,7 @@ fn ast_ty_to_ty<AC: ast_conv, RS: region_scope Copy Owned>(
|
||||||
self, rscope,
|
self, rscope,
|
||||||
type_def_id, path);
|
type_def_id, path);
|
||||||
match ty::get(result.ty).sty {
|
match ty::get(result.ty).sty {
|
||||||
ty::ty_trait(trait_def_id, substs, _) => {
|
ty::ty_trait(trait_def_id, ref substs, _) => {
|
||||||
match vst {
|
match vst {
|
||||||
ty::vstore_box | ty::vstore_slice(*) |
|
ty::vstore_box | ty::vstore_slice(*) |
|
||||||
ty::vstore_uniq => {}
|
ty::vstore_uniq => {}
|
||||||
|
@ -218,7 +218,7 @@ fn ast_ty_to_ty<AC: ast_conv, RS: region_scope Copy Owned>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ty::mk_trait(tcx, trait_def_id,
|
return ty::mk_trait(tcx, trait_def_id,
|
||||||
substs, vst);
|
(*substs), vst);
|
||||||
|
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
|
@ -297,8 +297,8 @@ fn ast_ty_to_ty<AC: ast_conv, RS: region_scope Copy Owned>(
|
||||||
let flds = vec::map(fields, |t| ast_ty_to_ty(self, rscope, *t));
|
let flds = vec::map(fields, |t| ast_ty_to_ty(self, rscope, *t));
|
||||||
ty::mk_tup(tcx, flds)
|
ty::mk_tup(tcx, flds)
|
||||||
}
|
}
|
||||||
ast::ty_rec(fields) => {
|
ast::ty_rec(ref fields) => {
|
||||||
let flds = do fields.map |f| {
|
let flds = do (*fields).map |f| {
|
||||||
let tm = ast_mt_to_mt(self, rscope, f.node.mt);
|
let tm = ast_mt_to_mt(self, rscope, f.node.mt);
|
||||||
{ident: f.node.ident, mt: tm}
|
{ident: f.node.ident, mt: tm}
|
||||||
};
|
};
|
||||||
|
|
|
@ -347,7 +347,7 @@ impl LookupContext {
|
||||||
|
|
||||||
|
|
||||||
let bound_substs = match ty::get(bound_trait_ty).sty {
|
let bound_substs = match ty::get(bound_trait_ty).sty {
|
||||||
ty::ty_trait(_, substs, _) => substs,
|
ty::ty_trait(_, ref substs, _) => (*substs),
|
||||||
_ => {
|
_ => {
|
||||||
self.bug(fmt!("add_candidates_from_param: \
|
self.bug(fmt!("add_candidates_from_param: \
|
||||||
non-trait bound %s",
|
non-trait bound %s",
|
||||||
|
@ -882,10 +882,10 @@ impl LookupContext {
|
||||||
candidate_a, candidate_b);
|
candidate_a, candidate_b);
|
||||||
let candidates_same = match (&candidate_a.origin,
|
let candidates_same = match (&candidate_a.origin,
|
||||||
&candidate_b.origin) {
|
&candidate_b.origin) {
|
||||||
(&method_param(p1), &method_param(p2)) => {
|
(&method_param(ref p1), &method_param(ref p2)) => {
|
||||||
let same_trait = p1.trait_id == p2.trait_id;
|
let same_trait = (*p1).trait_id == (*p2).trait_id;
|
||||||
let same_method = p1.method_num == p2.method_num;
|
let same_method = (*p1).method_num == (*p2).method_num;
|
||||||
let same_param = p1.param_num == p2.param_num;
|
let same_param = (*p1).param_num == (*p2).param_num;
|
||||||
// The bound number may be different because
|
// The bound number may be different because
|
||||||
// multiple bounds may lead to the same trait
|
// multiple bounds may lead to the same trait
|
||||||
// impl
|
// impl
|
||||||
|
@ -1059,8 +1059,8 @@ impl LookupContext {
|
||||||
method_static(impl_did) => {
|
method_static(impl_did) => {
|
||||||
self.report_static_candidate(idx, impl_did)
|
self.report_static_candidate(idx, impl_did)
|
||||||
}
|
}
|
||||||
method_param(mp) => {
|
method_param(ref mp) => {
|
||||||
self.report_param_candidate(idx, mp.trait_id)
|
self.report_param_candidate(idx, (*mp).trait_id)
|
||||||
}
|
}
|
||||||
method_trait(trait_did, _, _) | method_self(trait_did, _) => {
|
method_trait(trait_did, _, _) | method_self(trait_did, _) => {
|
||||||
self.report_param_candidate(idx, trait_did)
|
self.report_param_candidate(idx, trait_did)
|
||||||
|
|
|
@ -230,7 +230,7 @@ fn check_fn(ccx: @crate_ctxt,
|
||||||
// types with free ones. The free region references will be bound
|
// types with free ones. The free region references will be bound
|
||||||
// the node_id of the body block.
|
// the node_id of the body block.
|
||||||
|
|
||||||
let {isr, self_info, fn_ty} = {
|
let {isr: isr, self_info: self_info, fn_ty: fn_ty} = {
|
||||||
let old_isr = option::map_default(&old_fcx, @Nil,
|
let old_isr = option::map_default(&old_fcx, @Nil,
|
||||||
|fcx| fcx.in_scope_regions);
|
|fcx| fcx.in_scope_regions);
|
||||||
replace_bound_regions_in_fn_ty(tcx, old_isr, self_info, fn_ty,
|
replace_bound_regions_in_fn_ty(tcx, old_isr, self_info, fn_ty,
|
||||||
|
@ -495,11 +495,11 @@ fn check_item(ccx: @crate_ctxt, it: @ast::item) {
|
||||||
|
|
||||||
match it.node {
|
match it.node {
|
||||||
ast::item_const(_, e) => check_const(ccx, it.span, e, it.id),
|
ast::item_const(_, e) => check_const(ccx, it.span, e, it.id),
|
||||||
ast::item_enum(enum_definition, _) => {
|
ast::item_enum(ref enum_definition, _) => {
|
||||||
check_enum_variants(ccx, it.span, enum_definition.variants, it.id);
|
check_enum_variants(ccx, it.span, (*enum_definition).variants, it.id);
|
||||||
}
|
}
|
||||||
ast::item_fn(decl, _, _, body) => {
|
ast::item_fn(decl, _, _, ref body) => {
|
||||||
check_bare_fn(ccx, decl, body, it.id, None);
|
check_bare_fn(ccx, decl, (*body), it.id, None);
|
||||||
}
|
}
|
||||||
ast::item_impl(_, _, ty, ms) => {
|
ast::item_impl(_, _, ty, ms) => {
|
||||||
let rp = ccx.tcx.region_paramd_items.find(it.id);
|
let rp = ccx.tcx.region_paramd_items.find(it.id);
|
||||||
|
@ -510,8 +510,8 @@ fn check_item(ccx: @crate_ctxt, it: @ast::item) {
|
||||||
check_method(ccx, *m, self_ty, local_def(it.id));
|
check_method(ccx, *m, self_ty, local_def(it.id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ast::item_trait(_, _, trait_methods) => {
|
ast::item_trait(_, _, ref trait_methods) => {
|
||||||
for trait_methods.each |trait_method| {
|
for (*trait_methods).each |trait_method| {
|
||||||
match *trait_method {
|
match *trait_method {
|
||||||
required(*) => {
|
required(*) => {
|
||||||
// Nothing to do, since required methods don't have
|
// Nothing to do, since required methods don't have
|
||||||
|
@ -531,8 +531,8 @@ fn check_item(ccx: @crate_ctxt, it: @ast::item) {
|
||||||
check_bounds_are_used(ccx, t.span, tps, tpt_ty);
|
check_bounds_are_used(ccx, t.span, tps, tpt_ty);
|
||||||
// If this is a record ty, check for duplicate fields
|
// If this is a record ty, check for duplicate fields
|
||||||
match t.node {
|
match t.node {
|
||||||
ast::ty_rec(fields) => {
|
ast::ty_rec(ref fields) => {
|
||||||
check_no_duplicate_fields(ccx.tcx, fields.map(|f|
|
check_no_duplicate_fields(ccx.tcx, (*fields).map(|f|
|
||||||
(f.node.ident, f.span)));
|
(f.node.ident, f.span)));
|
||||||
}
|
}
|
||||||
_ => ()
|
_ => ()
|
||||||
|
@ -690,7 +690,7 @@ impl @fn_ctxt {
|
||||||
}
|
}
|
||||||
fn node_ty_substs(id: ast::node_id) -> ty::substs {
|
fn node_ty_substs(id: ast::node_id) -> ty::substs {
|
||||||
match self.inh.node_type_substs.find(id) {
|
match self.inh.node_type_substs.find(id) {
|
||||||
Some(ts) => ts,
|
Some(ref ts) => (*ts),
|
||||||
None => {
|
None => {
|
||||||
self.tcx().sess.bug(
|
self.tcx().sess.bug(
|
||||||
fmt!("no type substs for node %d: %s in fcx %s",
|
fmt!("no type substs for node %d: %s in fcx %s",
|
||||||
|
@ -720,7 +720,7 @@ impl @fn_ctxt {
|
||||||
{
|
{
|
||||||
match infer::mk_assignty(self.infcx(), false, expr.span, sub, sup) {
|
match infer::mk_assignty(self.infcx(), false, expr.span, sub, sup) {
|
||||||
Ok(None) => result::Ok(()),
|
Ok(None) => result::Ok(()),
|
||||||
Err(e) => result::Err(e),
|
Err(ref e) => result::Err((*e)),
|
||||||
Ok(Some(adjustment)) => {
|
Ok(Some(adjustment)) => {
|
||||||
self.write_adjustment(expr.id, adjustment);
|
self.write_adjustment(expr.id, adjustment);
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -1191,8 +1191,8 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
|
||||||
expr_t,
|
expr_t,
|
||||||
tps,
|
tps,
|
||||||
DontDerefArgs) {
|
DontDerefArgs) {
|
||||||
Some(entry) => {
|
Some(ref entry) => {
|
||||||
fcx.ccx.method_map.insert(expr.id, entry);
|
fcx.ccx.method_map.insert(expr.id, (*entry));
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
fcx.type_error_message(expr.span,
|
fcx.type_error_message(expr.span,
|
||||||
|
@ -1267,13 +1267,13 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
|
||||||
match method::lookup(fcx, op_ex, self_ex,
|
match method::lookup(fcx, op_ex, self_ex,
|
||||||
op_ex.callee_id, opname, self_t, ~[],
|
op_ex.callee_id, opname, self_t, ~[],
|
||||||
deref_args) {
|
deref_args) {
|
||||||
Some(origin) => {
|
Some(ref origin) => {
|
||||||
let {fty: method_ty, bot: bot} = {
|
let {fty: method_ty, bot: bot} = {
|
||||||
let method_ty = fcx.node_ty(op_ex.callee_id);
|
let method_ty = fcx.node_ty(op_ex.callee_id);
|
||||||
check_call_inner(fcx, op_ex.span, op_ex.id,
|
check_call_inner(fcx, op_ex.span, op_ex.id,
|
||||||
method_ty, op_ex, args, deref_args)
|
method_ty, op_ex, args, deref_args)
|
||||||
};
|
};
|
||||||
fcx.ccx.method_map.insert(op_ex.id, origin);
|
fcx.ccx.method_map.insert(op_ex.id, (*origin));
|
||||||
Some((ty::ty_fn_ret(method_ty), bot))
|
Some((ty::ty_fn_ret(method_ty), bot))
|
||||||
}
|
}
|
||||||
_ => None
|
_ => None
|
||||||
|
@ -1341,9 +1341,9 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
|
||||||
{
|
{
|
||||||
let tcx = fcx.ccx.tcx;
|
let tcx = fcx.ccx.tcx;
|
||||||
match ast_util::binop_to_method_name(op) {
|
match ast_util::binop_to_method_name(op) {
|
||||||
Some(name) => {
|
Some(ref name) => {
|
||||||
match lookup_op_method(fcx, ex, lhs_expr, lhs_resolved_t,
|
match lookup_op_method(fcx, ex, lhs_expr, lhs_resolved_t,
|
||||||
fcx.tcx().sess.ident_of(name),
|
fcx.tcx().sess.ident_of((*name)),
|
||||||
~[rhs], DoDerefArgs) {
|
~[rhs], DoDerefArgs) {
|
||||||
Some(pair) => return pair,
|
Some(pair) => return pair,
|
||||||
_ => ()
|
_ => ()
|
||||||
|
@ -1434,7 +1434,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
|
||||||
match expected_sty {
|
match expected_sty {
|
||||||
Some(ty::ty_fn(ref fn_ty)) => {
|
Some(ty::ty_fn(ref fn_ty)) => {
|
||||||
let id = expr.id;
|
let id = expr.id;
|
||||||
let {fn_ty, _} =
|
let {fn_ty: fn_ty, _} =
|
||||||
replace_bound_regions_in_fn_ty(
|
replace_bound_regions_in_fn_ty(
|
||||||
tcx, @Nil, None, fn_ty,
|
tcx, @Nil, None, fn_ty,
|
||||||
|br| ty::re_bound(ty::br_cap_avoid(id, @br)));
|
|br| ty::re_bound(ty::br_cap_avoid(id, @br)));
|
||||||
|
@ -1506,7 +1506,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
|
||||||
_ => ()
|
_ => ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ty::ty_class(base_id, substs) => {
|
ty::ty_class(base_id, ref substs) => {
|
||||||
// This is just for fields -- the same code handles
|
// This is just for fields -- the same code handles
|
||||||
// methods in both classes and traits
|
// methods in both classes and traits
|
||||||
|
|
||||||
|
@ -1515,7 +1515,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
|
||||||
debug!("class named %s", ty_to_str(tcx, base_t));
|
debug!("class named %s", ty_to_str(tcx, base_t));
|
||||||
let cls_items = ty::lookup_class_fields(tcx, base_id);
|
let cls_items = ty::lookup_class_fields(tcx, base_id);
|
||||||
match lookup_field_ty(tcx, base_id, cls_items,
|
match lookup_field_ty(tcx, base_id, cls_items,
|
||||||
field, &substs) {
|
field, &(*substs)) {
|
||||||
Some(field_ty) => {
|
Some(field_ty) => {
|
||||||
// (2) look up what field's type is, and return it
|
// (2) look up what field's type is, and return it
|
||||||
fcx.write_ty(expr.id, field_ty);
|
fcx.write_ty(expr.id, field_ty);
|
||||||
|
@ -1532,8 +1532,8 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
|
||||||
|
|
||||||
match method::lookup(fcx, expr, base, expr.id,
|
match method::lookup(fcx, expr, base, expr.id,
|
||||||
field, expr_t, tps, DontDerefArgs) {
|
field, expr_t, tps, DontDerefArgs) {
|
||||||
Some(entry) => {
|
Some(ref entry) => {
|
||||||
fcx.ccx.method_map.insert(expr.id, entry);
|
fcx.ccx.method_map.insert(expr.id, (*entry));
|
||||||
|
|
||||||
// If we have resolved to a method but this is not in
|
// If we have resolved to a method but this is not in
|
||||||
// a callee position, error
|
// a callee position, error
|
||||||
|
@ -2020,32 +2020,32 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
|
||||||
ast::expr_swap(lhs, rhs) => {
|
ast::expr_swap(lhs, rhs) => {
|
||||||
bot = check_assignment(fcx, lhs, rhs, id);
|
bot = check_assignment(fcx, lhs, rhs, id);
|
||||||
}
|
}
|
||||||
ast::expr_if(cond, thn, elsopt) => {
|
ast::expr_if(cond, ref thn, elsopt) => {
|
||||||
bot = check_expr_with(fcx, cond, ty::mk_bool(tcx)) |
|
bot = check_expr_with(fcx, cond, ty::mk_bool(tcx)) |
|
||||||
check_then_else(fcx, thn, elsopt, id, expr.span);
|
check_then_else(fcx, (*thn), elsopt, id, expr.span);
|
||||||
}
|
}
|
||||||
ast::expr_while(cond, body) => {
|
ast::expr_while(cond, ref body) => {
|
||||||
bot = check_expr_with(fcx, cond, ty::mk_bool(tcx));
|
bot = check_expr_with(fcx, cond, ty::mk_bool(tcx));
|
||||||
check_block_no_value(fcx, body);
|
check_block_no_value(fcx, (*body));
|
||||||
fcx.write_ty(id, ty::mk_nil(tcx));
|
fcx.write_ty(id, ty::mk_nil(tcx));
|
||||||
}
|
}
|
||||||
ast::expr_loop(body, _) => {
|
ast::expr_loop(ref body, _) => {
|
||||||
check_block_no_value(fcx, body);
|
check_block_no_value(fcx, (*body));
|
||||||
fcx.write_ty(id, ty::mk_nil(tcx));
|
fcx.write_ty(id, ty::mk_nil(tcx));
|
||||||
bot = !may_break(tcx, expr.id, body);
|
bot = !may_break(tcx, expr.id, (*body));
|
||||||
}
|
}
|
||||||
ast::expr_match(discrim, arms) => {
|
ast::expr_match(discrim, ref arms) => {
|
||||||
bot = alt::check_alt(fcx, expr, discrim, arms);
|
bot = alt::check_alt(fcx, expr, discrim, (*arms));
|
||||||
}
|
}
|
||||||
ast::expr_fn(proto, decl, body, cap_clause) => {
|
ast::expr_fn(proto, decl, ref body, cap_clause) => {
|
||||||
check_expr_fn(fcx, expr, Some(proto),
|
check_expr_fn(fcx, expr, Some(proto),
|
||||||
decl, body, false,
|
decl, (*body), false,
|
||||||
expected);
|
expected);
|
||||||
capture::check_capture_clause(tcx, expr.id, cap_clause);
|
capture::check_capture_clause(tcx, expr.id, cap_clause);
|
||||||
}
|
}
|
||||||
ast::expr_fn_block(decl, body, cap_clause) => {
|
ast::expr_fn_block(decl, ref body, cap_clause) => {
|
||||||
check_expr_fn(fcx, expr, None,
|
check_expr_fn(fcx, expr, None,
|
||||||
decl, body, false,
|
decl, (*body), false,
|
||||||
expected);
|
expected);
|
||||||
capture::check_capture_clause(tcx, expr.id, cap_clause);
|
capture::check_capture_clause(tcx, expr.id, cap_clause);
|
||||||
}
|
}
|
||||||
|
@ -2058,9 +2058,9 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
|
||||||
// 2. the closure that was given returns unit
|
// 2. the closure that was given returns unit
|
||||||
let expected_sty = unpack_expected(fcx, expected, |x| Some(x));
|
let expected_sty = unpack_expected(fcx, expected, |x| Some(x));
|
||||||
let inner_ty = match expected_sty {
|
let inner_ty = match expected_sty {
|
||||||
Some(ty::ty_fn(fty)) => {
|
Some(ty::ty_fn(ref fty)) => {
|
||||||
match fcx.mk_subty(false, expr.span,
|
match fcx.mk_subty(false, expr.span,
|
||||||
fty.sig.output, ty::mk_bool(tcx)) {
|
(*fty).sig.output, ty::mk_bool(tcx)) {
|
||||||
result::Ok(_) => (),
|
result::Ok(_) => (),
|
||||||
result::Err(_) => {
|
result::Err(_) => {
|
||||||
fcx.type_error_message(expr.span,
|
fcx.type_error_message(expr.span,
|
||||||
|
@ -2068,15 +2068,15 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
|
||||||
fmt!("a `loop` function's last argument \
|
fmt!("a `loop` function's last argument \
|
||||||
should return `bool`, not `%s`", actual)
|
should return `bool`, not `%s`", actual)
|
||||||
},
|
},
|
||||||
fty.sig.output, None);
|
(*fty).sig.output, None);
|
||||||
fcx.write_ty(id, ty::mk_err(tcx));
|
fcx.write_ty(id, ty::mk_err(tcx));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ty::mk_fn(tcx, FnTyBase {
|
ty::mk_fn(tcx, FnTyBase {
|
||||||
meta: fty.meta,
|
meta: (*fty).meta,
|
||||||
sig: FnSig {output: ty::mk_nil(tcx),
|
sig: FnSig {output: ty::mk_nil(tcx),
|
||||||
..fty.sig}
|
..(*fty).sig}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
_ =>
|
_ =>
|
||||||
|
@ -2097,9 +2097,9 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
match b.node {
|
match b.node {
|
||||||
ast::expr_fn_block(decl, body, cap_clause) => {
|
ast::expr_fn_block(decl, ref body, cap_clause) => {
|
||||||
check_expr_fn(fcx, b, None,
|
check_expr_fn(fcx, b, None,
|
||||||
decl, body, true,
|
decl, (*body), true,
|
||||||
Some(inner_ty));
|
Some(inner_ty));
|
||||||
demand::suptype(fcx, b.span, inner_ty, fcx.expr_ty(b));
|
demand::suptype(fcx, b.span, inner_ty, fcx.expr_ty(b));
|
||||||
capture::check_capture_clause(tcx, b.id, cap_clause);
|
capture::check_capture_clause(tcx, b.id, cap_clause);
|
||||||
|
@ -2110,11 +2110,11 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
|
||||||
let block_ty = structurally_resolved_type(
|
let block_ty = structurally_resolved_type(
|
||||||
fcx, expr.span, fcx.node_ty(b.id));
|
fcx, expr.span, fcx.node_ty(b.id));
|
||||||
match ty::get(block_ty).sty {
|
match ty::get(block_ty).sty {
|
||||||
ty::ty_fn(fty) => {
|
ty::ty_fn(ref fty) => {
|
||||||
fcx.write_ty(expr.id, ty::mk_fn(tcx, FnTyBase {
|
fcx.write_ty(expr.id, ty::mk_fn(tcx, FnTyBase {
|
||||||
meta: fty.meta,
|
meta: (*fty).meta,
|
||||||
sig: FnSig {output: ty::mk_bool(tcx),
|
sig: FnSig {output: ty::mk_bool(tcx),
|
||||||
..fty.sig}
|
..(*fty).sig}
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
_ => fail ~"expected fn type"
|
_ => fail ~"expected fn type"
|
||||||
|
@ -2123,8 +2123,8 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
|
||||||
ast::expr_do_body(b) => {
|
ast::expr_do_body(b) => {
|
||||||
let expected_sty = unpack_expected(fcx, expected, |x| Some(x));
|
let expected_sty = unpack_expected(fcx, expected, |x| Some(x));
|
||||||
let inner_ty = match expected_sty {
|
let inner_ty = match expected_sty {
|
||||||
Some(ty::ty_fn(fty)) => {
|
Some(ty::ty_fn(ref fty)) => {
|
||||||
ty::mk_fn(tcx, fty)
|
ty::mk_fn(tcx, (*fty))
|
||||||
}
|
}
|
||||||
_ => match expected {
|
_ => match expected {
|
||||||
Some(expected_t) => {
|
Some(expected_t) => {
|
||||||
|
@ -2141,9 +2141,9 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
match b.node {
|
match b.node {
|
||||||
ast::expr_fn_block(decl, body, cap_clause) => {
|
ast::expr_fn_block(decl, ref body, cap_clause) => {
|
||||||
check_expr_fn(fcx, b, None,
|
check_expr_fn(fcx, b, None,
|
||||||
decl, body, true,
|
decl, (*body), true,
|
||||||
Some(inner_ty));
|
Some(inner_ty));
|
||||||
demand::suptype(fcx, b.span, inner_ty, fcx.expr_ty(b));
|
demand::suptype(fcx, b.span, inner_ty, fcx.expr_ty(b));
|
||||||
capture::check_capture_clause(tcx, b.id, cap_clause);
|
capture::check_capture_clause(tcx, b.id, cap_clause);
|
||||||
|
@ -2154,17 +2154,17 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
|
||||||
let block_ty = structurally_resolved_type(
|
let block_ty = structurally_resolved_type(
|
||||||
fcx, expr.span, fcx.node_ty(b.id));
|
fcx, expr.span, fcx.node_ty(b.id));
|
||||||
match ty::get(block_ty).sty {
|
match ty::get(block_ty).sty {
|
||||||
ty::ty_fn(fty) => {
|
ty::ty_fn(ref fty) => {
|
||||||
fcx.write_ty(expr.id, ty::mk_fn(tcx, fty));
|
fcx.write_ty(expr.id, ty::mk_fn(tcx, (*fty)));
|
||||||
}
|
}
|
||||||
_ => fail ~"expected fn ty"
|
_ => fail ~"expected fn ty"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ast::expr_block(b) => {
|
ast::expr_block(ref b) => {
|
||||||
// If this is an unchecked block, turn off purity-checking
|
// If this is an unchecked block, turn off purity-checking
|
||||||
bot = check_block(fcx, b);
|
bot = check_block(fcx, (*b));
|
||||||
let typ =
|
let typ =
|
||||||
match b.node.expr {
|
match (*b).node.expr {
|
||||||
Some(expr) => fcx.expr_ty(expr),
|
Some(expr) => fcx.expr_ty(expr),
|
||||||
None => ty::mk_nil(tcx)
|
None => ty::mk_nil(tcx)
|
||||||
};
|
};
|
||||||
|
@ -2246,7 +2246,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
|
||||||
let typ = ty::mk_tup(tcx, elt_ts);
|
let typ = ty::mk_tup(tcx, elt_ts);
|
||||||
fcx.write_ty(id, typ);
|
fcx.write_ty(id, typ);
|
||||||
}
|
}
|
||||||
ast::expr_rec(fields, base) => {
|
ast::expr_rec(ref fields, base) => {
|
||||||
option::iter(&base, |b| { check_expr(fcx, *b, expected); });
|
option::iter(&base, |b| { check_expr(fcx, *b, expected); });
|
||||||
let expected = if expected.is_none() && base.is_some() {
|
let expected = if expected.is_none() && base.is_some() {
|
||||||
Some(fcx.expr_ty(base.get()))
|
Some(fcx.expr_ty(base.get()))
|
||||||
|
@ -2254,7 +2254,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
|
||||||
let flds = unpack_expected(fcx, expected, |sty|
|
let flds = unpack_expected(fcx, expected, |sty|
|
||||||
match sty { ty::ty_rec(flds) => Some(flds), _ => None }
|
match sty { ty::ty_rec(flds) => Some(flds), _ => None }
|
||||||
);
|
);
|
||||||
let fields_t = vec::map(fields, |f| {
|
let fields_t = vec::map((*fields), |f| {
|
||||||
bot |= check_expr(fcx, f.node.expr, flds.chain_ref(|flds|
|
bot |= check_expr(fcx, f.node.expr, flds.chain_ref(|flds|
|
||||||
vec::find(*flds, |tf| tf.ident == f.node.ident)
|
vec::find(*flds, |tf| tf.ident == f.node.ident)
|
||||||
).map(|tf| tf.mt.ty));
|
).map(|tf| tf.mt.ty));
|
||||||
|
@ -2274,7 +2274,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
|
||||||
that we're extending a record we know has no dup fields, and
|
that we're extending a record we know has no dup fields, and
|
||||||
it would be ill-typed anyway if we duplicated one of its
|
it would be ill-typed anyway if we duplicated one of its
|
||||||
fields */
|
fields */
|
||||||
check_no_duplicate_fields(tcx, fields.map(|f|
|
check_no_duplicate_fields(tcx, (*fields).map(|f|
|
||||||
(f.node.ident, f.span)));
|
(f.node.ident, f.span)));
|
||||||
}
|
}
|
||||||
Some(bexpr) => {
|
Some(bexpr) => {
|
||||||
|
@ -2309,16 +2309,16 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ast::expr_struct(path, fields, base_expr) => {
|
ast::expr_struct(path, ref fields, base_expr) => {
|
||||||
// Resolve the path.
|
// Resolve the path.
|
||||||
match tcx.def_map.find(id) {
|
match tcx.def_map.find(id) {
|
||||||
Some(ast::def_class(type_def_id)) => {
|
Some(ast::def_class(type_def_id)) => {
|
||||||
check_struct_constructor(fcx, id, expr.span, type_def_id,
|
check_struct_constructor(fcx, id, expr.span, type_def_id,
|
||||||
fields, base_expr);
|
(*fields), base_expr);
|
||||||
}
|
}
|
||||||
Some(ast::def_variant(enum_id, variant_id)) => {
|
Some(ast::def_variant(enum_id, variant_id)) => {
|
||||||
check_struct_enum_variant(fcx, id, expr.span, enum_id,
|
check_struct_enum_variant(fcx, id, expr.span, enum_id,
|
||||||
variant_id, fields);
|
variant_id, (*fields));
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
tcx.sess.span_bug(path.span, ~"structure constructor does \
|
tcx.sess.span_bug(path.span, ~"structure constructor does \
|
||||||
|
@ -2571,9 +2571,9 @@ fn check_enum_variants(ccx: @crate_ctxt,
|
||||||
ccx.tcx.sess.span_err(e.span, ~"expected signed integer \
|
ccx.tcx.sess.span_err(e.span, ~"expected signed integer \
|
||||||
constant");
|
constant");
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(ref err) => {
|
||||||
ccx.tcx.sess.span_err(e.span,
|
ccx.tcx.sess.span_err(e.span,
|
||||||
fmt!("expected constant: %s", err));
|
fmt!("expected constant: %s", (*err)));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2977,9 +2977,9 @@ fn check_intrinsic_type(ccx: @crate_ctxt, it: @ast::foreign_item) {
|
||||||
~"morestack_addr" => {
|
~"morestack_addr" => {
|
||||||
(0u, ~[], ty::mk_nil_ptr(tcx))
|
(0u, ~[], ty::mk_nil_ptr(tcx))
|
||||||
}
|
}
|
||||||
other => {
|
ref other => {
|
||||||
tcx.sess.span_err(it.span, ~"unrecognized intrinsic function: `" +
|
tcx.sess.span_err(it.span, ~"unrecognized intrinsic function: `" +
|
||||||
other + ~"`");
|
(*other) + ~"`");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -26,7 +26,7 @@ fn replace_bound_regions_in_fn_ty(
|
||||||
// Take self_info apart; the self_ty part is the only one we want
|
// Take self_info apart; the self_ty part is the only one we want
|
||||||
// to update here.
|
// to update here.
|
||||||
let (self_ty, rebuild_self_info) = match self_info {
|
let (self_ty, rebuild_self_info) = match self_info {
|
||||||
Some(s) => (Some(s.self_ty), |t| Some({self_ty: t,.. s})),
|
Some(copy s) => (Some(s.self_ty), |t| Some({self_ty: t,.. s})),
|
||||||
None => (None, |_t| None)
|
None => (None, |_t| None)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ fn replace_bound_regions_in_fn_ty(
|
||||||
|
|
||||||
return {isr: isr,
|
return {isr: isr,
|
||||||
self_info: new_self_info,
|
self_info: new_self_info,
|
||||||
fn_ty: match ty::get(t_fn).sty { ty::ty_fn(o) => o,
|
fn_ty: match ty::get(t_fn).sty { ty::ty_fn(ref o) => (*o),
|
||||||
_ => tcx.sess.bug(~"replace_bound_regions_in_fn_ty: impossible")}};
|
_ => tcx.sess.bug(~"replace_bound_regions_in_fn_ty: impossible")}};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,7 @@ fn fixup_substs(vcx: &VtableContext, location_info: &LocationInfo,
|
||||||
let t = ty::mk_trait(tcx, id, substs, ty::vstore_slice(ty::re_static));
|
let t = ty::mk_trait(tcx, id, substs, ty::vstore_slice(ty::re_static));
|
||||||
do fixup_ty(vcx, location_info, t, is_early).map |t_f| {
|
do fixup_ty(vcx, location_info, t, is_early).map |t_f| {
|
||||||
match ty::get(*t_f).sty {
|
match ty::get(*t_f).sty {
|
||||||
ty::ty_trait(_, substs_f, _) => substs_f,
|
ty::ty_trait(_, ref substs_f, _) => (*substs_f),
|
||||||
_ => fail ~"t_f should be a trait"
|
_ => fail ~"t_f should be a trait"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ fn lookup_vtable(vcx: &VtableContext,
|
||||||
|
|
||||||
let tcx = vcx.tcx();
|
let tcx = vcx.tcx();
|
||||||
let (trait_id, trait_substs, trait_vstore) = match ty::get(trait_ty).sty {
|
let (trait_id, trait_substs, trait_vstore) = match ty::get(trait_ty).sty {
|
||||||
ty::ty_trait(did, substs, vstore) => (did, substs, vstore),
|
ty::ty_trait(did, ref substs, vstore) => (did, (*substs), vstore),
|
||||||
_ => tcx.sess.impossible_case(location_info.span,
|
_ => tcx.sess.impossible_case(location_info.span,
|
||||||
"lookup_vtable: \
|
"lookup_vtable: \
|
||||||
don't know how to handle a non-trait")
|
don't know how to handle a non-trait")
|
||||||
|
@ -203,7 +203,7 @@ fn lookup_vtable(vcx: &VtableContext,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ty::ty_trait(did, substs, _) if trait_id == did => {
|
ty::ty_trait(did, ref substs, _) if trait_id == did => {
|
||||||
debug!("(checking vtable) @1 relating ty to trait ty with did %?",
|
debug!("(checking vtable) @1 relating ty to trait ty with did %?",
|
||||||
did);
|
did);
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ fn lookup_vtable(vcx: &VtableContext,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Some(vtable_trait(did, substs.tps));
|
return Some(vtable_trait(did, (*substs).tps));
|
||||||
}
|
}
|
||||||
|
|
||||||
_ => {
|
_ => {
|
||||||
|
@ -357,7 +357,7 @@ fn lookup_vtable(vcx: &VtableContext,
|
||||||
trait_id,
|
trait_id,
|
||||||
substs,
|
substs,
|
||||||
is_early) {
|
is_early) {
|
||||||
Some(substs) => substs,
|
Some(ref substs) => (*substs),
|
||||||
None => {
|
None => {
|
||||||
assert is_early;
|
assert is_early;
|
||||||
// Bail out with a bogus answer
|
// Bail out with a bogus answer
|
||||||
|
@ -468,8 +468,8 @@ fn connect_trait_tps(vcx: &VtableContext,
|
||||||
debug!("(connect trait tps) trait type is %?, impl did is %?",
|
debug!("(connect trait tps) trait type is %?, impl did is %?",
|
||||||
ty::get(trait_ty).sty, impl_did);
|
ty::get(trait_ty).sty, impl_did);
|
||||||
match ty::get(trait_ty).sty {
|
match ty::get(trait_ty).sty {
|
||||||
ty::ty_trait(_, substs, _) => {
|
ty::ty_trait(_, ref substs, _) => {
|
||||||
for vec::each2(substs.tps, trait_tys) |a, b| {
|
for vec::each2((*substs).tps, trait_tys) |a, b| {
|
||||||
demand_suptype(vcx, location_info.span, *a, *b);
|
demand_suptype(vcx, location_info.span, *a, *b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,9 +100,9 @@ fn resolve_type_vars_for_node(wbcx: wb_ctxt, sp: span, id: ast::node_id)
|
||||||
id, ty_to_str(tcx, n_ty), ty_to_str(tcx, t));
|
id, ty_to_str(tcx, n_ty), ty_to_str(tcx, t));
|
||||||
write_ty_to_tcx(tcx, id, t);
|
write_ty_to_tcx(tcx, id, t);
|
||||||
match fcx.opt_node_ty_substs(id) {
|
match fcx.opt_node_ty_substs(id) {
|
||||||
Some(substs) => {
|
Some(ref substs) => {
|
||||||
let mut new_tps = ~[];
|
let mut new_tps = ~[];
|
||||||
for substs.tps.each |subst| {
|
for (*substs).tps.each |subst| {
|
||||||
match resolve_type_vars_in_type(fcx, sp, *subst) {
|
match resolve_type_vars_in_type(fcx, sp, *subst) {
|
||||||
Some(t) => new_tps.push(t),
|
Some(t) => new_tps.push(t),
|
||||||
None => { wbcx.success = false; return None; }
|
None => { wbcx.success = false; return None; }
|
||||||
|
|
|
@ -627,8 +627,8 @@ impl CoherenceChecker {
|
||||||
match self.crate_context.tcx.items.find(method_def_id.node) {
|
match self.crate_context.tcx.items.find(method_def_id.node) {
|
||||||
Some(ast_map::node_trait_method(trait_method, _, _)) => {
|
Some(ast_map::node_trait_method(trait_method, _, _)) => {
|
||||||
match *trait_method {
|
match *trait_method {
|
||||||
ast::required(ty_method) => {
|
ast::required(ref ty_method) => {
|
||||||
attr::attrs_contains_name(ty_method.attrs,
|
attr::attrs_contains_name((*ty_method).attrs,
|
||||||
~"derivable")
|
~"derivable")
|
||||||
}
|
}
|
||||||
ast::provided(method) => {
|
ast::provided(method) => {
|
||||||
|
@ -1028,8 +1028,8 @@ impl CoherenceChecker {
|
||||||
// Destructors only work on nominal types.
|
// Destructors only work on nominal types.
|
||||||
if impl_info.did.crate == ast::local_crate {
|
if impl_info.did.crate == ast::local_crate {
|
||||||
match tcx.items.find(impl_info.did.node) {
|
match tcx.items.find(impl_info.did.node) {
|
||||||
Some(ast_map::node_item(@item, _)) => {
|
Some(ast_map::node_item(@ref item, _)) => {
|
||||||
tcx.sess.span_err(item.span,
|
tcx.sess.span_err((*item).span,
|
||||||
~"the Drop trait may only \
|
~"the Drop trait may only \
|
||||||
be implemented on \
|
be implemented on \
|
||||||
structures");
|
structures");
|
||||||
|
|
|
@ -108,9 +108,9 @@ impl @crate_ctxt: ast_conv {
|
||||||
Some(ast_map::node_foreign_item(foreign_item, _, _)) => {
|
Some(ast_map::node_foreign_item(foreign_item, _, _)) => {
|
||||||
ty_of_foreign_item(self, foreign_item)
|
ty_of_foreign_item(self, foreign_item)
|
||||||
}
|
}
|
||||||
x => {
|
ref x => {
|
||||||
self.tcx.sess.bug(fmt!("unexpected sort of item \
|
self.tcx.sess.bug(fmt!("unexpected sort of item \
|
||||||
in get_item_ty(): %?", x));
|
in get_item_ty(): %?", (*x)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -164,8 +164,8 @@ fn get_enum_variant_types(ccx: @crate_ctxt,
|
||||||
convert_struct(
|
convert_struct(
|
||||||
ccx, rp, struct_def, ty_params, tpt, variant.node.id);
|
ccx, rp, struct_def, ty_params, tpt, variant.node.id);
|
||||||
}
|
}
|
||||||
ast::enum_variant_kind(enum_definition) => {
|
ast::enum_variant_kind(ref enum_definition) => {
|
||||||
get_enum_variant_types(ccx, enum_ty, enum_definition.variants,
|
get_enum_variant_types(ccx, enum_ty, (*enum_definition).variants,
|
||||||
ty_params, rp);
|
ty_params, rp);
|
||||||
result_ty = None;
|
result_ty = None;
|
||||||
}
|
}
|
||||||
|
@ -232,11 +232,11 @@ fn ensure_trait_methods(ccx: @crate_ctxt, id: ast::node_id, trait_ty: ty::t) {
|
||||||
let tcx = ccx.tcx;
|
let tcx = ccx.tcx;
|
||||||
let region_paramd = tcx.region_paramd_items.find(id);
|
let region_paramd = tcx.region_paramd_items.find(id);
|
||||||
match tcx.items.get(id) {
|
match tcx.items.get(id) {
|
||||||
ast_map::node_item(@{node: ast::item_trait(params, _, ms), _}, _) => {
|
ast_map::node_item(@{node: ast::item_trait(params, _, ref ms), _}, _) => {
|
||||||
store_methods::<ast::trait_method>(ccx, id, ms, |m| {
|
store_methods::<ast::trait_method>(ccx, id, (*ms), |m| {
|
||||||
let def_id;
|
let def_id;
|
||||||
match *m {
|
match *m {
|
||||||
ast::required(ty_method) => def_id = local_def(ty_method.id),
|
ast::required(ref ty_method) => def_id = local_def((*ty_method).id),
|
||||||
ast::provided(method) => def_id = local_def(method.id)
|
ast::provided(method) => def_id = local_def(method.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -550,10 +550,10 @@ fn convert(ccx: @crate_ctxt, it: @ast::item) {
|
||||||
match it.node {
|
match it.node {
|
||||||
// These don't define types.
|
// These don't define types.
|
||||||
ast::item_foreign_mod(_) | ast::item_mod(_) => {}
|
ast::item_foreign_mod(_) | ast::item_mod(_) => {}
|
||||||
ast::item_enum(enum_definition, ty_params) => {
|
ast::item_enum(ref enum_definition, ty_params) => {
|
||||||
let tpt = ty_of_item(ccx, it);
|
let tpt = ty_of_item(ccx, it);
|
||||||
write_ty_to_tcx(tcx, it.id, tpt.ty);
|
write_ty_to_tcx(tcx, it.id, tpt.ty);
|
||||||
get_enum_variant_types(ccx, tpt.ty, enum_definition.variants,
|
get_enum_variant_types(ccx, tpt.ty, (*enum_definition).variants,
|
||||||
ty_params, rp);
|
ty_params, rp);
|
||||||
}
|
}
|
||||||
ast::item_impl(tps, trait_ref, selfty, ms) => {
|
ast::item_impl(tps, trait_ref, selfty, ms) => {
|
||||||
|
@ -570,7 +570,7 @@ fn convert(ccx: @crate_ctxt, it: @ast::item) {
|
||||||
check_methods_against_trait(ccx, tps, rp, selfty, *t, cms);
|
check_methods_against_trait(ccx, tps, rp, selfty, *t, cms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ast::item_trait(tps, supertraits, trait_methods) => {
|
ast::item_trait(tps, supertraits, ref trait_methods) => {
|
||||||
let tpt = ty_of_item(ccx, it);
|
let tpt = ty_of_item(ccx, it);
|
||||||
debug!("item_trait(it.id=%d, tpt.ty=%s)",
|
debug!("item_trait(it.id=%d, tpt.ty=%s)",
|
||||||
it.id, ty_to_str(tcx, tpt.ty));
|
it.id, ty_to_str(tcx, tpt.ty));
|
||||||
|
@ -578,7 +578,7 @@ fn convert(ccx: @crate_ctxt, it: @ast::item) {
|
||||||
ensure_trait_methods(ccx, it.id, tpt.ty);
|
ensure_trait_methods(ccx, it.id, tpt.ty);
|
||||||
ensure_supertraits(ccx, it.id, it.span, rp, supertraits);
|
ensure_supertraits(ccx, it.id, it.span, rp, supertraits);
|
||||||
|
|
||||||
let (_, provided_methods) = split_trait_methods(trait_methods);
|
let (_, provided_methods) = split_trait_methods((*trait_methods));
|
||||||
let {bounds, _} = mk_substs(ccx, tps, rp);
|
let {bounds, _} = mk_substs(ccx, tps, rp);
|
||||||
let _cms = convert_methods(ccx, provided_methods, rp, bounds);
|
let _cms = convert_methods(ccx, provided_methods, rp, bounds);
|
||||||
// FIXME (#2616): something like this, when we start having
|
// FIXME (#2616): something like this, when we start having
|
||||||
|
@ -634,7 +634,7 @@ fn convert_struct(ccx: @crate_ctxt,
|
||||||
for struct_def.fields.each |f| {
|
for struct_def.fields.each |f| {
|
||||||
convert_field(ccx, rp, tpt.bounds, *f);
|
convert_field(ccx, rp, tpt.bounds, *f);
|
||||||
}
|
}
|
||||||
let {bounds, substs} = mk_substs(ccx, tps, rp);
|
let {bounds: bounds, substs: substs} = mk_substs(ccx, tps, rp);
|
||||||
let selfty = ty::mk_class(tcx, local_def(id), substs);
|
let selfty = ty::mk_class(tcx, local_def(id), substs);
|
||||||
let cms = convert_methods(ccx, struct_def.methods, rp, bounds);
|
let cms = convert_methods(ccx, struct_def.methods, rp, bounds);
|
||||||
for struct_def.traits.each |trait_ref| {
|
for struct_def.traits.each |trait_ref| {
|
||||||
|
@ -813,7 +813,7 @@ fn ty_of_item(ccx: @crate_ctxt, it: @ast::item)
|
||||||
}
|
}
|
||||||
ast::item_enum(_, tps) => {
|
ast::item_enum(_, tps) => {
|
||||||
// Create a new generic polytype.
|
// Create a new generic polytype.
|
||||||
let {bounds, substs} = mk_substs(ccx, tps, rp);
|
let {bounds: bounds, substs: substs} = mk_substs(ccx, tps, rp);
|
||||||
let t = ty::mk_enum(tcx, local_def(it.id), substs);
|
let t = ty::mk_enum(tcx, local_def(it.id), substs);
|
||||||
let tpt = {bounds: bounds,
|
let tpt = {bounds: bounds,
|
||||||
region_param: rp,
|
region_param: rp,
|
||||||
|
@ -822,7 +822,7 @@ fn ty_of_item(ccx: @crate_ctxt, it: @ast::item)
|
||||||
return tpt;
|
return tpt;
|
||||||
}
|
}
|
||||||
ast::item_trait(tps, _, _) => {
|
ast::item_trait(tps, _, _) => {
|
||||||
let {bounds, substs} = mk_substs(ccx, tps, rp);
|
let {bounds: bounds, substs: substs} = mk_substs(ccx, tps, rp);
|
||||||
let t = ty::mk_trait(tcx, local_def(it.id), substs, ty::vstore_box);
|
let t = ty::mk_trait(tcx, local_def(it.id), substs, ty::vstore_box);
|
||||||
let tpt = {bounds: bounds,
|
let tpt = {bounds: bounds,
|
||||||
region_param: rp,
|
region_param: rp,
|
||||||
|
@ -831,7 +831,7 @@ fn ty_of_item(ccx: @crate_ctxt, it: @ast::item)
|
||||||
return tpt;
|
return tpt;
|
||||||
}
|
}
|
||||||
ast::item_class(_, tps) => {
|
ast::item_class(_, tps) => {
|
||||||
let {bounds,substs} = mk_substs(ccx, tps, rp);
|
let {bounds: bounds, substs: substs} = mk_substs(ccx, tps, rp);
|
||||||
let t = ty::mk_class(tcx, local_def(it.id), substs);
|
let t = ty::mk_class(tcx, local_def(it.id), substs);
|
||||||
let tpt = {bounds: bounds,
|
let tpt = {bounds: bounds,
|
||||||
region_param: rp,
|
region_param: rp,
|
||||||
|
|
|
@ -64,7 +64,7 @@ use combine::combine_fields;
|
||||||
fn to_ares(+c: cres<ty::t>) -> ares {
|
fn to_ares(+c: cres<ty::t>) -> ares {
|
||||||
match c {
|
match c {
|
||||||
Ok(_) => Ok(None),
|
Ok(_) => Ok(None),
|
||||||
Err(e) => Err(e)
|
Err(ref e) => Err((*e))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ priv impl Assign {
|
||||||
(ty::ty_rptr(_, ref a_t), ty::ty_ptr(ref b_t)) => {
|
(ty::ty_rptr(_, ref a_t), ty::ty_ptr(ref b_t)) => {
|
||||||
match Sub(*self).mts(*a_t, *b_t) {
|
match Sub(*self).mts(*a_t, *b_t) {
|
||||||
Ok(_) => Ok(None),
|
Ok(_) => Ok(None),
|
||||||
Err(e) => Err(e)
|
Err(ref e) => Err((*e))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -521,8 +521,8 @@ trait ToUres {
|
||||||
impl<T> cres<T>: ToUres {
|
impl<T> cres<T>: ToUres {
|
||||||
fn to_ures() -> ures {
|
fn to_ures() -> ures {
|
||||||
match self {
|
match self {
|
||||||
Ok(_v) => Ok(()),
|
Ok(ref _v) => Ok(()),
|
||||||
Err(e) => Err(e)
|
Err(ref e) => Err((*e))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -761,7 +761,7 @@ impl infer_ctxt {
|
||||||
&self, span: span,
|
&self, span: span,
|
||||||
fty: &ty::FnTy) -> (ty::FnTy, isr_alist)
|
fty: &ty::FnTy) -> (ty::FnTy, isr_alist)
|
||||||
{
|
{
|
||||||
let {fn_ty, isr, _} =
|
let {fn_ty: fn_ty, isr: isr, _} =
|
||||||
replace_bound_regions_in_fn_ty(self.tcx, @Nil, None, fty, |br| {
|
replace_bound_regions_in_fn_ty(self.tcx, @Nil, None, fty, |br| {
|
||||||
// N.B.: The name of the bound region doesn't have anything to
|
// N.B.: The name of the bound region doesn't have anything to
|
||||||
// do with the region variable that's created for it. The
|
// do with the region variable that's created for it. The
|
||||||
|
|
|
@ -620,8 +620,8 @@ impl RegionVarBindings {
|
||||||
AddConstraint(constraint) => {
|
AddConstraint(constraint) => {
|
||||||
self.constraints.remove(constraint);
|
self.constraints.remove(constraint);
|
||||||
}
|
}
|
||||||
AddCombination(map, regions) => {
|
AddCombination(map, ref regions) => {
|
||||||
map.remove(regions);
|
map.remove((*regions));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ impl Sub: combine {
|
||||||
do indent {
|
do indent {
|
||||||
match self.infcx.region_vars.make_subregion(self.span, a, b) {
|
match self.infcx.region_vars.make_subregion(self.span, a, b) {
|
||||||
Ok(()) => Ok(a),
|
Ok(()) => Ok(a),
|
||||||
Err(e) => Err(e)
|
Err(ref e) => Err((*e))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ impl ty::FnTy: ToStr {
|
||||||
impl<V:Copy ToStr> bound<V>: ToStr {
|
impl<V:Copy ToStr> bound<V>: ToStr {
|
||||||
fn to_str(cx: infer_ctxt) -> ~str {
|
fn to_str(cx: infer_ctxt) -> ~str {
|
||||||
match self {
|
match self {
|
||||||
Some(v) => v.to_str(cx),
|
Some(ref v) => (*v).to_str(cx),
|
||||||
None => ~"none"
|
None => ~"none"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,8 +76,8 @@ impl float_ty_set: ToStr {
|
||||||
impl<V:Copy vid, T:Copy ToStr> var_value<V, T>: ToStr {
|
impl<V:Copy vid, T:Copy ToStr> var_value<V, T>: ToStr {
|
||||||
fn to_str(cx: infer_ctxt) -> ~str {
|
fn to_str(cx: infer_ctxt) -> ~str {
|
||||||
match self {
|
match self {
|
||||||
redirect(vid) => fmt!("redirect(%s)", vid.to_str()),
|
redirect(ref vid) => fmt!("redirect(%s)", (*vid).to_str()),
|
||||||
root(pt, rk) => fmt!("root(%s, %s)", pt.to_str(cx),
|
root(ref pt, rk) => fmt!("root(%s, %s)", (*pt).to_str(cx),
|
||||||
uint::to_str(rk, 10u))
|
uint::to_str(rk, 10u))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,18 +39,18 @@ impl infer_ctxt {
|
||||||
None => {
|
None => {
|
||||||
self.tcx.sess.bug(fmt!("failed lookup of vid `%u`", vid_u));
|
self.tcx.sess.bug(fmt!("failed lookup of vid `%u`", vid_u));
|
||||||
}
|
}
|
||||||
Some(var_val) => {
|
Some(ref var_val) => {
|
||||||
match var_val {
|
match (*var_val) {
|
||||||
redirect(vid) => {
|
redirect(ref vid) => {
|
||||||
let node = self.get(vb, vid);
|
let node = self.get(vb, (*vid));
|
||||||
if node.root != vid {
|
if node.root != (*vid) {
|
||||||
// Path compression
|
// Path compression
|
||||||
vb.vals.insert(vid.to_uint(), redirect(node.root));
|
vb.vals.insert((*vid).to_uint(), redirect(node.root));
|
||||||
}
|
}
|
||||||
node
|
node
|
||||||
}
|
}
|
||||||
root(pt, rk) => {
|
root(ref pt, rk) => {
|
||||||
node {root: vid, possible_types: pt, rank: rk}
|
node {root: vid, possible_types: (*pt), rank: rk}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -332,7 +332,7 @@ fn check_main_fn_ty(ccx: @crate_ctxt,
|
||||||
let tcx = ccx.tcx;
|
let tcx = ccx.tcx;
|
||||||
let main_t = ty::node_id_to_type(tcx, main_id);
|
let main_t = ty::node_id_to_type(tcx, main_id);
|
||||||
match ty::get(main_t).sty {
|
match ty::get(main_t).sty {
|
||||||
ty::ty_fn(fn_ty) => {
|
ty::ty_fn(ref fn_ty) => {
|
||||||
match tcx.items.find(main_id) {
|
match tcx.items.find(main_id) {
|
||||||
Some(ast_map::node_item(it,_)) => {
|
Some(ast_map::node_item(it,_)) => {
|
||||||
match it.node {
|
match it.node {
|
||||||
|
@ -348,8 +348,8 @@ fn check_main_fn_ty(ccx: @crate_ctxt,
|
||||||
}
|
}
|
||||||
_ => ()
|
_ => ()
|
||||||
}
|
}
|
||||||
let mut ok = ty::type_is_nil(fn_ty.sig.output);
|
let mut ok = ty::type_is_nil((*fn_ty).sig.output);
|
||||||
let num_args = vec::len(fn_ty.sig.inputs);
|
let num_args = vec::len((*fn_ty).sig.inputs);
|
||||||
ok &= num_args == 0u;
|
ok &= num_args == 0u;
|
||||||
if !ok {
|
if !ok {
|
||||||
tcx.sess.span_err(
|
tcx.sess.span_err(
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#[allow(vecs_implicitly_copyable)];
|
#[allow(vecs_implicitly_copyable)];
|
||||||
#[allow(non_camel_case_types)];
|
#[allow(non_camel_case_types)];
|
||||||
#[allow(deprecated_mode)];
|
#[allow(deprecated_mode)];
|
||||||
#[allow(deprecated_pattern)];
|
#[warn(deprecated_pattern)];
|
||||||
|
|
||||||
extern mod core(vers = "0.5");
|
extern mod core(vers = "0.5");
|
||||||
extern mod std(vers = "0.5");
|
extern mod std(vers = "0.5");
|
||||||
|
@ -334,9 +334,9 @@ fn run_compiler(args: &~[~str], demitter: diagnostic::emitter) {
|
||||||
|
|
||||||
let matches =
|
let matches =
|
||||||
&match getopts::groups::getopts(args, optgroups()) {
|
&match getopts::groups::getopts(args, optgroups()) {
|
||||||
Ok(m) => m,
|
Ok(ref m) => (*m),
|
||||||
Err(f) => {
|
Err(ref f) => {
|
||||||
early_error(demitter, getopts::fail_str(f))
|
early_error(demitter, getopts::fail_str((*f)))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -396,8 +396,8 @@ fn run_compiler(args: &~[~str], demitter: diagnostic::emitter) {
|
||||||
let ls = opt_present(matches, ~"ls");
|
let ls = opt_present(matches, ~"ls");
|
||||||
if ls {
|
if ls {
|
||||||
match input {
|
match input {
|
||||||
file_input(ifile) => {
|
file_input(ref ifile) => {
|
||||||
list_metadata(sess, &ifile, io::stdout());
|
list_metadata(sess, &(*ifile), io::stdout());
|
||||||
}
|
}
|
||||||
str_input(_) => {
|
str_input(_) => {
|
||||||
early_error(demitter, ~"can not list metadata for stdin");
|
early_error(demitter, ~"can not list metadata for stdin");
|
||||||
|
|
|
@ -39,14 +39,14 @@ fn note_and_explain_region(cx: ctxt,
|
||||||
region: ty::Region,
|
region: ty::Region,
|
||||||
suffix: ~str) {
|
suffix: ~str) {
|
||||||
match explain_region_and_span(cx, region) {
|
match explain_region_and_span(cx, region) {
|
||||||
(str, Some(span)) => {
|
(ref str, Some(span)) => {
|
||||||
cx.sess.span_note(
|
cx.sess.span_note(
|
||||||
span,
|
span,
|
||||||
fmt!("%s%s%s", prefix, str, suffix));
|
fmt!("%s%s%s", prefix, (*str), suffix));
|
||||||
}
|
}
|
||||||
(str, None) => {
|
(ref str, None) => {
|
||||||
cx.sess.note(
|
cx.sess.note(
|
||||||
fmt!("%s%s%s", prefix, str, suffix));
|
fmt!("%s%s%s", prefix, (*str), suffix));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,8 +65,8 @@ fn explain_region_and_span(cx: ctxt, region: ty::Region)
|
||||||
return match region {
|
return match region {
|
||||||
re_scope(node_id) => {
|
re_scope(node_id) => {
|
||||||
match cx.items.find(node_id) {
|
match cx.items.find(node_id) {
|
||||||
Some(ast_map::node_block(blk)) => {
|
Some(ast_map::node_block(ref blk)) => {
|
||||||
explain_span(cx, ~"block", blk.span)
|
explain_span(cx, ~"block", (*blk).span)
|
||||||
}
|
}
|
||||||
Some(ast_map::node_expr(expr)) => {
|
Some(ast_map::node_expr(expr)) => {
|
||||||
match expr.node {
|
match expr.node {
|
||||||
|
@ -95,8 +95,8 @@ fn explain_region_and_span(cx: ctxt, region: ty::Region)
|
||||||
};
|
};
|
||||||
|
|
||||||
match cx.items.find(id) {
|
match cx.items.find(id) {
|
||||||
Some(ast_map::node_block(blk)) => {
|
Some(ast_map::node_block(ref blk)) => {
|
||||||
let (msg, opt_span) = explain_span(cx, ~"block", blk.span);
|
let (msg, opt_span) = explain_span(cx, ~"block", (*blk).span);
|
||||||
(fmt!("%s %s", prefix, msg), opt_span)
|
(fmt!("%s %s", prefix, msg), opt_span)
|
||||||
}
|
}
|
||||||
Some(_) | None => {
|
Some(_) | None => {
|
||||||
|
@ -143,9 +143,9 @@ fn bound_region_to_str_adorned(cx: ctxt, prefix: ~str,
|
||||||
|
|
||||||
fn re_scope_id_to_str(cx: ctxt, node_id: ast::node_id) -> ~str {
|
fn re_scope_id_to_str(cx: ctxt, node_id: ast::node_id) -> ~str {
|
||||||
match cx.items.find(node_id) {
|
match cx.items.find(node_id) {
|
||||||
Some(ast_map::node_block(blk)) => {
|
Some(ast_map::node_block(ref blk)) => {
|
||||||
fmt!("<block at %s>",
|
fmt!("<block at %s>",
|
||||||
cx.sess.codemap.span_to_str(blk.span))
|
cx.sess.codemap.span_to_str((*blk).span))
|
||||||
}
|
}
|
||||||
Some(ast_map::node_expr(expr)) => {
|
Some(ast_map::node_expr(expr)) => {
|
||||||
match expr.node {
|
match expr.node {
|
||||||
|
@ -408,15 +408,15 @@ fn ty_to_str(cx: ctxt, typ: t) -> ~str {
|
||||||
~"'" + str::from_bytes(~[('a' as u8) + (id as u8)])
|
~"'" + str::from_bytes(~[('a' as u8) + (id as u8)])
|
||||||
}
|
}
|
||||||
ty_self => ~"self",
|
ty_self => ~"self",
|
||||||
ty_enum(did, substs) | ty_class(did, substs) => {
|
ty_enum(did, ref substs) | ty_class(did, ref substs) => {
|
||||||
let path = ty::item_path(cx, did);
|
let path = ty::item_path(cx, did);
|
||||||
let base = ast_map::path_to_str(path, cx.sess.intr());
|
let base = ast_map::path_to_str(path, cx.sess.intr());
|
||||||
parameterized(cx, base, substs.self_r, substs.tps)
|
parameterized(cx, base, (*substs).self_r, (*substs).tps)
|
||||||
}
|
}
|
||||||
ty_trait(did, substs, vs) => {
|
ty_trait(did, ref substs, vs) => {
|
||||||
let path = ty::item_path(cx, did);
|
let path = ty::item_path(cx, did);
|
||||||
let base = ast_map::path_to_str(path, cx.sess.intr());
|
let base = ast_map::path_to_str(path, cx.sess.intr());
|
||||||
let result = parameterized(cx, base, substs.self_r, substs.tps);
|
let result = parameterized(cx, base, (*substs).self_r, (*substs).tps);
|
||||||
vstore_ty_to_str(cx, result, vs)
|
vstore_ty_to_str(cx, result, vs)
|
||||||
}
|
}
|
||||||
ty_evec(mt, vs) => {
|
ty_evec(mt, vs) => {
|
||||||
|
|
|
@ -555,9 +555,9 @@ impl<T: to_bytes::IterBytes> inferable<T> : to_bytes::IterBytes {
|
||||||
impl<T:cmp::Eq> inferable<T> : cmp::Eq {
|
impl<T:cmp::Eq> inferable<T> : cmp::Eq {
|
||||||
pure fn eq(&self, other: &inferable<T>) -> bool {
|
pure fn eq(&self, other: &inferable<T>) -> bool {
|
||||||
match (*self) {
|
match (*self) {
|
||||||
expl(e0a) => {
|
expl(ref e0a) => {
|
||||||
match (*other) {
|
match (*other) {
|
||||||
expl(e0b) => e0a == e0b,
|
expl(ref e0b) => (*e0a) == (*e0b),
|
||||||
_ => false
|
_ => false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,8 +163,8 @@ fn map_fn(fk: visit::fn_kind, decl: fn_decl, body: blk,
|
||||||
cx.local_id += 1u;
|
cx.local_id += 1u;
|
||||||
}
|
}
|
||||||
match fk {
|
match fk {
|
||||||
visit::fk_dtor(tps, attrs, self_id, parent_id) => {
|
visit::fk_dtor(tps, ref attrs, self_id, parent_id) => {
|
||||||
let dt = @{node: {id: id, attrs: attrs, self_id: self_id,
|
let dt = @{node: {id: id, attrs: (*attrs), self_id: self_id,
|
||||||
body: /* FIXME (#2543) */ copy body}, span: sp};
|
body: /* FIXME (#2543) */ copy body}, span: sp};
|
||||||
cx.map.insert(id, node_dtor(/* FIXME (#2543) */ copy tps, dt,
|
cx.map.insert(id, node_dtor(/* FIXME (#2543) */ copy tps, dt,
|
||||||
parent_id,
|
parent_id,
|
||||||
|
@ -219,8 +219,8 @@ fn map_item(i: @item, cx: ctx, v: vt) {
|
||||||
map_method(impl_did, extend(cx, i.ident), *m, cx);
|
map_method(impl_did, extend(cx, i.ident), *m, cx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
item_enum(enum_definition, _) => {
|
item_enum(ref enum_definition, _) => {
|
||||||
for enum_definition.variants.each |v| {
|
for (*enum_definition).variants.each |v| {
|
||||||
cx.map.insert(v.node.id, node_variant(
|
cx.map.insert(v.node.id, node_variant(
|
||||||
/* FIXME (#2543) */ copy *v, i,
|
/* FIXME (#2543) */ copy *v, i,
|
||||||
extend(cx, i.ident)));
|
extend(cx, i.ident)));
|
||||||
|
@ -228,7 +228,7 @@ fn map_item(i: @item, cx: ctx, v: vt) {
|
||||||
}
|
}
|
||||||
item_foreign_mod(nm) => {
|
item_foreign_mod(nm) => {
|
||||||
let abi = match attr::foreign_abi(i.attrs) {
|
let abi = match attr::foreign_abi(i.attrs) {
|
||||||
either::Left(msg) => cx.diag.span_fatal(i.span, msg),
|
either::Left(ref msg) => cx.diag.span_fatal(i.span, (*msg)),
|
||||||
either::Right(abi) => abi
|
either::Right(abi) => abi
|
||||||
};
|
};
|
||||||
for nm.items.each |nitem| {
|
for nm.items.each |nitem| {
|
||||||
|
@ -249,7 +249,7 @@ fn map_item(i: @item, cx: ctx, v: vt) {
|
||||||
map_struct_def(struct_def, node_item(i, item_path), i.ident, i.id, cx,
|
map_struct_def(struct_def, node_item(i, item_path), i.ident, i.id, cx,
|
||||||
v);
|
v);
|
||||||
}
|
}
|
||||||
item_trait(_, traits, methods) => {
|
item_trait(_, traits, ref methods) => {
|
||||||
// Map trait refs to their parent classes. This is
|
// Map trait refs to their parent classes. This is
|
||||||
// so we can find the self_ty
|
// so we can find the self_ty
|
||||||
for traits.each |p| {
|
for traits.each |p| {
|
||||||
|
@ -258,7 +258,7 @@ fn map_item(i: @item, cx: ctx, v: vt) {
|
||||||
// encoding/decoding
|
// encoding/decoding
|
||||||
cx.map.insert(p.impl_id, node_item(i, item_path));
|
cx.map.insert(p.impl_id, node_item(i, item_path));
|
||||||
}
|
}
|
||||||
for methods.each |tm| {
|
for (*methods).each |tm| {
|
||||||
let id = ast_util::trait_method_to_ty_method(*tm).id;
|
let id = ast_util::trait_method_to_ty_method(*tm).id;
|
||||||
let d_id = ast_util::local_def(i.id);
|
let d_id = ast_util::local_def(i.id);
|
||||||
cx.map.insert(id, node_trait_method(@*tm, d_id, item_path));
|
cx.map.insert(id, node_trait_method(@*tm, d_id, item_path));
|
||||||
|
@ -368,9 +368,9 @@ fn node_id_to_str(map: map, id: node_id, itr: @ident_interner) -> ~str {
|
||||||
fmt!("method %s in %s (id=%?)",
|
fmt!("method %s in %s (id=%?)",
|
||||||
*itr.get(m.ident), path_to_str(*path, itr), id)
|
*itr.get(m.ident), path_to_str(*path, itr), id)
|
||||||
}
|
}
|
||||||
Some(node_variant(variant, _, path)) => {
|
Some(node_variant(ref variant, _, path)) => {
|
||||||
fmt!("variant %s in %s (id=%?)",
|
fmt!("variant %s in %s (id=%?)",
|
||||||
*itr.get(variant.node.name), path_to_str(*path, itr), id)
|
*itr.get((*variant).node.name), path_to_str(*path, itr), id)
|
||||||
}
|
}
|
||||||
Some(node_expr(expr)) => {
|
Some(node_expr(expr)) => {
|
||||||
fmt!("expr %s (id=%?)", pprust::expr_to_str(expr, itr), id)
|
fmt!("expr %s (id=%?)", pprust::expr_to_str(expr, itr), id)
|
||||||
|
|
|
@ -205,8 +205,8 @@ fn is_exported(i: ident, m: _mod) -> bool {
|
||||||
for m.items.each |it| {
|
for m.items.each |it| {
|
||||||
if it.ident == i { local = true; }
|
if it.ident == i { local = true; }
|
||||||
match it.node {
|
match it.node {
|
||||||
item_enum(enum_definition, _) =>
|
item_enum(ref enum_definition, _) =>
|
||||||
for enum_definition.variants.each |v| {
|
for (*enum_definition).variants.each |v| {
|
||||||
if v.node.name == i {
|
if v.node.name == i {
|
||||||
local = true;
|
local = true;
|
||||||
parent_enum = Some(/* FIXME (#2543) */ copy it.ident);
|
parent_enum = Some(/* FIXME (#2543) */ copy it.ident);
|
||||||
|
@ -233,10 +233,10 @@ fn is_exported(i: ident, m: _mod) -> bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ast::view_path_list(path, ids, _) => {
|
ast::view_path_list(path, ref ids, _) => {
|
||||||
if vec::len(path.idents) == 1u {
|
if vec::len(path.idents) == 1u {
|
||||||
if i == path.idents[0] { return true; }
|
if i == path.idents[0] { return true; }
|
||||||
for ids.each |id| {
|
for (*ids).each |id| {
|
||||||
if id.node.name == i { return true; }
|
if id.node.name == i { return true; }
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -314,7 +314,7 @@ fn public_methods(ms: ~[@method]) -> ~[@method] {
|
||||||
// a default, pull out the useful fields to make a ty_method
|
// a default, pull out the useful fields to make a ty_method
|
||||||
fn trait_method_to_ty_method(method: trait_method) -> ty_method {
|
fn trait_method_to_ty_method(method: trait_method) -> ty_method {
|
||||||
match method {
|
match method {
|
||||||
required(m) => m,
|
required(ref m) => (*m),
|
||||||
provided(m) => {
|
provided(m) => {
|
||||||
{ident: m.ident, attrs: m.attrs,
|
{ident: m.ident, attrs: m.attrs,
|
||||||
purity: m.purity, decl: m.decl,
|
purity: m.purity, decl: m.decl,
|
||||||
|
@ -329,7 +329,7 @@ fn split_trait_methods(trait_methods: ~[trait_method])
|
||||||
let mut reqd = ~[], provd = ~[];
|
let mut reqd = ~[], provd = ~[];
|
||||||
for trait_methods.each |trt_method| {
|
for trait_methods.each |trt_method| {
|
||||||
match *trt_method {
|
match *trt_method {
|
||||||
required(tm) => reqd.push(tm),
|
required(ref tm) => reqd.push((*tm)),
|
||||||
provided(m) => provd.push(m)
|
provided(m) => provd.push(m)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -364,7 +364,7 @@ impl inlined_item: inlined_item_utils {
|
||||||
ii_item(i) => i.id,
|
ii_item(i) => i.id,
|
||||||
ii_foreign(i) => i.id,
|
ii_foreign(i) => i.id,
|
||||||
ii_method(_, m) => m.id,
|
ii_method(_, m) => m.id,
|
||||||
ii_dtor(dtor, _, _, _) => dtor.node.id
|
ii_dtor(ref dtor, _, _, _) => (*dtor).node.id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,8 +373,8 @@ impl inlined_item: inlined_item_utils {
|
||||||
ii_item(i) => (v.visit_item)(i, e, v),
|
ii_item(i) => (v.visit_item)(i, e, v),
|
||||||
ii_foreign(i) => (v.visit_foreign_item)(i, e, v),
|
ii_foreign(i) => (v.visit_foreign_item)(i, e, v),
|
||||||
ii_method(_, m) => visit::visit_method_helper(m, e, v),
|
ii_method(_, m) => visit::visit_method_helper(m, e, v),
|
||||||
ii_dtor(dtor, _, tps, parent_id) => {
|
ii_dtor(ref dtor, _, tps, parent_id) => {
|
||||||
visit::visit_class_dtor_helper(dtor, tps, parent_id, e, v);
|
visit::visit_class_dtor_helper((*dtor), tps, parent_id, e, v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -453,8 +453,8 @@ fn id_visitor(vfn: fn@(node_id)) -> visit::vt<()> {
|
||||||
visit_item: fn@(i: @item) {
|
visit_item: fn@(i: @item) {
|
||||||
vfn(i.id);
|
vfn(i.id);
|
||||||
match i.node {
|
match i.node {
|
||||||
item_enum(enum_definition, _) =>
|
item_enum(ref enum_definition, _) =>
|
||||||
for enum_definition.variants.each |v| { vfn(v.node.id); },
|
for (*enum_definition).variants.each |v| { vfn(v.node.id); },
|
||||||
_ => ()
|
_ => ()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -643,7 +643,7 @@ impl Privacy : cmp::Eq {
|
||||||
fn has_legacy_export_attr(attrs: &[attribute]) -> bool {
|
fn has_legacy_export_attr(attrs: &[attribute]) -> bool {
|
||||||
for attrs.each |attribute| {
|
for attrs.each |attribute| {
|
||||||
match attribute.node.value.node {
|
match attribute.node.value.node {
|
||||||
meta_word(w) if w == ~"legacy_exports" => {
|
meta_word(ref w) if (*w) == ~"legacy_exports" => {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
|
|
|
@ -124,9 +124,9 @@ fn get_attr_name(attr: ast::attribute) -> ~str {
|
||||||
|
|
||||||
fn get_meta_item_name(meta: @ast::meta_item) -> ~str {
|
fn get_meta_item_name(meta: @ast::meta_item) -> ~str {
|
||||||
match meta.node {
|
match meta.node {
|
||||||
ast::meta_word(n) => n,
|
ast::meta_word(ref n) => (*n),
|
||||||
ast::meta_name_value(n, _) => n,
|
ast::meta_name_value(ref n, _) => (*n),
|
||||||
ast::meta_list(n, _) => n
|
ast::meta_list(ref n, _) => (*n)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,9 +158,9 @@ fn get_meta_item_list(meta: @ast::meta_item) -> Option<~[@ast::meta_item]> {
|
||||||
*/
|
*/
|
||||||
fn get_name_value_str_pair(item: @ast::meta_item) -> Option<(~str, ~str)> {
|
fn get_name_value_str_pair(item: @ast::meta_item) -> Option<(~str, ~str)> {
|
||||||
match attr::get_meta_item_value_str(item) {
|
match attr::get_meta_item_value_str(item) {
|
||||||
Some(value) => {
|
Some(ref value) => {
|
||||||
let name = attr::get_meta_item_name(item);
|
let name = attr::get_meta_item_name(item);
|
||||||
Some((name, value))
|
Some((name, (*value)))
|
||||||
}
|
}
|
||||||
None => None
|
None => None
|
||||||
}
|
}
|
||||||
|
@ -206,12 +206,12 @@ fn contains(haystack: ~[@ast::meta_item], needle: @ast::meta_item) -> bool {
|
||||||
|
|
||||||
fn eq(a: @ast::meta_item, b: @ast::meta_item) -> bool {
|
fn eq(a: @ast::meta_item, b: @ast::meta_item) -> bool {
|
||||||
return match a.node {
|
return match a.node {
|
||||||
ast::meta_word(na) => match b.node {
|
ast::meta_word(ref na) => match b.node {
|
||||||
ast::meta_word(nb) => na == nb,
|
ast::meta_word(ref nb) => (*na) == (*nb),
|
||||||
_ => false
|
_ => false
|
||||||
},
|
},
|
||||||
ast::meta_name_value(na, va) => match b.node {
|
ast::meta_name_value(ref na, va) => match b.node {
|
||||||
ast::meta_name_value(nb, vb) => na == nb && va.node == vb.node,
|
ast::meta_name_value(ref nb, vb) => (*na) == (*nb) && va.node == vb.node,
|
||||||
_ => false
|
_ => false
|
||||||
},
|
},
|
||||||
ast::meta_list(*) => {
|
ast::meta_list(*) => {
|
||||||
|
@ -256,7 +256,7 @@ fn last_meta_item_value_str_by_name(items: ~[@ast::meta_item], name: ~str)
|
||||||
|
|
||||||
match last_meta_item_by_name(items, name) {
|
match last_meta_item_by_name(items, name) {
|
||||||
Some(item) => match attr::get_meta_item_value_str(item) {
|
Some(item) => match attr::get_meta_item_value_str(item) {
|
||||||
Some(value) => Some(value),
|
Some(ref value) => Some((*value)),
|
||||||
None => None
|
None => None
|
||||||
},
|
},
|
||||||
None => None
|
None => None
|
||||||
|
@ -281,9 +281,9 @@ fn sort_meta_items(+items: ~[@ast::meta_item]) -> ~[@ast::meta_item] {
|
||||||
pure fn lteq(ma: &@ast::meta_item, mb: &@ast::meta_item) -> bool {
|
pure fn lteq(ma: &@ast::meta_item, mb: &@ast::meta_item) -> bool {
|
||||||
pure fn key(m: &ast::meta_item) -> ~str {
|
pure fn key(m: &ast::meta_item) -> ~str {
|
||||||
match m.node {
|
match m.node {
|
||||||
ast::meta_word(name) => name,
|
ast::meta_word(ref name) => (*name),
|
||||||
ast::meta_name_value(name, _) => name,
|
ast::meta_name_value(ref name, _) => (*name),
|
||||||
ast::meta_list(name, _) => name
|
ast::meta_list(ref name, _) => (*name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
key(*ma) <= key(*mb)
|
key(*ma) <= key(*mb)
|
||||||
|
@ -334,8 +334,8 @@ fn foreign_abi(attrs: ~[ast::attribute]) -> Either<~str, ast::foreign_abi> {
|
||||||
option::Some(~"stdcall") => {
|
option::Some(~"stdcall") => {
|
||||||
either::Right(ast::foreign_abi_stdcall)
|
either::Right(ast::foreign_abi_stdcall)
|
||||||
}
|
}
|
||||||
option::Some(t) => {
|
option::Some(ref t) => {
|
||||||
either::Left(~"unsupported abi: " + t)
|
either::Left(~"unsupported abi: " + (*t))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -308,10 +308,10 @@ pub impl CodeMap {
|
||||||
self.lookup_char_pos_adj(
|
self.lookup_char_pos_adj(
|
||||||
sp.lo + (pos - loc.file.start_pos))
|
sp.lo + (pos - loc.file.start_pos))
|
||||||
}
|
}
|
||||||
FssExternal(eloc) => {
|
FssExternal(ref eloc) => {
|
||||||
{filename: /* FIXME (#2543) */ copy eloc.filename,
|
{filename: /* FIXME (#2543) */ copy (*eloc).filename,
|
||||||
line: eloc.line + loc.line - 1u,
|
line: (*eloc).line + loc.line - 1u,
|
||||||
col: if loc.line == 1u {eloc.col + loc.col} else {loc.col},
|
col: if loc.line == 1u {(*eloc).col + loc.col} else {loc.col},
|
||||||
file: None}
|
file: None}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -285,7 +285,7 @@ fn print_macro_backtrace(cm: @codemap::CodeMap, sp: span) {
|
||||||
fn expect<T: Copy>(diag: span_handler,
|
fn expect<T: Copy>(diag: span_handler,
|
||||||
opt: Option<T>, msg: fn() -> ~str) -> T {
|
opt: Option<T>, msg: fn() -> ~str) -> T {
|
||||||
match opt {
|
match opt {
|
||||||
Some(t) => t,
|
Some(ref t) => (*t),
|
||||||
None => diag.handler().bug(msg())
|
None => diag.handler().bug(msg())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,12 +120,12 @@ fn expand_auto_serialize(
|
||||||
do vec::flat_map(in_items) |item| {
|
do vec::flat_map(in_items) |item| {
|
||||||
if item.attrs.any(is_auto_serialize) {
|
if item.attrs.any(is_auto_serialize) {
|
||||||
match item.node {
|
match item.node {
|
||||||
ast::item_ty(@{node: ast::ty_rec(fields), _}, tps) => {
|
ast::item_ty(@{node: ast::ty_rec(ref fields), _}, tps) => {
|
||||||
let ser_impl = mk_rec_ser_impl(
|
let ser_impl = mk_rec_ser_impl(
|
||||||
cx,
|
cx,
|
||||||
item.span,
|
item.span,
|
||||||
item.ident,
|
item.ident,
|
||||||
fields,
|
(*fields),
|
||||||
tps
|
tps
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -142,12 +142,12 @@ fn expand_auto_serialize(
|
||||||
|
|
||||||
~[filter_attrs(*item), ser_impl]
|
~[filter_attrs(*item), ser_impl]
|
||||||
},
|
},
|
||||||
ast::item_enum(enum_def, tps) => {
|
ast::item_enum(ref enum_def, tps) => {
|
||||||
let ser_impl = mk_enum_ser_impl(
|
let ser_impl = mk_enum_ser_impl(
|
||||||
cx,
|
cx,
|
||||||
item.span,
|
item.span,
|
||||||
item.ident,
|
item.ident,
|
||||||
enum_def,
|
(*enum_def),
|
||||||
tps
|
tps
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -184,12 +184,12 @@ fn expand_auto_deserialize(
|
||||||
do vec::flat_map(in_items) |item| {
|
do vec::flat_map(in_items) |item| {
|
||||||
if item.attrs.any(is_auto_deserialize) {
|
if item.attrs.any(is_auto_deserialize) {
|
||||||
match item.node {
|
match item.node {
|
||||||
ast::item_ty(@{node: ast::ty_rec(fields), _}, tps) => {
|
ast::item_ty(@{node: ast::ty_rec(ref fields), _}, tps) => {
|
||||||
let deser_impl = mk_rec_deser_impl(
|
let deser_impl = mk_rec_deser_impl(
|
||||||
cx,
|
cx,
|
||||||
item.span,
|
item.span,
|
||||||
item.ident,
|
item.ident,
|
||||||
fields,
|
(*fields),
|
||||||
tps
|
tps
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -206,12 +206,12 @@ fn expand_auto_deserialize(
|
||||||
|
|
||||||
~[filter_attrs(*item), deser_impl]
|
~[filter_attrs(*item), deser_impl]
|
||||||
},
|
},
|
||||||
ast::item_enum(enum_def, tps) => {
|
ast::item_enum(ref enum_def, tps) => {
|
||||||
let deser_impl = mk_enum_deser_impl(
|
let deser_impl = mk_enum_deser_impl(
|
||||||
cx,
|
cx,
|
||||||
item.span,
|
item.span,
|
||||||
item.ident,
|
item.ident,
|
||||||
enum_def,
|
(*enum_def),
|
||||||
tps
|
tps
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -202,12 +202,12 @@ fn mk_ctxt(parse_sess: parse::parse_sess,
|
||||||
fn mod_path() -> ~[ast::ident] { return self.mod_path; }
|
fn mod_path() -> ~[ast::ident] { return self.mod_path; }
|
||||||
fn bt_push(ei: codemap::ExpnInfo) {
|
fn bt_push(ei: codemap::ExpnInfo) {
|
||||||
match ei {
|
match ei {
|
||||||
ExpandedFrom({call_site: cs, callie: callie}) => {
|
ExpandedFrom({call_site: cs, callie: ref callie}) => {
|
||||||
self.backtrace =
|
self.backtrace =
|
||||||
Some(@ExpandedFrom({
|
Some(@ExpandedFrom({
|
||||||
call_site: span {lo: cs.lo, hi: cs.hi,
|
call_site: span {lo: cs.lo, hi: cs.hi,
|
||||||
expn_info: self.backtrace},
|
expn_info: self.backtrace},
|
||||||
callie: callie}));
|
callie: (*callie)}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ fn expand_syntax_ext(cx: ext_ctxt, sp: codemap::span, arg: ast::mac_arg,
|
||||||
let var = expr_to_str(cx, args[0], ~"env! requires a string");
|
let var = expr_to_str(cx, args[0], ~"env! requires a string");
|
||||||
match os::getenv(var) {
|
match os::getenv(var) {
|
||||||
option::None => return mk_uniq_str(cx, sp, ~""),
|
option::None => return mk_uniq_str(cx, sp, ~""),
|
||||||
option::Some(s) => return mk_uniq_str(cx, sp, s)
|
option::Some(ref s) => return mk_uniq_str(cx, sp, (*s))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,9 +29,9 @@ fn expand_expr(exts: HashMap<~str, syntax_extension>, cx: ext_ctxt,
|
||||||
return match e {
|
return match e {
|
||||||
// expr_mac should really be expr_ext or something; it's the
|
// expr_mac should really be expr_ext or something; it's the
|
||||||
// entry-point for all syntax extensions.
|
// entry-point for all syntax extensions.
|
||||||
expr_mac(mac) => {
|
expr_mac(ref mac) => {
|
||||||
|
|
||||||
match mac.node {
|
match (*mac).node {
|
||||||
// Old-style macros. For compatibility, will erase this whole
|
// Old-style macros. For compatibility, will erase this whole
|
||||||
// block once we've transitioned.
|
// block once we've transitioned.
|
||||||
mac_invoc(pth, args, body) => {
|
mac_invoc(pth, args, body) => {
|
||||||
|
@ -50,7 +50,7 @@ fn expand_expr(exts: HashMap<~str, syntax_extension>, cx: ext_ctxt,
|
||||||
fmt!("%s can only be used as a decorator", *extname));
|
fmt!("%s can only be used as a decorator", *extname));
|
||||||
}
|
}
|
||||||
Some(normal({expander: exp, span: exp_sp})) => {
|
Some(normal({expander: exp, span: exp_sp})) => {
|
||||||
let expanded = exp(cx, mac.span, args, body);
|
let expanded = exp(cx, (*mac).span, args, body);
|
||||||
|
|
||||||
cx.bt_push(ExpandedFrom({call_site: s,
|
cx.bt_push(ExpandedFrom({call_site: s,
|
||||||
callie: {name: *extname, span: exp_sp}}));
|
callie: {name: *extname, span: exp_sp}}));
|
||||||
|
@ -61,7 +61,7 @@ fn expand_expr(exts: HashMap<~str, syntax_extension>, cx: ext_ctxt,
|
||||||
(fully_expanded, s)
|
(fully_expanded, s)
|
||||||
}
|
}
|
||||||
Some(macro_defining(ext)) => {
|
Some(macro_defining(ext)) => {
|
||||||
let named_extension = ext(cx, mac.span, args, body);
|
let named_extension = ext(cx, (*mac).span, args, body);
|
||||||
exts.insert(named_extension.name, named_extension.ext);
|
exts.insert(named_extension.name, named_extension.ext);
|
||||||
(ast::expr_rec(~[], None), s)
|
(ast::expr_rec(~[], None), s)
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ fn expand_expr(exts: HashMap<~str, syntax_extension>, cx: ext_ctxt,
|
||||||
|
|
||||||
// Token-tree macros, these will be the only case when we're
|
// Token-tree macros, these will be the only case when we're
|
||||||
// finished transitioning.
|
// finished transitioning.
|
||||||
mac_invoc_tt(pth, tts) => {
|
mac_invoc_tt(pth, ref tts) => {
|
||||||
assert (vec::len(pth.idents) == 1u);
|
assert (vec::len(pth.idents) == 1u);
|
||||||
/* using idents and token::special_idents would make the
|
/* using idents and token::special_idents would make the
|
||||||
the macro names be hygienic */
|
the macro names be hygienic */
|
||||||
|
@ -90,7 +90,7 @@ fn expand_expr(exts: HashMap<~str, syntax_extension>, cx: ext_ctxt,
|
||||||
fmt!("macro undefined: '%s'", *extname))
|
fmt!("macro undefined: '%s'", *extname))
|
||||||
}
|
}
|
||||||
Some(normal_tt({expander: exp, span: exp_sp})) => {
|
Some(normal_tt({expander: exp, span: exp_sp})) => {
|
||||||
let expanded = match exp(cx, mac.span, tts) {
|
let expanded = match exp(cx, (*mac).span, (*tts)) {
|
||||||
mr_expr(e) => e,
|
mr_expr(e) => e,
|
||||||
mr_any(expr_maker,_,_) => expr_maker(),
|
mr_any(expr_maker,_,_) => expr_maker(),
|
||||||
_ => cx.span_fatal(
|
_ => cx.span_fatal(
|
||||||
|
@ -109,8 +109,8 @@ fn expand_expr(exts: HashMap<~str, syntax_extension>, cx: ext_ctxt,
|
||||||
Some(normal({expander: exp, span: exp_sp})) => {
|
Some(normal({expander: exp, span: exp_sp})) => {
|
||||||
//convert the new-style invoc for the old-style macro
|
//convert the new-style invoc for the old-style macro
|
||||||
let arg = base::tt_args_to_original_flavor(cx, pth.span,
|
let arg = base::tt_args_to_original_flavor(cx, pth.span,
|
||||||
tts);
|
(*tts));
|
||||||
let expanded = exp(cx, mac.span, arg, None);
|
let expanded = exp(cx, (*mac).span, arg, None);
|
||||||
|
|
||||||
cx.bt_push(ExpandedFrom({call_site: s,
|
cx.bt_push(ExpandedFrom({call_site: s,
|
||||||
callie: {name: *extname, span: exp_sp}}));
|
callie: {name: *extname, span: exp_sp}}));
|
||||||
|
@ -128,7 +128,7 @@ fn expand_expr(exts: HashMap<~str, syntax_extension>, cx: ext_ctxt,
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => cx.span_bug(mac.span, ~"naked syntactic bit")
|
_ => cx.span_bug((*mac).span, ~"naked syntactic bit")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => orig(e, s, fld)
|
_ => orig(e, s, fld)
|
||||||
|
@ -158,9 +158,9 @@ fn expand_mod_items(exts: HashMap<~str, syntax_extension>, cx: ext_ctxt,
|
||||||
let new_items = do vec::flat_map(module_.items) |item| {
|
let new_items = do vec::flat_map(module_.items) |item| {
|
||||||
do vec::foldr(item.attrs, ~[*item]) |attr, items| {
|
do vec::foldr(item.attrs, ~[*item]) |attr, items| {
|
||||||
let mname = match attr.node.value.node {
|
let mname = match attr.node.value.node {
|
||||||
ast::meta_word(n) => n,
|
ast::meta_word(ref n) => (*n),
|
||||||
ast::meta_name_value(n, _) => n,
|
ast::meta_name_value(ref n, _) => (*n),
|
||||||
ast::meta_list(n, _) => n
|
ast::meta_list(ref n, _) => (*n)
|
||||||
};
|
};
|
||||||
match exts.find(mname) {
|
match exts.find(mname) {
|
||||||
None | Some(normal(_)) | Some(macro_defining(_))
|
None | Some(normal(_)) | Some(macro_defining(_))
|
||||||
|
@ -227,10 +227,10 @@ fn expand_item_mac(exts: HashMap<~str, syntax_extension>,
|
||||||
cx: ext_ctxt, &&it: @ast::item,
|
cx: ext_ctxt, &&it: @ast::item,
|
||||||
fld: ast_fold) -> Option<@ast::item> {
|
fld: ast_fold) -> Option<@ast::item> {
|
||||||
let (pth, tts) = biased_match!(
|
let (pth, tts) = biased_match!(
|
||||||
(it.node) ~ (item_mac({node: mac_invoc_tt(pth, tts), _})) else {
|
(it.node) ~ (item_mac({node: mac_invoc_tt(pth, ref tts), _})) else {
|
||||||
cx.span_bug(it.span, ~"invalid item macro invocation")
|
cx.span_bug(it.span, ~"invalid item macro invocation")
|
||||||
};
|
};
|
||||||
=> (pth, tts)
|
=> (pth, (*tts))
|
||||||
);
|
);
|
||||||
|
|
||||||
let extname = cx.parse_sess().interner.get(pth.idents[0]);
|
let extname = cx.parse_sess().interner.get(pth.idents[0]);
|
||||||
|
@ -238,22 +238,22 @@ fn expand_item_mac(exts: HashMap<~str, syntax_extension>,
|
||||||
None => cx.span_fatal(pth.span,
|
None => cx.span_fatal(pth.span,
|
||||||
fmt!("macro undefined: '%s!'", *extname)),
|
fmt!("macro undefined: '%s!'", *extname)),
|
||||||
|
|
||||||
Some(normal_tt(expand)) => {
|
Some(normal_tt(ref expand)) => {
|
||||||
if it.ident != parse::token::special_idents::invalid {
|
if it.ident != parse::token::special_idents::invalid {
|
||||||
cx.span_fatal(pth.span,
|
cx.span_fatal(pth.span,
|
||||||
fmt!("macro %s! expects no ident argument, \
|
fmt!("macro %s! expects no ident argument, \
|
||||||
given '%s'", *extname,
|
given '%s'", *extname,
|
||||||
*cx.parse_sess().interner.get(it.ident)));
|
*cx.parse_sess().interner.get(it.ident)));
|
||||||
}
|
}
|
||||||
((expand.expander)(cx, it.span, tts), expand.span)
|
(((*expand).expander)(cx, it.span, tts), (*expand).span)
|
||||||
}
|
}
|
||||||
Some(item_tt(expand)) => {
|
Some(item_tt(ref expand)) => {
|
||||||
if it.ident == parse::token::special_idents::invalid {
|
if it.ident == parse::token::special_idents::invalid {
|
||||||
cx.span_fatal(pth.span,
|
cx.span_fatal(pth.span,
|
||||||
fmt!("macro %s! expects an ident argument",
|
fmt!("macro %s! expects an ident argument",
|
||||||
*extname));
|
*extname));
|
||||||
}
|
}
|
||||||
((expand.expander)(cx, it.span, it.ident, tts), expand.span)
|
(((*expand).expander)(cx, it.span, it.ident, tts), (*expand).span)
|
||||||
}
|
}
|
||||||
_ => cx.span_fatal(
|
_ => cx.span_fatal(
|
||||||
it.span, fmt!("%s! is not legal in item position", *extname))
|
it.span, fmt!("%s! is not legal in item position", *extname))
|
||||||
|
@ -268,8 +268,8 @@ fn expand_item_mac(exts: HashMap<~str, syntax_extension>,
|
||||||
+ *extname),
|
+ *extname),
|
||||||
mr_any(_, item_maker, _) =>
|
mr_any(_, item_maker, _) =>
|
||||||
option::chain(item_maker(), |i| {fld.fold_item(i)}),
|
option::chain(item_maker(), |i| {fld.fold_item(i)}),
|
||||||
mr_def(mdef) => {
|
mr_def(ref mdef) => {
|
||||||
exts.insert(mdef.name, mdef.ext);
|
exts.insert((*mdef).name, (*mdef).ext);
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -283,11 +283,11 @@ fn expand_stmt(exts: HashMap<~str, syntax_extension>, cx: ext_ctxt,
|
||||||
-> (stmt_, span)
|
-> (stmt_, span)
|
||||||
{
|
{
|
||||||
let (mac, pth, tts, semi) = biased_match! (
|
let (mac, pth, tts, semi) = biased_match! (
|
||||||
(s) ~ (stmt_mac(mac, semi)) else return orig(s, sp, fld);
|
(s) ~ (stmt_mac(ref mac, semi)) else return orig(s, sp, fld);
|
||||||
(mac.node) ~ (mac_invoc_tt(pth, tts)) else {
|
((*mac).node) ~ (mac_invoc_tt(pth, ref tts)) else {
|
||||||
cx.span_bug(mac.span, ~"naked syntactic bit")
|
cx.span_bug((*mac).span, ~"naked syntactic bit")
|
||||||
};
|
};
|
||||||
=> (mac, pth, tts, semi));
|
=> ((*mac), pth, (*tts), semi));
|
||||||
|
|
||||||
assert(vec::len(pth.idents) == 1u);
|
assert(vec::len(pth.idents) == 1u);
|
||||||
let extname = cx.parse_sess().interner.get(pth.idents[0]);
|
let extname = cx.parse_sess().interner.get(pth.idents[0]);
|
||||||
|
|
|
@ -255,8 +255,8 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span,
|
||||||
let nargs = args.len();
|
let nargs = args.len();
|
||||||
for pieces.each |pc| {
|
for pieces.each |pc| {
|
||||||
match *pc {
|
match *pc {
|
||||||
PieceString(s) => {
|
PieceString(ref s) => {
|
||||||
piece_exprs.push(mk_uniq_str(cx, fmt_sp, s))
|
piece_exprs.push(mk_uniq_str(cx, fmt_sp, (*s)))
|
||||||
}
|
}
|
||||||
PieceConv(conv) => {
|
PieceConv(conv) => {
|
||||||
n += 1u;
|
n += 1u;
|
||||||
|
|
|
@ -50,18 +50,18 @@ impl ext_ctxt: proto::visitor<(), (), ()> {
|
||||||
fn visit_message(name: ~str, _span: span, _tys: &[@ast::Ty],
|
fn visit_message(name: ~str, _span: span, _tys: &[@ast::Ty],
|
||||||
this: state, next: next_state) {
|
this: state, next: next_state) {
|
||||||
match next {
|
match next {
|
||||||
Some({state: next, tys: next_tys}) => {
|
Some({state: ref next, tys: next_tys}) => {
|
||||||
let proto = this.proto;
|
let proto = this.proto;
|
||||||
if !proto.has_state(next) {
|
if !proto.has_state((*next)) {
|
||||||
// This should be a span fatal, but then we need to
|
// This should be a span fatal, but then we need to
|
||||||
// track span information.
|
// track span information.
|
||||||
self.span_err(
|
self.span_err(
|
||||||
proto.get_state(next).span,
|
proto.get_state((*next)).span,
|
||||||
fmt!("message %s steps to undefined state, %s",
|
fmt!("message %s steps to undefined state, %s",
|
||||||
name, next));
|
name, (*next)));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let next = proto.get_state(next);
|
let next = proto.get_state((*next));
|
||||||
|
|
||||||
if next.ty_params.len() != next_tys.len() {
|
if next.ty_params.len() != next_tys.len() {
|
||||||
self.span_err(
|
self.span_err(
|
||||||
|
|
|
@ -55,10 +55,10 @@ impl message: gen_send {
|
||||||
fn gen_send(cx: ext_ctxt, try: bool) -> @ast::item {
|
fn gen_send(cx: ext_ctxt, try: bool) -> @ast::item {
|
||||||
debug!("pipec: gen_send");
|
debug!("pipec: gen_send");
|
||||||
match self {
|
match self {
|
||||||
message(_id, span, tys, this,
|
message(ref _id, span, tys, this,
|
||||||
Some({state: next, tys: next_tys})) => {
|
Some({state: ref next, tys: next_tys})) => {
|
||||||
debug!("pipec: next state exists");
|
debug!("pipec: next state exists");
|
||||||
let next = this.proto.get_state(next);
|
let next = this.proto.get_state((*next));
|
||||||
assert next_tys.len() == next.ty_params.len();
|
assert next_tys.len() == next.ty_params.len();
|
||||||
let arg_names = tys.mapi(|i, _ty| cx.ident_of(~"x_"+i.to_str()));
|
let arg_names = tys.mapi(|i, _ty| cx.ident_of(~"x_"+i.to_str()));
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ impl message: gen_send {
|
||||||
cx.expr_block(body))
|
cx.expr_block(body))
|
||||||
}
|
}
|
||||||
|
|
||||||
message(_id, span, tys, this, None) => {
|
message(ref _id, span, tys, this, None) => {
|
||||||
debug!("pipec: no next state");
|
debug!("pipec: no next state");
|
||||||
let arg_names = tys.mapi(|i, _ty| (~"x_" + i.to_str()));
|
let arg_names = tys.mapi(|i, _ty| (~"x_" + i.to_str()));
|
||||||
|
|
||||||
|
@ -220,8 +220,8 @@ impl state: to_type_decls {
|
||||||
let message(name, span, tys, this, next) = *m;
|
let message(name, span, tys, this, next) = *m;
|
||||||
|
|
||||||
let tys = match next {
|
let tys = match next {
|
||||||
Some({state: next, tys: next_tys}) => {
|
Some({state: ref next, tys: next_tys}) => {
|
||||||
let next = this.proto.get_state(next);
|
let next = this.proto.get_state((*next));
|
||||||
let next_name = cx.str_of(next.data_name());
|
let next_name = cx.str_of(next.data_name());
|
||||||
|
|
||||||
let dir = match this.dir {
|
let dir = match this.dir {
|
||||||
|
|
|
@ -55,7 +55,7 @@ enum message {
|
||||||
impl message {
|
impl message {
|
||||||
fn name() -> ~str {
|
fn name() -> ~str {
|
||||||
match self {
|
match self {
|
||||||
message(id, _, _, _, _) => id
|
message(ref id, _, _, _, _) => (*id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,8 +113,8 @@ impl state {
|
||||||
fn reachable(f: fn(state) -> bool) {
|
fn reachable(f: fn(state) -> bool) {
|
||||||
for self.messages.each |m| {
|
for self.messages.each |m| {
|
||||||
match *m {
|
match *m {
|
||||||
message(_, _, _, _, Some({state: id, _})) => {
|
message(_, _, _, _, Some({state: ref id, _})) => {
|
||||||
let state = self.proto.get_state(id);
|
let state = self.proto.get_state((*id));
|
||||||
if !f(state) { break }
|
if !f(state) { break }
|
||||||
}
|
}
|
||||||
_ => ()
|
_ => ()
|
||||||
|
|
|
@ -69,7 +69,7 @@ impl @ast::expr: qq_helper {
|
||||||
fn visit(cx: aq_ctxt, v: vt<aq_ctxt>) {visit_expr(self, cx, v);}
|
fn visit(cx: aq_ctxt, v: vt<aq_ctxt>) {visit_expr(self, cx, v);}
|
||||||
fn extract_mac() -> Option<ast::mac_> {
|
fn extract_mac() -> Option<ast::mac_> {
|
||||||
match (self.node) {
|
match (self.node) {
|
||||||
ast::expr_mac({node: mac, _}) => Some(mac),
|
ast::expr_mac({node: ref mac, _}) => Some((*mac)),
|
||||||
_ => None
|
_ => None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ impl @ast::Ty: qq_helper {
|
||||||
fn visit(cx: aq_ctxt, v: vt<aq_ctxt>) {visit_ty(self, cx, v);}
|
fn visit(cx: aq_ctxt, v: vt<aq_ctxt>) {visit_ty(self, cx, v);}
|
||||||
fn extract_mac() -> Option<ast::mac_> {
|
fn extract_mac() -> Option<ast::mac_> {
|
||||||
match (self.node) {
|
match (self.node) {
|
||||||
ast::ty_mac({node: mac, _}) => Some(mac),
|
ast::ty_mac({node: ref mac, _}) => Some((*mac)),
|
||||||
_ => None
|
_ => None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,15 +104,15 @@ fn mk_span(cx: ext_ctxt, qsp: span, sp: span) -> @ast::expr {
|
||||||
|
|
||||||
let e_expn_info = match sp.expn_info {
|
let e_expn_info = match sp.expn_info {
|
||||||
None => build::mk_path(cx, qsp, ids_ext(cx, ~[~"None"])),
|
None => build::mk_path(cx, qsp, ids_ext(cx, ~[~"None"])),
|
||||||
Some(@codemap::ExpandedFrom(cr)) => {
|
Some(@codemap::ExpandedFrom(ref cr)) => {
|
||||||
let e_callee =
|
let e_callee =
|
||||||
build::mk_rec_e(
|
build::mk_rec_e(
|
||||||
cx, qsp,
|
cx, qsp,
|
||||||
~[{ident: id_ext(cx, ~"name"),
|
~[{ident: id_ext(cx, ~"name"),
|
||||||
ex: build::mk_uniq_str(cx, qsp,
|
ex: build::mk_uniq_str(cx, qsp,
|
||||||
cr.callie.name)},
|
(*cr).callie.name)},
|
||||||
{ident: id_ext(cx, ~"span"),
|
{ident: id_ext(cx, ~"span"),
|
||||||
ex: mk_option_span(cx, qsp, cr.callie.span)}]);
|
ex: mk_option_span(cx, qsp, (*cr).callie.span)}]);
|
||||||
|
|
||||||
let e_expn_info_ =
|
let e_expn_info_ =
|
||||||
build::mk_call(
|
build::mk_call(
|
||||||
|
@ -121,7 +121,7 @@ fn mk_span(cx: ext_ctxt, qsp: span, sp: span) -> @ast::expr {
|
||||||
~[build::mk_rec_e(
|
~[build::mk_rec_e(
|
||||||
cx, qsp,
|
cx, qsp,
|
||||||
~[{ident: id_ext(cx, ~"call_site"),
|
~[{ident: id_ext(cx, ~"call_site"),
|
||||||
ex: mk_span(cx, qsp, cr.call_site)},
|
ex: mk_span(cx, qsp, (*cr).call_site)},
|
||||||
{ident: id_ext(cx, ~"callie"),
|
{ident: id_ext(cx, ~"callie"),
|
||||||
ex: e_callee}])]);
|
ex: e_callee}])]);
|
||||||
|
|
||||||
|
@ -327,20 +327,20 @@ fn mk_token(cx: ext_ctxt, sp: span, tok: token::Token) -> @ast::expr {
|
||||||
|
|
||||||
fn mk_tt(cx: ext_ctxt, sp: span, tt: &ast::token_tree) -> @ast::expr {
|
fn mk_tt(cx: ext_ctxt, sp: span, tt: &ast::token_tree) -> @ast::expr {
|
||||||
match *tt {
|
match *tt {
|
||||||
ast::tt_tok(sp, tok) => {
|
ast::tt_tok(sp, ref tok) => {
|
||||||
let e_tok =
|
let e_tok =
|
||||||
build::mk_call(cx, sp,
|
build::mk_call(cx, sp,
|
||||||
ids_ext(cx, ~[~"tt_tok"]),
|
ids_ext(cx, ~[~"tt_tok"]),
|
||||||
~[mk_span(cx, sp, sp),
|
~[mk_span(cx, sp, sp),
|
||||||
mk_token(cx, sp, tok)]);
|
mk_token(cx, sp, (*tok))]);
|
||||||
build::mk_uniq_vec_e(cx, sp, ~[e_tok])
|
build::mk_uniq_vec_e(cx, sp, ~[e_tok])
|
||||||
}
|
}
|
||||||
|
|
||||||
ast::tt_delim(tts) => {
|
ast::tt_delim(ref tts) => {
|
||||||
let e_delim =
|
let e_delim =
|
||||||
build::mk_call(cx, sp,
|
build::mk_call(cx, sp,
|
||||||
ids_ext(cx, ~[~"tt_delim"]),
|
ids_ext(cx, ~[~"tt_delim"]),
|
||||||
~[mk_tts(cx, sp, tts)]);
|
~[mk_tts(cx, sp, (*tts))]);
|
||||||
build::mk_uniq_vec_e(cx, sp, ~[e_delim])
|
build::mk_uniq_vec_e(cx, sp, ~[e_delim])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,8 +55,8 @@ fn match_error(cx: ext_ctxt, m: matchable, expected: ~str) -> ! {
|
||||||
x.span, ~"this argument is an ident, expected " + expected),
|
x.span, ~"this argument is an ident, expected " + expected),
|
||||||
match_ty(x) => cx.span_fatal(
|
match_ty(x) => cx.span_fatal(
|
||||||
x.span, ~"this argument is a type, expected " + expected),
|
x.span, ~"this argument is a type, expected " + expected),
|
||||||
match_block(x) => cx.span_fatal(
|
match_block(ref x) => cx.span_fatal(
|
||||||
x.span, ~"this argument is a block, expected " + expected),
|
(*x).span, ~"this argument is a block, expected " + expected),
|
||||||
match_exact => cx.bug(~"what is a match_exact doing in a bindings?")
|
match_exact => cx.bug(~"what is a match_exact doing in a bindings?")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,10 +76,10 @@ fn elts_to_ell(cx: ext_ctxt, elts: ~[@expr]) ->
|
||||||
let mut res = None;
|
let mut res = None;
|
||||||
for elts.each |elt| {
|
for elts.each |elt| {
|
||||||
match elt.node {
|
match elt.node {
|
||||||
expr_mac(m) => match m.node {
|
expr_mac(ref m) => match (*m).node {
|
||||||
ast::mac_ellipsis => {
|
ast::mac_ellipsis => {
|
||||||
if res.is_some() {
|
if res.is_some() {
|
||||||
cx.span_fatal(m.span, ~"only one ellipsis allowed");
|
cx.span_fatal((*m).span, ~"only one ellipsis allowed");
|
||||||
}
|
}
|
||||||
res =
|
res =
|
||||||
Some({pre: vec::slice(elts, 0u, idx - 1u),
|
Some({pre: vec::slice(elts, 0u, idx - 1u),
|
||||||
|
@ -104,7 +104,7 @@ fn option_flatten_map<T: Copy, U: Copy>(f: fn@(T) -> Option<U>, v: ~[T]) ->
|
||||||
for v.each |elem| {
|
for v.each |elem| {
|
||||||
match f(*elem) {
|
match f(*elem) {
|
||||||
None => return None,
|
None => return None,
|
||||||
Some(fv) => res.push(fv)
|
Some(ref fv) => res.push((*fv))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Some(res);
|
return Some(res);
|
||||||
|
@ -112,7 +112,7 @@ fn option_flatten_map<T: Copy, U: Copy>(f: fn@(T) -> Option<U>, v: ~[T]) ->
|
||||||
|
|
||||||
fn a_d_map(ad: arb_depth<matchable>, f: selector) -> match_result {
|
fn a_d_map(ad: arb_depth<matchable>, f: selector) -> match_result {
|
||||||
match ad {
|
match ad {
|
||||||
leaf(x) => return f(x),
|
leaf(ref x) => return f((*x)),
|
||||||
seq(ads, span) => match option_flatten_map(|x| a_d_map(x, f), *ads) {
|
seq(ads, span) => match option_flatten_map(|x| a_d_map(x, f), *ads) {
|
||||||
None => return None,
|
None => return None,
|
||||||
Some(ts) => return Some(seq(@ts, span))
|
Some(ts) => return Some(seq(@ts, span))
|
||||||
|
@ -124,7 +124,7 @@ fn compose_sels(s1: selector, s2: selector) -> selector {
|
||||||
fn scomp(s1: selector, s2: selector, m: matchable) -> match_result {
|
fn scomp(s1: selector, s2: selector, m: matchable) -> match_result {
|
||||||
return match s1(m) {
|
return match s1(m) {
|
||||||
None => None,
|
None => None,
|
||||||
Some(matches) => a_d_map(matches, s2)
|
Some(ref matches) => a_d_map((*matches), s2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return { |x| scomp(s1, s2, x) };
|
return { |x| scomp(s1, s2, x) };
|
||||||
|
@ -172,7 +172,7 @@ fn use_selectors_to_bind(b: binders, e: @expr) -> Option<bindings> {
|
||||||
for b.real_binders.each |key, val| {
|
for b.real_binders.each |key, val| {
|
||||||
match val(match_expr(e)) {
|
match val(match_expr(e)) {
|
||||||
None => never_mind = true,
|
None => never_mind = true,
|
||||||
Some(mtc) => { res.insert(key, mtc); }
|
Some(ref mtc) => { res.insert(key, (*mtc)); }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
//HACK: `ret` doesn't work in `for each`
|
//HACK: `ret` doesn't work in `for each`
|
||||||
|
@ -231,14 +231,14 @@ fn follow_for_trans(cx: ext_ctxt, mmaybe: Option<arb_depth<matchable>>,
|
||||||
idx_path: @mut ~[uint]) -> Option<matchable> {
|
idx_path: @mut ~[uint]) -> Option<matchable> {
|
||||||
match mmaybe {
|
match mmaybe {
|
||||||
None => return None,
|
None => return None,
|
||||||
Some(m) => {
|
Some(ref m) => {
|
||||||
return match follow(m, *idx_path) {
|
return match follow((*m), *idx_path) {
|
||||||
seq(_, sp) => {
|
seq(_, sp) => {
|
||||||
cx.span_fatal(sp,
|
cx.span_fatal(sp,
|
||||||
~"syntax matched under ... but not " +
|
~"syntax matched under ... but not " +
|
||||||
~"used that way.")
|
~"used that way.")
|
||||||
}
|
}
|
||||||
leaf(m) => return Some(m)
|
leaf(ref m) => return Some((*m))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -337,7 +337,7 @@ fn transcribe_ident(cx: ext_ctxt, b: bindings, idx_path: @mut ~[uint],
|
||||||
&&i: ident, _fld: ast_fold) -> ident {
|
&&i: ident, _fld: ast_fold) -> ident {
|
||||||
return match follow_for_trans(cx, b.find(i), idx_path) {
|
return match follow_for_trans(cx, b.find(i), idx_path) {
|
||||||
Some(match_ident(a_id)) => a_id.node,
|
Some(match_ident(a_id)) => a_id.node,
|
||||||
Some(m) => match_error(cx, m, ~"an identifier"),
|
Some(ref m) => match_error(cx, (*m), ~"an identifier"),
|
||||||
None => i
|
None => i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -353,7 +353,7 @@ fn transcribe_path(cx: ext_ctxt, b: bindings, idx_path: @mut ~[uint],
|
||||||
rp: None, types: ~[]}
|
rp: None, types: ~[]}
|
||||||
}
|
}
|
||||||
Some(match_path(a_pth)) => *a_pth,
|
Some(match_path(a_pth)) => *a_pth,
|
||||||
Some(m) => match_error(cx, m, ~"a path"),
|
Some(ref m) => match_error(cx, (*m), ~"a path"),
|
||||||
None => p
|
None => p
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -380,7 +380,7 @@ fn transcribe_expr(cx: ext_ctxt, b: bindings, idx_path: @mut ~[uint],
|
||||||
}
|
}
|
||||||
Some(match_path(a_pth)) => (expr_path(a_pth), s),
|
Some(match_path(a_pth)) => (expr_path(a_pth), s),
|
||||||
Some(match_expr(a_exp)) => (a_exp.node, a_exp.span),
|
Some(match_expr(a_exp)) => (a_exp.node, a_exp.span),
|
||||||
Some(m) => match_error(cx, m, ~"an expression"),
|
Some(ref m) => match_error(cx, (*m), ~"an expression"),
|
||||||
None => orig(e, s, fld)
|
None => orig(e, s, fld)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -399,7 +399,7 @@ fn transcribe_type(cx: ext_ctxt, b: bindings, idx_path: @mut ~[uint],
|
||||||
Some(id) => {
|
Some(id) => {
|
||||||
match follow_for_trans(cx, b.find(id), idx_path) {
|
match follow_for_trans(cx, b.find(id), idx_path) {
|
||||||
Some(match_ty(ty)) => (ty.node, ty.span),
|
Some(match_ty(ty)) => (ty.node, ty.span),
|
||||||
Some(m) => match_error(cx, m, ~"a type"),
|
Some(ref m) => match_error(cx, (*m), ~"a type"),
|
||||||
None => orig(t, s, fld)
|
None => orig(t, s, fld)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -422,10 +422,10 @@ fn transcribe_block(cx: ext_ctxt, b: bindings, idx_path: @mut ~[uint],
|
||||||
return match block_to_ident(blk) {
|
return match block_to_ident(blk) {
|
||||||
Some(id) => {
|
Some(id) => {
|
||||||
match follow_for_trans(cx, b.find(id), idx_path) {
|
match follow_for_trans(cx, b.find(id), idx_path) {
|
||||||
Some(match_block(new_blk)) => (new_blk.node, new_blk.span),
|
Some(match_block(ref new_blk)) => ((*new_blk).node, (*new_blk).span),
|
||||||
|
|
||||||
// possibly allow promotion of ident/path/expr to blocks?
|
// possibly allow promotion of ident/path/expr to blocks?
|
||||||
Some(m) => match_error(cx, m, ~"a block"),
|
Some(ref m) => match_error(cx, (*m), ~"a block"),
|
||||||
None => orig(blk, s, fld)
|
None => orig(blk, s, fld)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -468,8 +468,8 @@ fn p_t_s_rec(cx: ext_ctxt, m: matchable, s: selector, b: binders) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* FIXME (#2251): handle embedded types and blocks, at least */
|
/* FIXME (#2251): handle embedded types and blocks, at least */
|
||||||
expr_mac(mac) => {
|
expr_mac(ref mac) => {
|
||||||
p_t_s_r_mac(cx, mac, s, b);
|
p_t_s_r_mac(cx, (*mac), s, b);
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
fn select(cx: ext_ctxt, m: matchable, pat: @expr) ->
|
fn select(cx: ext_ctxt, m: matchable, pat: @expr) ->
|
||||||
|
@ -548,7 +548,7 @@ fn p_t_s_r_mac(cx: ext_ctxt, mac: ast::mac, _s: selector, _b: binders) {
|
||||||
fn_m: fn(ast::mac) -> match_result) -> match_result {
|
fn_m: fn(ast::mac) -> match_result) -> match_result {
|
||||||
return match m {
|
return match m {
|
||||||
match_expr(e) => match e.node {
|
match_expr(e) => match e.node {
|
||||||
expr_mac(mac) => fn_m(mac),
|
expr_mac(ref mac) => fn_m((*mac)),
|
||||||
_ => None
|
_ => None
|
||||||
},
|
},
|
||||||
_ => cx.bug(~"broken traversal in p_t_s_r")
|
_ => cx.bug(~"broken traversal in p_t_s_r")
|
||||||
|
@ -659,15 +659,15 @@ fn add_new_extension(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
|
||||||
|
|
||||||
|
|
||||||
match elts[0u].node {
|
match elts[0u].node {
|
||||||
expr_mac(mac) => {
|
expr_mac(ref mac) => {
|
||||||
match mac.node {
|
match (*mac).node {
|
||||||
mac_invoc(pth, invoc_arg, _) => {
|
mac_invoc(pth, invoc_arg, _) => {
|
||||||
match path_to_ident(pth) {
|
match path_to_ident(pth) {
|
||||||
Some(id) => {
|
Some(id) => {
|
||||||
let id_str = cx.str_of(id);
|
let id_str = cx.str_of(id);
|
||||||
match macro_name {
|
match macro_name {
|
||||||
None => macro_name = Some(id_str),
|
None => macro_name = Some(id_str),
|
||||||
Some(other_id) => if id_str != other_id {
|
Some(ref other_id) => if id_str != (*other_id) {
|
||||||
cx.span_fatal(pth.span,
|
cx.span_fatal(pth.span,
|
||||||
~"macro name must be " +
|
~"macro name must be " +
|
||||||
~"consistent");
|
~"consistent");
|
||||||
|
@ -679,7 +679,7 @@ fn add_new_extension(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
|
||||||
}
|
}
|
||||||
let arg = match invoc_arg {
|
let arg = match invoc_arg {
|
||||||
Some(arg) => arg,
|
Some(arg) => arg,
|
||||||
None => cx.span_fatal(mac.span,
|
None => cx.span_fatal((*mac).span,
|
||||||
~"macro must have arguments")
|
~"macro must have arguments")
|
||||||
};
|
};
|
||||||
clauses.push(@{params: pattern_to_selectors(cx, arg),
|
clauses.push(@{params: pattern_to_selectors(cx, arg),
|
||||||
|
@ -689,7 +689,7 @@ fn add_new_extension(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
|
||||||
// the macro arg situation)
|
// the macro arg situation)
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
cx.span_bug(mac.span, ~"undocumented invariant in \
|
cx.span_bug((*mac).span, ~"undocumented invariant in \
|
||||||
add_extension");
|
add_extension");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -712,7 +712,7 @@ fn add_new_extension(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
|
||||||
|
|
||||||
return {name:
|
return {name:
|
||||||
match macro_name {
|
match macro_name {
|
||||||
Some(id) => id,
|
Some(ref id) => (*id),
|
||||||
None => cx.span_fatal(sp, ~"macro definition must have " +
|
None => cx.span_fatal(sp, ~"macro definition must have " +
|
||||||
~"at least one clause")
|
~"at least one clause")
|
||||||
},
|
},
|
||||||
|
|
|
@ -83,8 +83,8 @@ fn expand_include_str(cx: ext_ctxt, sp: codemap::span, arg: ast::mac_arg,
|
||||||
let res = io::read_whole_file_str(&res_rel_file(cx, sp, &Path(file)));
|
let res = io::read_whole_file_str(&res_rel_file(cx, sp, &Path(file)));
|
||||||
match res {
|
match res {
|
||||||
result::Ok(_) => { /* Continue. */ }
|
result::Ok(_) => { /* Continue. */ }
|
||||||
result::Err(e) => {
|
result::Err(ref e) => {
|
||||||
cx.parse_sess().span_diagnostic.handler().fatal(e);
|
cx.parse_sess().span_diagnostic.handler().fatal((*e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,8 +104,8 @@ fn expand_include_bin(cx: ext_ctxt, sp: codemap::span, arg: ast::mac_arg,
|
||||||
});
|
});
|
||||||
return mk_base_vec_e(cx, sp, u8_exprs);
|
return mk_base_vec_e(cx, sp, u8_exprs);
|
||||||
}
|
}
|
||||||
result::Err(e) => {
|
result::Err(ref e) => {
|
||||||
cx.parse_sess().span_diagnostic.handler().fatal(e)
|
cx.parse_sess().span_diagnostic.handler().fatal((*e))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,8 +117,8 @@ type matcher_pos = ~{
|
||||||
};
|
};
|
||||||
|
|
||||||
fn copy_up(&& mpu: matcher_pos_up) -> matcher_pos {
|
fn copy_up(&& mpu: matcher_pos_up) -> matcher_pos {
|
||||||
match mpu {
|
match &mpu {
|
||||||
matcher_pos_up(Some(mp)) => copy mp,
|
&matcher_pos_up(Some(ref mp)) => copy (*mp),
|
||||||
_ => fail
|
_ => fail
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ fn count_names(ms: &[matcher]) -> uint {
|
||||||
vec::foldl(0u, ms, |ct, m| {
|
vec::foldl(0u, ms, |ct, m| {
|
||||||
ct + match m.node {
|
ct + match m.node {
|
||||||
match_tok(_) => 0u,
|
match_tok(_) => 0u,
|
||||||
match_seq(more_ms, _, _, _, _) => count_names(more_ms),
|
match_seq(ref more_ms, _, _, _, _) => count_names((*more_ms)),
|
||||||
match_nonterminal(_,_,_) => 1u
|
match_nonterminal(_,_,_) => 1u
|
||||||
}})
|
}})
|
||||||
}
|
}
|
||||||
|
@ -184,8 +184,8 @@ fn nameize(p_s: parse_sess, ms: ~[matcher], res: ~[@named_match])
|
||||||
ret_val: HashMap<ident, @named_match>) {
|
ret_val: HashMap<ident, @named_match>) {
|
||||||
match m {
|
match m {
|
||||||
{node: match_tok(_), span: _} => (),
|
{node: match_tok(_), span: _} => (),
|
||||||
{node: match_seq(more_ms, _, _, _, _), span: _} => {
|
{node: match_seq(ref more_ms, _, _, _, _), span: _} => {
|
||||||
for more_ms.each() |next_m| { n_rec(p_s, *next_m, res, ret_val) };
|
for (*more_ms).each() |next_m| { n_rec(p_s, *next_m, res, ret_val) };
|
||||||
}
|
}
|
||||||
{node: match_nonterminal(bind_name, _, idx), span: sp} => {
|
{node: match_nonterminal(bind_name, _, idx), span: sp} => {
|
||||||
if ret_val.contains_key(bind_name) {
|
if ret_val.contains_key(bind_name) {
|
||||||
|
@ -211,8 +211,8 @@ fn parse_or_else(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader,
|
||||||
ms: ~[matcher]) -> HashMap<ident, @named_match> {
|
ms: ~[matcher]) -> HashMap<ident, @named_match> {
|
||||||
match parse(sess, cfg, rdr, ms) {
|
match parse(sess, cfg, rdr, ms) {
|
||||||
success(m) => m,
|
success(m) => m,
|
||||||
failure(sp, str) => sess.span_diagnostic.span_fatal(sp, str),
|
failure(sp, ref str) => sess.span_diagnostic.span_fatal(sp, (*str)),
|
||||||
error(sp, str) => sess.span_diagnostic.span_fatal(sp, str)
|
error(sp, ref str) => sess.span_diagnostic.span_fatal(sp, (*str))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,8 +274,8 @@ fn parse(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader, ms: ~[matcher])
|
||||||
|
|
||||||
// the *_t vars are workarounds for the lack of unary move
|
// the *_t vars are workarounds for the lack of unary move
|
||||||
match copy ei.sep {
|
match copy ei.sep {
|
||||||
Some(t) if idx == len => { // we need a separator
|
Some(ref t) if idx == len => { // we need a separator
|
||||||
if tok == t { //pass the separator
|
if tok == (*t) { //pass the separator
|
||||||
let ei_t = move ei;
|
let ei_t = move ei;
|
||||||
ei_t.idx += 1;
|
ei_t.idx += 1;
|
||||||
next_eis.push(move ei_t);
|
next_eis.push(move ei_t);
|
||||||
|
@ -293,7 +293,7 @@ fn parse(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader, ms: ~[matcher])
|
||||||
} else {
|
} else {
|
||||||
match copy ei.elts[idx].node {
|
match copy ei.elts[idx].node {
|
||||||
/* need to descend into sequence */
|
/* need to descend into sequence */
|
||||||
match_seq(matchers, sep, zero_ok,
|
match_seq(ref matchers, ref sep, zero_ok,
|
||||||
match_idx_lo, match_idx_hi) => {
|
match_idx_lo, match_idx_hi) => {
|
||||||
if zero_ok {
|
if zero_ok {
|
||||||
let new_ei = copy ei;
|
let new_ei = copy ei;
|
||||||
|
@ -310,7 +310,7 @@ fn parse(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader, ms: ~[matcher])
|
||||||
|_m| DVec::<@named_match>());
|
|_m| DVec::<@named_match>());
|
||||||
let ei_t = move ei;
|
let ei_t = move ei;
|
||||||
cur_eis.push(~{
|
cur_eis.push(~{
|
||||||
elts: matchers, sep: sep, mut idx: 0u,
|
elts: (*matchers), sep: (*sep), mut idx: 0u,
|
||||||
mut up: matcher_pos_up(Some(move ei_t)),
|
mut up: matcher_pos_up(Some(move ei_t)),
|
||||||
matches: move matches,
|
matches: move matches,
|
||||||
match_lo: match_idx_lo, match_hi: match_idx_hi,
|
match_lo: match_idx_lo, match_hi: match_idx_hi,
|
||||||
|
@ -318,9 +318,9 @@ fn parse(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader, ms: ~[matcher])
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
match_nonterminal(_,_,_) => { bb_eis.push(move ei) }
|
match_nonterminal(_,_,_) => { bb_eis.push(move ei) }
|
||||||
match_tok(t) => {
|
match_tok(ref t) => {
|
||||||
let ei_t = move ei;
|
let ei_t = move ei;
|
||||||
if t == tok {
|
if (*t) == tok {
|
||||||
ei_t.idx += 1;
|
ei_t.idx += 1;
|
||||||
next_eis.push(move ei_t);
|
next_eis.push(move ei_t);
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,17 +84,17 @@ fn add_new_extension(cx: ext_ctxt, sp: span, name: ident,
|
||||||
|
|
||||||
for lhses.eachi() |i, lhs| { // try each arm's matchers
|
for lhses.eachi() |i, lhs| { // try each arm's matchers
|
||||||
match *lhs {
|
match *lhs {
|
||||||
@matched_nonterminal(nt_matchers(mtcs)) => {
|
@matched_nonterminal(nt_matchers(ref mtcs)) => {
|
||||||
// `none` is because we're not interpolating
|
// `none` is because we're not interpolating
|
||||||
let arg_rdr = new_tt_reader(s_d, itr, None, arg) as reader;
|
let arg_rdr = new_tt_reader(s_d, itr, None, arg) as reader;
|
||||||
match parse(cx.parse_sess(), cx.cfg(), arg_rdr, mtcs) {
|
match parse(cx.parse_sess(), cx.cfg(), arg_rdr, (*mtcs)) {
|
||||||
success(named_matches) => {
|
success(named_matches) => {
|
||||||
let rhs = match rhses[i] {
|
let rhs = match rhses[i] {
|
||||||
// okay, what's your transcriber?
|
// okay, what's your transcriber?
|
||||||
@matched_nonterminal(nt_tt(@tt)) => {
|
@matched_nonterminal(nt_tt(@ref tt)) => {
|
||||||
match tt {
|
match (*tt) {
|
||||||
// cut off delimiters; don't parse 'em
|
// cut off delimiters; don't parse 'em
|
||||||
tt_delim(tts) => tts.slice(1u,tts.len()-1u),
|
tt_delim(ref tts) => (*tts).slice(1u,(*tts).len()-1u),
|
||||||
_ => cx.span_fatal(
|
_ => cx.span_fatal(
|
||||||
sp, ~"macro rhs must be delimited")
|
sp, ~"macro rhs must be delimited")
|
||||||
}
|
}
|
||||||
|
@ -113,11 +113,11 @@ fn add_new_extension(cx: ext_ctxt, sp: span, name: ident,
|
||||||
|| p.parse_item(~[/* no attrs*/]),
|
|| p.parse_item(~[/* no attrs*/]),
|
||||||
|| p.parse_stmt(~[/* no attrs*/]));
|
|| p.parse_stmt(~[/* no attrs*/]));
|
||||||
}
|
}
|
||||||
failure(sp, msg) => if sp.lo >= best_fail_spot.lo {
|
failure(sp, ref msg) => if sp.lo >= best_fail_spot.lo {
|
||||||
best_fail_spot = sp;
|
best_fail_spot = sp;
|
||||||
best_fail_msg = msg;
|
best_fail_msg = (*msg);
|
||||||
},
|
},
|
||||||
error(sp, msg) => cx.span_fatal(sp, msg)
|
error(sp, ref msg) => cx.span_fatal(sp, (*msg))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => cx.bug(~"non-matcher found in parsed lhses")
|
_ => cx.bug(~"non-matcher found in parsed lhses")
|
||||||
|
|
|
@ -130,8 +130,8 @@ fn lockstep_iter_size(t: token_tree, r: tt_reader) -> lis {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
match t {
|
match t {
|
||||||
tt_delim(tts) | tt_seq(_, tts, _, _) => {
|
tt_delim(ref tts) | tt_seq(_, ref tts, _, _) => {
|
||||||
vec::foldl(lis_unconstrained, tts, |lis, tt|
|
vec::foldl(lis_unconstrained, (*tts), |lis, tt|
|
||||||
lis_merge(lis, lockstep_iter_size(*tt, r), r))
|
lis_merge(lis, lockstep_iter_size(*tt, r), r))
|
||||||
}
|
}
|
||||||
tt_tok(*) => lis_unconstrained,
|
tt_tok(*) => lis_unconstrained,
|
||||||
|
@ -170,8 +170,8 @@ fn tt_next_token(&&r: tt_reader) -> {tok: Token, sp: span} {
|
||||||
r.cur.idx = 0u;
|
r.cur.idx = 0u;
|
||||||
r.repeat_idx[r.repeat_idx.len() - 1u] += 1u;
|
r.repeat_idx[r.repeat_idx.len() - 1u] += 1u;
|
||||||
match r.cur.sep {
|
match r.cur.sep {
|
||||||
Some(tk) => {
|
Some(ref tk) => {
|
||||||
r.cur_tok = tk; /* repeat same span, I guess */
|
r.cur_tok = (*tk); /* repeat same span, I guess */
|
||||||
return ret_val;
|
return ret_val;
|
||||||
}
|
}
|
||||||
None => ()
|
None => ()
|
||||||
|
@ -181,27 +181,27 @@ fn tt_next_token(&&r: tt_reader) -> {tok: Token, sp: span} {
|
||||||
loop { /* because it's easiest, this handles `tt_delim` not starting
|
loop { /* because it's easiest, this handles `tt_delim` not starting
|
||||||
with a `tt_tok`, even though it won't happen */
|
with a `tt_tok`, even though it won't happen */
|
||||||
match r.cur.readme[r.cur.idx] {
|
match r.cur.readme[r.cur.idx] {
|
||||||
tt_delim(tts) => {
|
tt_delim(ref tts) => {
|
||||||
r.cur = @{readme: tts, mut idx: 0u, dotdotdoted: false,
|
r.cur = @{readme: (*tts), mut idx: 0u, dotdotdoted: false,
|
||||||
sep: None, up: tt_frame_up(option::Some(r.cur)) };
|
sep: None, up: tt_frame_up(option::Some(r.cur)) };
|
||||||
// if this could be 0-length, we'd need to potentially recur here
|
// if this could be 0-length, we'd need to potentially recur here
|
||||||
}
|
}
|
||||||
tt_tok(sp, tok) => {
|
tt_tok(sp, ref tok) => {
|
||||||
r.cur_span = sp; r.cur_tok = tok;
|
r.cur_span = sp; r.cur_tok = (*tok);
|
||||||
r.cur.idx += 1u;
|
r.cur.idx += 1u;
|
||||||
return ret_val;
|
return ret_val;
|
||||||
}
|
}
|
||||||
tt_seq(sp, tts, sep, zerok) => {
|
tt_seq(sp, ref tts, ref sep, zerok) => {
|
||||||
match lockstep_iter_size(tt_seq(sp, tts, sep, zerok), r) {
|
match lockstep_iter_size(tt_seq(sp, (*tts), (*sep), zerok), r) {
|
||||||
lis_unconstrained => {
|
lis_unconstrained => {
|
||||||
r.sp_diag.span_fatal(
|
r.sp_diag.span_fatal(
|
||||||
sp, /* blame macro writer */
|
sp, /* blame macro writer */
|
||||||
~"attempted to repeat an expression containing no syntax \
|
~"attempted to repeat an expression containing no syntax \
|
||||||
variables matched as repeating at this depth");
|
variables matched as repeating at this depth");
|
||||||
}
|
}
|
||||||
lis_contradiction(msg) => { /* FIXME #2887 blame macro invoker
|
lis_contradiction(ref msg) => { /* FIXME #2887 blame macro invoker
|
||||||
instead*/
|
instead*/
|
||||||
r.sp_diag.span_fatal(sp, msg);
|
r.sp_diag.span_fatal(sp, (*msg));
|
||||||
}
|
}
|
||||||
lis_constraint(len, _) => {
|
lis_constraint(len, _) => {
|
||||||
if len == 0 {
|
if len == 0 {
|
||||||
|
@ -217,8 +217,8 @@ fn tt_next_token(&&r: tt_reader) -> {tok: Token, sp: span} {
|
||||||
} else {
|
} else {
|
||||||
r.repeat_len.push(len);
|
r.repeat_len.push(len);
|
||||||
r.repeat_idx.push(0u);
|
r.repeat_idx.push(0u);
|
||||||
r.cur = @{readme: tts, mut idx: 0u, dotdotdoted: true,
|
r.cur = @{readme: (*tts), mut idx: 0u, dotdotdoted: true,
|
||||||
sep: sep, up: tt_frame_up(option::Some(r.cur))};
|
sep: (*sep), up: tt_frame_up(option::Some(r.cur))};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -234,8 +234,8 @@ fn tt_next_token(&&r: tt_reader) -> {tok: Token, sp: span} {
|
||||||
r.cur.idx += 1u;
|
r.cur.idx += 1u;
|
||||||
return ret_val;
|
return ret_val;
|
||||||
}
|
}
|
||||||
matched_nonterminal(other_whole_nt) => {
|
matched_nonterminal(ref other_whole_nt) => {
|
||||||
r.cur_span = sp; r.cur_tok = INTERPOLATED(other_whole_nt);
|
r.cur_span = sp; r.cur_tok = INTERPOLATED((*other_whole_nt));
|
||||||
r.cur.idx += 1u;
|
r.cur.idx += 1u;
|
||||||
return ret_val;
|
return ret_val;
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,14 +89,14 @@ type ast_fold_precursor = @{
|
||||||
fn fold_meta_item_(&&mi: @meta_item, fld: ast_fold) -> @meta_item {
|
fn fold_meta_item_(&&mi: @meta_item, fld: ast_fold) -> @meta_item {
|
||||||
return @{node:
|
return @{node:
|
||||||
match mi.node {
|
match mi.node {
|
||||||
meta_word(id) => meta_word(id),
|
meta_word(ref id) => meta_word((*id)),
|
||||||
meta_list(id, mis) => {
|
meta_list(ref id, mis) => {
|
||||||
let fold_meta_item = |x|fold_meta_item_(x, fld);
|
let fold_meta_item = |x|fold_meta_item_(x, fld);
|
||||||
meta_list(/* FIXME: (#2543) */ copy id,
|
meta_list(/* FIXME: (#2543) */ copy (*id),
|
||||||
vec::map(mis, |e| fold_meta_item(*e)))
|
vec::map(mis, |e| fold_meta_item(*e)))
|
||||||
}
|
}
|
||||||
meta_name_value(id, s) => {
|
meta_name_value(ref id, s) => {
|
||||||
meta_name_value(id, /* FIXME (#2543) */ copy s)
|
meta_name_value((*id), /* FIXME (#2543) */ copy s)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
span: fld.new_span(mi.span)};
|
span: fld.new_span(mi.span)};
|
||||||
|
@ -216,21 +216,21 @@ fn noop_fold_struct_field(&&sf: @struct_field, fld: ast_fold)
|
||||||
fn noop_fold_item_underscore(i: item_, fld: ast_fold) -> item_ {
|
fn noop_fold_item_underscore(i: item_, fld: ast_fold) -> item_ {
|
||||||
return match i {
|
return match i {
|
||||||
item_const(t, e) => item_const(fld.fold_ty(t), fld.fold_expr(e)),
|
item_const(t, e) => item_const(fld.fold_ty(t), fld.fold_expr(e)),
|
||||||
item_fn(decl, purity, typms, body) => {
|
item_fn(decl, purity, typms, ref body) => {
|
||||||
item_fn(fold_fn_decl(decl, fld),
|
item_fn(fold_fn_decl(decl, fld),
|
||||||
purity,
|
purity,
|
||||||
fold_ty_params(typms, fld),
|
fold_ty_params(typms, fld),
|
||||||
fld.fold_block(body))
|
fld.fold_block((*body)))
|
||||||
}
|
}
|
||||||
item_mod(m) => item_mod(fld.fold_mod(m)),
|
item_mod(m) => item_mod(fld.fold_mod(m)),
|
||||||
item_foreign_mod(nm) => item_foreign_mod(fld.fold_foreign_mod(nm)),
|
item_foreign_mod(nm) => item_foreign_mod(fld.fold_foreign_mod(nm)),
|
||||||
item_ty(t, typms) => item_ty(fld.fold_ty(t),
|
item_ty(t, typms) => item_ty(fld.fold_ty(t),
|
||||||
fold_ty_params(typms, fld)),
|
fold_ty_params(typms, fld)),
|
||||||
item_enum(enum_definition, typms) => {
|
item_enum(ref enum_definition, typms) => {
|
||||||
item_enum(ast::enum_def({
|
item_enum(ast::enum_def({
|
||||||
variants: vec::map(enum_definition.variants,
|
variants: vec::map((*enum_definition).variants,
|
||||||
|x| fld.fold_variant(*x)),
|
|x| fld.fold_variant(*x)),
|
||||||
common: option::map(&enum_definition.common,
|
common: option::map(&(*enum_definition).common,
|
||||||
|x| fold_struct_def(*x, fld))
|
|x| fold_struct_def(*x, fld))
|
||||||
}), fold_ty_params(typms, fld))
|
}), fold_ty_params(typms, fld))
|
||||||
}
|
}
|
||||||
|
@ -244,8 +244,8 @@ fn noop_fold_item_underscore(i: item_, fld: ast_fold) -> item_ {
|
||||||
fld.fold_ty(ty),
|
fld.fold_ty(ty),
|
||||||
vec::map(*methods, |x| fld.fold_method(*x)))
|
vec::map(*methods, |x| fld.fold_method(*x)))
|
||||||
}
|
}
|
||||||
item_trait(tps, traits, methods) => {
|
item_trait(tps, traits, ref methods) => {
|
||||||
let methods = do methods.map |method| {
|
let methods = do (*methods).map |method| {
|
||||||
match *method {
|
match *method {
|
||||||
required(*) => copy *method,
|
required(*) => copy *method,
|
||||||
provided(method) => provided(fld.fold_method(method))
|
provided(method) => provided(fld.fold_method(method))
|
||||||
|
@ -255,9 +255,9 @@ fn noop_fold_item_underscore(i: item_, fld: ast_fold) -> item_ {
|
||||||
vec::map(traits, |p| fold_trait_ref(*p, fld)),
|
vec::map(traits, |p| fold_trait_ref(*p, fld)),
|
||||||
move methods)
|
move methods)
|
||||||
}
|
}
|
||||||
item_mac(m) => {
|
item_mac(ref m) => {
|
||||||
// FIXME #2888: we might actually want to do something here.
|
// FIXME #2888: we might actually want to do something here.
|
||||||
item_mac(m)
|
item_mac((*m))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -320,7 +320,7 @@ fn noop_fold_stmt(s: stmt_, fld: ast_fold) -> stmt_ {
|
||||||
stmt_decl(d, nid) => stmt_decl(fld.fold_decl(d), fld.new_id(nid)),
|
stmt_decl(d, nid) => stmt_decl(fld.fold_decl(d), fld.new_id(nid)),
|
||||||
stmt_expr(e, nid) => stmt_expr(fld.fold_expr(e), fld.new_id(nid)),
|
stmt_expr(e, nid) => stmt_expr(fld.fold_expr(e), fld.new_id(nid)),
|
||||||
stmt_semi(e, nid) => stmt_semi(fld.fold_expr(e), fld.new_id(nid)),
|
stmt_semi(e, nid) => stmt_semi(fld.fold_expr(e), fld.new_id(nid)),
|
||||||
stmt_mac(mac, semi) => stmt_mac(fold_mac(mac), semi)
|
stmt_mac(ref mac, semi) => stmt_mac(fold_mac((*mac)), semi)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -409,8 +409,8 @@ fn noop_fold_expr(e: expr_, fld: ast_fold) -> expr_ {
|
||||||
}
|
}
|
||||||
expr_repeat(expr, count, mutt) =>
|
expr_repeat(expr, count, mutt) =>
|
||||||
expr_repeat(fld.fold_expr(expr), fld.fold_expr(count), mutt),
|
expr_repeat(fld.fold_expr(expr), fld.fold_expr(count), mutt),
|
||||||
expr_rec(fields, maybe_expr) => {
|
expr_rec(ref fields, maybe_expr) => {
|
||||||
expr_rec(vec::map(fields, |x| fold_field(*x)),
|
expr_rec(vec::map((*fields), |x| fold_field(*x)),
|
||||||
option::map(&maybe_expr, |x| fld.fold_expr(*x)))
|
option::map(&maybe_expr, |x| fld.fold_expr(*x)))
|
||||||
}
|
}
|
||||||
expr_tup(elts) => expr_tup(vec::map(elts, |x| fld.fold_expr(*x))),
|
expr_tup(elts) => expr_tup(vec::map(elts, |x| fld.fold_expr(*x))),
|
||||||
|
@ -435,35 +435,35 @@ fn noop_fold_expr(e: expr_, fld: ast_fold) -> expr_ {
|
||||||
expr_lit(_) => copy e,
|
expr_lit(_) => copy e,
|
||||||
expr_cast(expr, ty) => expr_cast(fld.fold_expr(expr), ty),
|
expr_cast(expr, ty) => expr_cast(fld.fold_expr(expr), ty),
|
||||||
expr_addr_of(m, ohs) => expr_addr_of(m, fld.fold_expr(ohs)),
|
expr_addr_of(m, ohs) => expr_addr_of(m, fld.fold_expr(ohs)),
|
||||||
expr_if(cond, tr, fl) => {
|
expr_if(cond, ref tr, fl) => {
|
||||||
expr_if(fld.fold_expr(cond), fld.fold_block(tr),
|
expr_if(fld.fold_expr(cond), fld.fold_block((*tr)),
|
||||||
option::map(&fl, |x| fld.fold_expr(*x)))
|
option::map(&fl, |x| fld.fold_expr(*x)))
|
||||||
}
|
}
|
||||||
expr_while(cond, body) => {
|
expr_while(cond, ref body) => {
|
||||||
expr_while(fld.fold_expr(cond), fld.fold_block(body))
|
expr_while(fld.fold_expr(cond), fld.fold_block((*body)))
|
||||||
}
|
}
|
||||||
expr_loop(body, opt_ident) => {
|
expr_loop(ref body, opt_ident) => {
|
||||||
expr_loop(fld.fold_block(body),
|
expr_loop(fld.fold_block((*body)),
|
||||||
option::map(&opt_ident, |x| fld.fold_ident(*x)))
|
option::map(&opt_ident, |x| fld.fold_ident(*x)))
|
||||||
}
|
}
|
||||||
expr_match(expr, arms) => {
|
expr_match(expr, ref arms) => {
|
||||||
expr_match(fld.fold_expr(expr),
|
expr_match(fld.fold_expr(expr),
|
||||||
vec::map(arms, |x| fld.fold_arm(*x)))
|
vec::map((*arms), |x| fld.fold_arm(*x)))
|
||||||
}
|
}
|
||||||
expr_fn(proto, decl, body, captures) => {
|
expr_fn(proto, decl, ref body, captures) => {
|
||||||
expr_fn(proto, fold_fn_decl(decl, fld),
|
expr_fn(proto, fold_fn_decl(decl, fld),
|
||||||
fld.fold_block(body),
|
fld.fold_block((*body)),
|
||||||
@((*captures).map(|cap_item| {
|
@((*captures).map(|cap_item| {
|
||||||
@({id: fld.new_id(cap_item.id),
|
@({id: fld.new_id(cap_item.id),
|
||||||
..**cap_item})})))
|
..**cap_item})})))
|
||||||
}
|
}
|
||||||
expr_fn_block(decl, body, captures) => {
|
expr_fn_block(decl, ref body, captures) => {
|
||||||
expr_fn_block(fold_fn_decl(decl, fld), fld.fold_block(body),
|
expr_fn_block(fold_fn_decl(decl, fld), fld.fold_block((*body)),
|
||||||
@((*captures).map(|cap_item| {
|
@((*captures).map(|cap_item| {
|
||||||
@({id: fld.new_id(cap_item.id),
|
@({id: fld.new_id(cap_item.id),
|
||||||
..**cap_item})})))
|
..**cap_item})})))
|
||||||
}
|
}
|
||||||
expr_block(blk) => expr_block(fld.fold_block(blk)),
|
expr_block(ref blk) => expr_block(fld.fold_block((*blk))),
|
||||||
expr_copy(e) => expr_copy(fld.fold_expr(e)),
|
expr_copy(e) => expr_copy(fld.fold_expr(e)),
|
||||||
expr_unary_move(e) => expr_unary_move(fld.fold_expr(e)),
|
expr_unary_move(e) => expr_unary_move(fld.fold_expr(e)),
|
||||||
expr_assign(el, er) => {
|
expr_assign(el, er) => {
|
||||||
|
@ -492,10 +492,10 @@ fn noop_fold_expr(e: expr_, fld: ast_fold) -> expr_ {
|
||||||
expr_log(i, lv, e) => expr_log(i, fld.fold_expr(lv),
|
expr_log(i, lv, e) => expr_log(i, fld.fold_expr(lv),
|
||||||
fld.fold_expr(e)),
|
fld.fold_expr(e)),
|
||||||
expr_assert(e) => expr_assert(fld.fold_expr(e)),
|
expr_assert(e) => expr_assert(fld.fold_expr(e)),
|
||||||
expr_mac(mac) => expr_mac(fold_mac(mac)),
|
expr_mac(ref mac) => expr_mac(fold_mac((*mac))),
|
||||||
expr_struct(path, fields, maybe_expr) => {
|
expr_struct(path, ref fields, maybe_expr) => {
|
||||||
expr_struct(fld.fold_path(path),
|
expr_struct(fld.fold_path(path),
|
||||||
vec::map(fields, |x| fold_field(*x)),
|
vec::map((*fields), |x| fold_field(*x)),
|
||||||
option::map(&maybe_expr, |x| fld.fold_expr(*x)))
|
option::map(&maybe_expr, |x| fld.fold_expr(*x)))
|
||||||
},
|
},
|
||||||
expr_paren(ex) => expr_paren(fld.fold_expr(ex))
|
expr_paren(ex) => expr_paren(fld.fold_expr(ex))
|
||||||
|
@ -519,7 +519,7 @@ fn noop_fold_ty(t: ty_, fld: ast_fold) -> ty_ {
|
||||||
ty_vec(mt) => ty_vec(fold_mt(mt, fld)),
|
ty_vec(mt) => ty_vec(fold_mt(mt, fld)),
|
||||||
ty_ptr(mt) => ty_ptr(fold_mt(mt, fld)),
|
ty_ptr(mt) => ty_ptr(fold_mt(mt, fld)),
|
||||||
ty_rptr(region, mt) => ty_rptr(region, fold_mt(mt, fld)),
|
ty_rptr(region, mt) => ty_rptr(region, fold_mt(mt, fld)),
|
||||||
ty_rec(fields) => ty_rec(vec::map(fields, |f| fold_field(*f, fld))),
|
ty_rec(ref fields) => ty_rec(vec::map((*fields), |f| fold_field(*f, fld))),
|
||||||
ty_fn(f) =>
|
ty_fn(f) =>
|
||||||
ty_fn(@TyFn {
|
ty_fn(@TyFn {
|
||||||
proto: f.proto,
|
proto: f.proto,
|
||||||
|
@ -533,7 +533,7 @@ fn noop_fold_ty(t: ty_, fld: ast_fold) -> ty_ {
|
||||||
ty_path(path, id) => ty_path(fld.fold_path(path), fld.new_id(id)),
|
ty_path(path, id) => ty_path(fld.fold_path(path), fld.new_id(id)),
|
||||||
ty_fixed_length_vec(mt, vs) =>
|
ty_fixed_length_vec(mt, vs) =>
|
||||||
ty_fixed_length_vec(fold_mt(mt, fld), vs),
|
ty_fixed_length_vec(fold_mt(mt, fld), vs),
|
||||||
ty_mac(mac) => ty_mac(fold_mac(mac))
|
ty_mac(ref mac) => ty_mac(fold_mac((*mac)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -579,10 +579,10 @@ fn noop_fold_variant(v: variant_, fld: ast_fold) -> variant_ {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
enum_variant_kind(enum_definition) => {
|
enum_variant_kind(ref enum_definition) => {
|
||||||
let variants = vec::map(enum_definition.variants,
|
let variants = vec::map((*enum_definition).variants,
|
||||||
|x| fld.fold_variant(*x));
|
|x| fld.fold_variant(*x));
|
||||||
let common = option::map(&enum_definition.common,
|
let common = option::map(&(*enum_definition).common,
|
||||||
|x| fold_struct_def(*x, fld));
|
|x| fold_struct_def(*x, fld));
|
||||||
kind = enum_variant_kind(ast::enum_def({ variants: variants,
|
kind = enum_variant_kind(ast::enum_def({ variants: variants,
|
||||||
common: common }));
|
common: common }));
|
||||||
|
|
|
@ -199,9 +199,9 @@ impl Parser {
|
||||||
while self.token != token::GT
|
while self.token != token::GT
|
||||||
&& self.token != token::BINOP(token::SHR) {
|
&& self.token != token::BINOP(token::SHR) {
|
||||||
match sep {
|
match sep {
|
||||||
Some(t) => {
|
Some(ref t) => {
|
||||||
if first { first = false; }
|
if first { first = false; }
|
||||||
else { self.expect(t); }
|
else { self.expect((*t)); }
|
||||||
}
|
}
|
||||||
_ => ()
|
_ => ()
|
||||||
}
|
}
|
||||||
|
@ -243,9 +243,9 @@ impl Parser {
|
||||||
let mut v: ~[T] = ~[];
|
let mut v: ~[T] = ~[];
|
||||||
while self.token != ket {
|
while self.token != ket {
|
||||||
match sep.sep {
|
match sep.sep {
|
||||||
Some(t) => {
|
Some(ref t) => {
|
||||||
if first { first = false; }
|
if first { first = false; }
|
||||||
else { self.expect(t); }
|
else { self.expect((*t)); }
|
||||||
}
|
}
|
||||||
_ => ()
|
_ => ()
|
||||||
}
|
}
|
||||||
|
|
|
@ -406,9 +406,9 @@ fn scan_number(c: char, rdr: string_reader) -> token::Token {
|
||||||
num_str += ~"." + dec_part;
|
num_str += ~"." + dec_part;
|
||||||
}
|
}
|
||||||
match scan_exponent(rdr) {
|
match scan_exponent(rdr) {
|
||||||
Some(s) => {
|
Some(ref s) => {
|
||||||
is_float = true;
|
is_float = true;
|
||||||
num_str += s;
|
num_str += (*s);
|
||||||
}
|
}
|
||||||
None => ()
|
None => ()
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,7 +136,7 @@ macro_rules! maybe_whole_expr (
|
||||||
|
|
||||||
macro_rules! maybe_whole (
|
macro_rules! maybe_whole (
|
||||||
($p:expr, $constructor:ident) => ( match copy $p.token {
|
($p:expr, $constructor:ident) => ( match copy $p.token {
|
||||||
INTERPOLATED(token::$constructor(x)) => { $p.bump(); return x; }
|
INTERPOLATED(token::$constructor(ref x)) => { $p.bump(); return (*x); }
|
||||||
_ => ()
|
_ => ()
|
||||||
}) ;
|
}) ;
|
||||||
(deref $p:expr, $constructor:ident) => ( match copy $p.token {
|
(deref $p:expr, $constructor:ident) => ( match copy $p.token {
|
||||||
|
@ -155,7 +155,7 @@ macro_rules! maybe_whole (
|
||||||
_ => ()
|
_ => ()
|
||||||
}) ;
|
}) ;
|
||||||
(pair_empty $p:expr, $constructor:ident) => ( match copy $p.token {
|
(pair_empty $p:expr, $constructor:ident) => ( match copy $p.token {
|
||||||
INTERPOLATED(token::$constructor(x)) => { $p.bump(); return (~[], x); }
|
INTERPOLATED(token::$constructor(ref x)) => { $p.bump(); return (~[], (*x)); }
|
||||||
_ => ()
|
_ => ()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ pure fn maybe_append(+lhs: ~[attribute], rhs: Option<~[attribute]>)
|
||||||
-> ~[attribute] {
|
-> ~[attribute] {
|
||||||
match rhs {
|
match rhs {
|
||||||
None => lhs,
|
None => lhs,
|
||||||
Some(attrs) => vec::append(lhs, attrs)
|
Some(ref attrs) => vec::append(lhs, (*attrs))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -510,9 +510,9 @@ impl Parser {
|
||||||
let lo = self.span.lo;
|
let lo = self.span.lo;
|
||||||
|
|
||||||
match self.maybe_parse_dollar_mac() {
|
match self.maybe_parse_dollar_mac() {
|
||||||
Some(e) => {
|
Some(ref e) => {
|
||||||
return @{id: self.get_id(),
|
return @{id: self.get_id(),
|
||||||
node: ty_mac(spanned(lo, self.span.hi, e)),
|
node: ty_mac(spanned(lo, self.span.hi, (*e))),
|
||||||
span: mk_sp(lo, self.span.hi)};
|
span: mk_sp(lo, self.span.hi)};
|
||||||
}
|
}
|
||||||
None => ()
|
None => ()
|
||||||
|
@ -928,7 +928,7 @@ impl Parser {
|
||||||
let mut ex: expr_;
|
let mut ex: expr_;
|
||||||
|
|
||||||
match self.maybe_parse_dollar_mac() {
|
match self.maybe_parse_dollar_mac() {
|
||||||
Some(x) => return self.mk_mac_expr(lo, self.span.hi, x),
|
Some(ref x) => return self.mk_mac_expr(lo, self.span.hi, (*x)),
|
||||||
_ => ()
|
_ => ()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2022,7 +2022,7 @@ impl Parser {
|
||||||
pat = pat_tup(fields);
|
pat = pat_tup(fields);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tok => {
|
copy tok => {
|
||||||
if !is_ident_or_path(tok)
|
if !is_ident_or_path(tok)
|
||||||
|| self.is_keyword(~"true")
|
|| self.is_keyword(~"true")
|
||||||
|| self.is_keyword(~"false")
|
|| self.is_keyword(~"false")
|
||||||
|
@ -2284,7 +2284,7 @@ impl Parser {
|
||||||
let mut item_attrs;
|
let mut item_attrs;
|
||||||
match self.parse_outer_attrs_or_ext(first_item_attrs) {
|
match self.parse_outer_attrs_or_ext(first_item_attrs) {
|
||||||
None => item_attrs = ~[],
|
None => item_attrs = ~[],
|
||||||
Some(Left(attrs)) => item_attrs = attrs,
|
Some(Left(ref attrs)) => item_attrs = (*attrs),
|
||||||
Some(Right(ext)) => {
|
Some(Right(ext)) => {
|
||||||
return @spanned(lo, ext.span.hi,
|
return @spanned(lo, ext.span.hi,
|
||||||
stmt_expr(ext, self.get_id()));
|
stmt_expr(ext, self.get_id()));
|
||||||
|
@ -2346,8 +2346,8 @@ impl Parser {
|
||||||
let lo = self.span.lo;
|
let lo = self.span.lo;
|
||||||
let us = self.eat_keyword(~"unsafe");
|
let us = self.eat_keyword(~"unsafe");
|
||||||
self.expect(token::LBRACE);
|
self.expect(token::LBRACE);
|
||||||
let {inner, next} = maybe_parse_inner_attrs_and_next(self,
|
let {inner: move inner, next: move next} =
|
||||||
parse_attrs);
|
maybe_parse_inner_attrs_and_next(self, parse_attrs);
|
||||||
let blk_check_mode = if us { unsafe_blk } else { default_blk };
|
let blk_check_mode = if us { unsafe_blk } else { default_blk };
|
||||||
return (inner, self.parse_block_tail_(lo, blk_check_mode, next));
|
return (inner, self.parse_block_tail_(lo, blk_check_mode, next));
|
||||||
}
|
}
|
||||||
|
@ -2372,7 +2372,9 @@ impl Parser {
|
||||||
let mut stmts = ~[];
|
let mut stmts = ~[];
|
||||||
let mut expr = None;
|
let mut expr = None;
|
||||||
|
|
||||||
let {attrs_remaining, view_items, items: items, _} =
|
let {attrs_remaining: move attrs_remaining,
|
||||||
|
view_items: move view_items,
|
||||||
|
items: items, _} =
|
||||||
self.parse_items_and_view_items(first_item_attrs,
|
self.parse_items_and_view_items(first_item_attrs,
|
||||||
IMPORTS_AND_ITEMS_ALLOWED, false);
|
IMPORTS_AND_ITEMS_ALLOWED, false);
|
||||||
|
|
||||||
|
@ -2408,7 +2410,7 @@ impl Parser {
|
||||||
token::RBRACE => {
|
token::RBRACE => {
|
||||||
expr = Some(e);
|
expr = Some(e);
|
||||||
}
|
}
|
||||||
t => {
|
copy t => {
|
||||||
if classify::stmt_ends_with_semi(*stmt) {
|
if classify::stmt_ends_with_semi(*stmt) {
|
||||||
self.fatal(
|
self.fatal(
|
||||||
~"expected `;` or `}` after \
|
~"expected `;` or `}` after \
|
||||||
|
@ -2421,12 +2423,12 @@ impl Parser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stmt_mac(m, _) => {
|
stmt_mac(ref m, _) => {
|
||||||
// Statement macro; might be an expr
|
// Statement macro; might be an expr
|
||||||
match self.token {
|
match self.token {
|
||||||
token::SEMI => {
|
token::SEMI => {
|
||||||
self.bump();
|
self.bump();
|
||||||
stmts.push(@{node: stmt_mac(m, true),
|
stmts.push(@{node: stmt_mac((*m), true),
|
||||||
..*stmt});
|
..*stmt});
|
||||||
}
|
}
|
||||||
token::RBRACE => {
|
token::RBRACE => {
|
||||||
|
@ -2435,7 +2437,7 @@ impl Parser {
|
||||||
expr = Some(
|
expr = Some(
|
||||||
self.mk_mac_expr(stmt.span.lo,
|
self.mk_mac_expr(stmt.span.lo,
|
||||||
stmt.span.hi,
|
stmt.span.hi,
|
||||||
m.node));
|
(*m).node));
|
||||||
}
|
}
|
||||||
_ => { stmts.push(stmt); }
|
_ => { stmts.push(stmt); }
|
||||||
}
|
}
|
||||||
|
@ -2847,7 +2849,7 @@ impl Parser {
|
||||||
fields = ~[];
|
fields = ~[];
|
||||||
while self.token != token::RBRACE {
|
while self.token != token::RBRACE {
|
||||||
match self.parse_class_item() {
|
match self.parse_class_item() {
|
||||||
dtor_decl(blk, attrs, s) => {
|
dtor_decl(ref blk, ref attrs, s) => {
|
||||||
match the_dtor {
|
match the_dtor {
|
||||||
Some((_, _, s_first)) => {
|
Some((_, _, s_first)) => {
|
||||||
self.span_note(s, fmt!("Duplicate destructor \
|
self.span_note(s, fmt!("Duplicate destructor \
|
||||||
|
@ -2857,7 +2859,7 @@ impl Parser {
|
||||||
declared here");
|
declared here");
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
the_dtor = Some((blk, attrs, s));
|
the_dtor = Some(((*blk), (*attrs), s));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3007,7 +3009,9 @@ impl Parser {
|
||||||
fn parse_mod_items(term: token::Token,
|
fn parse_mod_items(term: token::Token,
|
||||||
+first_item_attrs: ~[attribute]) -> _mod {
|
+first_item_attrs: ~[attribute]) -> _mod {
|
||||||
// Shouldn't be any view items since we've already parsed an item attr
|
// Shouldn't be any view items since we've already parsed an item attr
|
||||||
let {attrs_remaining, view_items, items: starting_items, _} =
|
let {attrs_remaining: move attrs_remaining,
|
||||||
|
view_items: move view_items,
|
||||||
|
items: starting_items, _} =
|
||||||
self.parse_items_and_view_items(first_item_attrs,
|
self.parse_items_and_view_items(first_item_attrs,
|
||||||
VIEW_ITEMS_AND_ITEMS_ALLOWED,
|
VIEW_ITEMS_AND_ITEMS_ALLOWED,
|
||||||
true);
|
true);
|
||||||
|
@ -3076,11 +3080,11 @@ impl Parser {
|
||||||
// on the mod, then we'll go and suck in another file and merge
|
// on the mod, then we'll go and suck in another file and merge
|
||||||
// its contents
|
// its contents
|
||||||
match ::attr::first_attr_value_str_by_name(outer_attrs, ~"merge") {
|
match ::attr::first_attr_value_str_by_name(outer_attrs, ~"merge") {
|
||||||
Some(path) => {
|
Some(ref path) => {
|
||||||
let prefix = Path(
|
let prefix = Path(
|
||||||
self.sess.cm.span_to_filename(copy self.span));
|
self.sess.cm.span_to_filename(copy self.span));
|
||||||
let prefix = prefix.dir_path();
|
let prefix = prefix.dir_path();
|
||||||
let path = Path(path);
|
let path = Path((*path));
|
||||||
let (new_mod_item, new_attrs) = self.eval_src_mod_from_path(
|
let (new_mod_item, new_attrs) = self.eval_src_mod_from_path(
|
||||||
prefix, path, ~[], id_span);
|
prefix, path, ~[], id_span);
|
||||||
|
|
||||||
|
@ -3113,7 +3117,7 @@ impl Parser {
|
||||||
let file_path = match ::attr::first_attr_value_str_by_name(
|
let file_path = match ::attr::first_attr_value_str_by_name(
|
||||||
outer_attrs, ~"path") {
|
outer_attrs, ~"path") {
|
||||||
|
|
||||||
Some(d) => d,
|
Some(ref d) => (*d),
|
||||||
None => default_path
|
None => default_path
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3143,7 +3147,7 @@ impl Parser {
|
||||||
|
|
||||||
fn cdir_path_opt(default: ~str, attrs: ~[ast::attribute]) -> ~str {
|
fn cdir_path_opt(default: ~str, attrs: ~[ast::attribute]) -> ~str {
|
||||||
match ::attr::first_attr_value_str_by_name(attrs, ~"path") {
|
match ::attr::first_attr_value_str_by_name(attrs, ~"path") {
|
||||||
Some(d) => d,
|
Some(ref d) => (*d),
|
||||||
None => default
|
None => default
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3208,7 +3212,10 @@ impl Parser {
|
||||||
+first_item_attrs: ~[attribute])
|
+first_item_attrs: ~[attribute])
|
||||||
-> foreign_mod {
|
-> foreign_mod {
|
||||||
// Shouldn't be any view items since we've already parsed an item attr
|
// Shouldn't be any view items since we've already parsed an item attr
|
||||||
let {attrs_remaining, view_items, items: _, foreign_items} =
|
let {attrs_remaining: move attrs_remaining,
|
||||||
|
view_items: move view_items,
|
||||||
|
items: _,
|
||||||
|
foreign_items: move foreign_items} =
|
||||||
self.parse_items_and_view_items(first_item_attrs,
|
self.parse_items_and_view_items(first_item_attrs,
|
||||||
VIEW_ITEMS_AND_FOREIGN_ITEMS_ALLOWED,
|
VIEW_ITEMS_AND_FOREIGN_ITEMS_ALLOWED,
|
||||||
true);
|
true);
|
||||||
|
@ -3341,7 +3348,7 @@ impl Parser {
|
||||||
let mut methods: ~[@method] = ~[];
|
let mut methods: ~[@method] = ~[];
|
||||||
while self.token != token::RBRACE {
|
while self.token != token::RBRACE {
|
||||||
match self.parse_class_item() {
|
match self.parse_class_item() {
|
||||||
dtor_decl(blk, attrs, s) => {
|
dtor_decl(ref blk, ref attrs, s) => {
|
||||||
match the_dtor {
|
match the_dtor {
|
||||||
Some((_, _, s_first)) => {
|
Some((_, _, s_first)) => {
|
||||||
self.span_note(s, ~"duplicate destructor \
|
self.span_note(s, ~"duplicate destructor \
|
||||||
|
@ -3351,7 +3358,7 @@ impl Parser {
|
||||||
declared here");
|
declared here");
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
the_dtor = Some((blk, attrs, s));
|
the_dtor = Some(((*blk), (*attrs), s));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,9 +190,9 @@ fn to_str(in: @ident_interner, t: Token) -> ~str {
|
||||||
/* Other */
|
/* Other */
|
||||||
DOC_COMMENT(s) => *in.get(s),
|
DOC_COMMENT(s) => *in.get(s),
|
||||||
EOF => ~"<eof>",
|
EOF => ~"<eof>",
|
||||||
INTERPOLATED(nt) => {
|
INTERPOLATED(ref nt) => {
|
||||||
~"an interpolated " +
|
~"an interpolated " +
|
||||||
match nt {
|
match (*nt) {
|
||||||
nt_item(*) => ~"item",
|
nt_item(*) => ~"item",
|
||||||
nt_block(*) => ~"block",
|
nt_block(*) => ~"block",
|
||||||
nt_stmt(*) => ~"statement",
|
nt_stmt(*) => ~"statement",
|
||||||
|
|
|
@ -387,7 +387,7 @@ fn print_type_ex(s: ps, &&ty: @ast::Ty, print_colons: bool) {
|
||||||
print_region(s, ~"&", region, ~"/");
|
print_region(s, ~"&", region, ~"/");
|
||||||
print_mt(s, mt);
|
print_mt(s, mt);
|
||||||
}
|
}
|
||||||
ast::ty_rec(fields) => {
|
ast::ty_rec(ref fields) => {
|
||||||
word(s.s, ~"{");
|
word(s.s, ~"{");
|
||||||
fn print_field(s: ps, f: ast::ty_field) {
|
fn print_field(s: ps, f: ast::ty_field) {
|
||||||
cbox(s, indent_unit);
|
cbox(s, indent_unit);
|
||||||
|
@ -398,7 +398,7 @@ fn print_type_ex(s: ps, &&ty: @ast::Ty, print_colons: bool) {
|
||||||
end(s);
|
end(s);
|
||||||
}
|
}
|
||||||
fn get_span(f: ast::ty_field) -> codemap::span { return f.span; }
|
fn get_span(f: ast::ty_field) -> codemap::span { return f.span; }
|
||||||
commasep_cmnt(s, consistent, fields, print_field, get_span);
|
commasep_cmnt(s, consistent, (*fields), print_field, get_span);
|
||||||
word(s.s, ~",}");
|
word(s.s, ~",}");
|
||||||
}
|
}
|
||||||
ast::ty_tup(elts) => {
|
ast::ty_tup(elts) => {
|
||||||
|
@ -479,11 +479,11 @@ fn print_item(s: ps, &&item: @ast::item) {
|
||||||
end(s); // end the outer cbox
|
end(s); // end the outer cbox
|
||||||
|
|
||||||
}
|
}
|
||||||
ast::item_fn(decl, purity, typarams, body) => {
|
ast::item_fn(decl, purity, typarams, ref body) => {
|
||||||
print_fn(s, decl, Some(purity), item.ident, typarams, None,
|
print_fn(s, decl, Some(purity), item.ident, typarams, None,
|
||||||
item.vis);
|
item.vis);
|
||||||
word(s.s, ~" ");
|
word(s.s, ~" ");
|
||||||
print_block_with_attrs(s, body, item.attrs);
|
print_block_with_attrs(s, (*body), item.attrs);
|
||||||
}
|
}
|
||||||
ast::item_mod(_mod) => {
|
ast::item_mod(_mod) => {
|
||||||
head(s, visibility_qualified(item.vis, ~"mod"));
|
head(s, visibility_qualified(item.vis, ~"mod"));
|
||||||
|
@ -522,8 +522,8 @@ fn print_item(s: ps, &&item: @ast::item) {
|
||||||
word(s.s, ~";");
|
word(s.s, ~";");
|
||||||
end(s); // end the outer ibox
|
end(s); // end the outer ibox
|
||||||
}
|
}
|
||||||
ast::item_enum(enum_definition, params) => {
|
ast::item_enum(ref enum_definition, params) => {
|
||||||
print_enum_def(s, enum_definition, params, item.ident,
|
print_enum_def(s, (*enum_definition), params, item.ident,
|
||||||
item.span, item.vis);
|
item.span, item.vis);
|
||||||
}
|
}
|
||||||
ast::item_class(struct_def, tps) => {
|
ast::item_class(struct_def, tps) => {
|
||||||
|
@ -558,7 +558,7 @@ fn print_item(s: ps, &&item: @ast::item) {
|
||||||
bclose(s, item.span);
|
bclose(s, item.span);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ast::item_trait(tps, traits, methods) => {
|
ast::item_trait(tps, traits, ref methods) => {
|
||||||
head(s, visibility_qualified(item.vis, ~"trait"));
|
head(s, visibility_qualified(item.vis, ~"trait"));
|
||||||
print_ident(s, item.ident);
|
print_ident(s, item.ident);
|
||||||
print_type_params(s, tps);
|
print_type_params(s, tps);
|
||||||
|
@ -569,19 +569,19 @@ fn print_item(s: ps, &&item: @ast::item) {
|
||||||
}
|
}
|
||||||
word(s.s, ~" ");
|
word(s.s, ~" ");
|
||||||
bopen(s);
|
bopen(s);
|
||||||
for methods.each |meth| {
|
for (*methods).each |meth| {
|
||||||
print_trait_method(s, *meth);
|
print_trait_method(s, *meth);
|
||||||
}
|
}
|
||||||
bclose(s, item.span);
|
bclose(s, item.span);
|
||||||
}
|
}
|
||||||
ast::item_mac({node: ast::mac_invoc_tt(pth, tts), _}) => {
|
ast::item_mac({node: ast::mac_invoc_tt(pth, ref tts), _}) => {
|
||||||
print_visibility(s, item.vis);
|
print_visibility(s, item.vis);
|
||||||
print_path(s, pth, false);
|
print_path(s, pth, false);
|
||||||
word(s.s, ~"! ");
|
word(s.s, ~"! ");
|
||||||
print_ident(s, item.ident);
|
print_ident(s, item.ident);
|
||||||
cbox(s, indent_unit);
|
cbox(s, indent_unit);
|
||||||
popen(s);
|
popen(s);
|
||||||
for tts.each |tt| {
|
for (*tts).each |tt| {
|
||||||
print_tt(s, *tt);
|
print_tt(s, *tt);
|
||||||
}
|
}
|
||||||
pclose(s);
|
pclose(s);
|
||||||
|
@ -744,23 +744,23 @@ fn print_struct(s: ps, struct_def: @ast::struct_def, tps: ~[ast::ty_param],
|
||||||
/// expression arguments as expressions). It can be done! I think.
|
/// expression arguments as expressions). It can be done! I think.
|
||||||
fn print_tt(s: ps, tt: ast::token_tree) {
|
fn print_tt(s: ps, tt: ast::token_tree) {
|
||||||
match tt {
|
match tt {
|
||||||
ast::tt_delim(tts) => for tts.each() |tt_elt| { print_tt(s, *tt_elt); },
|
ast::tt_delim(ref tts) => for (*tts).each() |tt_elt| { print_tt(s, *tt_elt); },
|
||||||
ast::tt_tok(_, tk) => {
|
ast::tt_tok(_, ref tk) => {
|
||||||
match tk {
|
match (*tk) {
|
||||||
parse::token::IDENT(*) => { // don't let idents run together
|
parse::token::IDENT(*) => { // don't let idents run together
|
||||||
if s.s.token_tree_last_was_ident { word(s.s, ~" ") }
|
if s.s.token_tree_last_was_ident { word(s.s, ~" ") }
|
||||||
s.s.token_tree_last_was_ident = true;
|
s.s.token_tree_last_was_ident = true;
|
||||||
}
|
}
|
||||||
_ => { s.s.token_tree_last_was_ident = false; }
|
_ => { s.s.token_tree_last_was_ident = false; }
|
||||||
}
|
}
|
||||||
word(s.s, parse::token::to_str(s.intr, tk));
|
word(s.s, parse::token::to_str(s.intr, (*tk)));
|
||||||
}
|
}
|
||||||
ast::tt_seq(_, tts, sep, zerok) => {
|
ast::tt_seq(_, ref tts, ref sep, zerok) => {
|
||||||
word(s.s, ~"$(");
|
word(s.s, ~"$(");
|
||||||
for tts.each() |tt_elt| { print_tt(s, *tt_elt); }
|
for (*tts).each() |tt_elt| { print_tt(s, *tt_elt); }
|
||||||
word(s.s, ~")");
|
word(s.s, ~")");
|
||||||
match sep {
|
match (*sep) {
|
||||||
Some(tk) => word(s.s, parse::token::to_str(s.intr, tk)),
|
Some(ref tk) => word(s.s, parse::token::to_str(s.intr, (*tk))),
|
||||||
None => ()
|
None => ()
|
||||||
}
|
}
|
||||||
word(s.s, if zerok { ~"*" } else { ~"+" });
|
word(s.s, if zerok { ~"*" } else { ~"+" });
|
||||||
|
@ -792,8 +792,8 @@ fn print_variant(s: ps, v: ast::variant) {
|
||||||
head(s, ~"");
|
head(s, ~"");
|
||||||
print_struct(s, struct_def, ~[], v.node.name, v.span);
|
print_struct(s, struct_def, ~[], v.node.name, v.span);
|
||||||
}
|
}
|
||||||
ast::enum_variant_kind(enum_definition) => {
|
ast::enum_variant_kind(ref enum_definition) => {
|
||||||
print_variants(s, enum_definition.variants, v.span);
|
print_variants(s, (*enum_definition).variants, v.span);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
match v.node.disr_expr {
|
match v.node.disr_expr {
|
||||||
|
@ -818,7 +818,7 @@ fn print_ty_method(s: ps, m: ast::ty_method) {
|
||||||
|
|
||||||
fn print_trait_method(s: ps, m: ast::trait_method) {
|
fn print_trait_method(s: ps, m: ast::trait_method) {
|
||||||
match m {
|
match m {
|
||||||
required(ty_m) => print_ty_method(s, ty_m),
|
required(ref ty_m) => print_ty_method(s, (*ty_m)),
|
||||||
provided(m) => print_method(s, m)
|
provided(m) => print_method(s, m)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -892,9 +892,9 @@ fn print_stmt(s: ps, st: ast::stmt) {
|
||||||
print_expr(s, expr);
|
print_expr(s, expr);
|
||||||
word(s.s, ~";");
|
word(s.s, ~";");
|
||||||
}
|
}
|
||||||
ast::stmt_mac(mac, semi) => {
|
ast::stmt_mac(ref mac, semi) => {
|
||||||
space_if_not_bol(s);
|
space_if_not_bol(s);
|
||||||
print_mac(s, mac);
|
print_mac(s, (*mac));
|
||||||
if semi { word(s.s, ~";"); }
|
if semi { word(s.s, ~";"); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -974,21 +974,21 @@ fn print_if(s: ps, test: @ast::expr, blk: ast::blk,
|
||||||
Some(_else) => {
|
Some(_else) => {
|
||||||
match _else.node {
|
match _else.node {
|
||||||
// "another else-if"
|
// "another else-if"
|
||||||
ast::expr_if(i, t, e) => {
|
ast::expr_if(i, ref t, e) => {
|
||||||
cbox(s, indent_unit - 1u);
|
cbox(s, indent_unit - 1u);
|
||||||
ibox(s, 0u);
|
ibox(s, 0u);
|
||||||
word(s.s, ~" else if ");
|
word(s.s, ~" else if ");
|
||||||
print_expr(s, i);
|
print_expr(s, i);
|
||||||
space(s.s);
|
space(s.s);
|
||||||
print_block(s, t);
|
print_block(s, (*t));
|
||||||
do_else(s, e);
|
do_else(s, e);
|
||||||
}
|
}
|
||||||
// "final else"
|
// "final else"
|
||||||
ast::expr_block(b) => {
|
ast::expr_block(ref b) => {
|
||||||
cbox(s, indent_unit - 1u);
|
cbox(s, indent_unit - 1u);
|
||||||
ibox(s, 0u);
|
ibox(s, 0u);
|
||||||
word(s.s, ~" else ");
|
word(s.s, ~" else ");
|
||||||
print_block(s, b);
|
print_block(s, (*b));
|
||||||
}
|
}
|
||||||
// BLEAH, constraints would be great here
|
// BLEAH, constraints would be great here
|
||||||
_ => {
|
_ => {
|
||||||
|
@ -1014,11 +1014,11 @@ fn print_mac(s: ps, m: ast::mac) {
|
||||||
arg.iter(|a| print_expr(s, *a));
|
arg.iter(|a| print_expr(s, *a));
|
||||||
// FIXME: extension 'body' (#2339)
|
// FIXME: extension 'body' (#2339)
|
||||||
}
|
}
|
||||||
ast::mac_invoc_tt(pth, tts) => {
|
ast::mac_invoc_tt(pth, ref tts) => {
|
||||||
print_path(s, pth, false);
|
print_path(s, pth, false);
|
||||||
word(s.s, ~"!");
|
word(s.s, ~"!");
|
||||||
popen(s);
|
popen(s);
|
||||||
for tts.each() |tt| { print_tt(s, *tt); }
|
for (*tts).each() |tt| { print_tt(s, *tt); }
|
||||||
pclose(s);
|
pclose(s);
|
||||||
}
|
}
|
||||||
ast::mac_ellipsis => word(s.s, ~"..."),
|
ast::mac_ellipsis => word(s.s, ~"..."),
|
||||||
|
@ -1149,9 +1149,9 @@ fn print_expr(s: ps, &&expr: @ast::expr) {
|
||||||
end(s);
|
end(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
ast::expr_rec(fields, wth) => {
|
ast::expr_rec(ref fields, wth) => {
|
||||||
word(s.s, ~"{");
|
word(s.s, ~"{");
|
||||||
commasep_cmnt(s, consistent, fields, print_field, get_span);
|
commasep_cmnt(s, consistent, (*fields), print_field, get_span);
|
||||||
match wth {
|
match wth {
|
||||||
Some(expr) => {
|
Some(expr) => {
|
||||||
ibox(s, indent_unit);
|
ibox(s, indent_unit);
|
||||||
|
@ -1165,13 +1165,13 @@ fn print_expr(s: ps, &&expr: @ast::expr) {
|
||||||
}
|
}
|
||||||
word(s.s, ~"}");
|
word(s.s, ~"}");
|
||||||
}
|
}
|
||||||
ast::expr_struct(path, fields, wth) => {
|
ast::expr_struct(path, ref fields, wth) => {
|
||||||
print_path(s, path, true);
|
print_path(s, path, true);
|
||||||
word(s.s, ~"{");
|
word(s.s, ~"{");
|
||||||
commasep_cmnt(s, consistent, fields, print_field, get_span);
|
commasep_cmnt(s, consistent, (*fields), print_field, get_span);
|
||||||
match wth {
|
match wth {
|
||||||
Some(expr) => {
|
Some(expr) => {
|
||||||
if vec::len(fields) > 0u { space(s.s); }
|
if vec::len((*fields)) > 0u { space(s.s); }
|
||||||
ibox(s, indent_unit);
|
ibox(s, indent_unit);
|
||||||
word(s.s, ~",");
|
word(s.s, ~",");
|
||||||
space(s.s);
|
space(s.s);
|
||||||
|
@ -1229,33 +1229,33 @@ fn print_expr(s: ps, &&expr: @ast::expr) {
|
||||||
word_space(s, ~"as");
|
word_space(s, ~"as");
|
||||||
print_type_ex(s, ty, true);
|
print_type_ex(s, ty, true);
|
||||||
}
|
}
|
||||||
ast::expr_if(test, blk, elseopt) => {
|
ast::expr_if(test, ref blk, elseopt) => {
|
||||||
print_if(s, test, blk, elseopt, false);
|
print_if(s, test, (*blk), elseopt, false);
|
||||||
}
|
}
|
||||||
ast::expr_while(test, blk) => {
|
ast::expr_while(test, ref blk) => {
|
||||||
head(s, ~"while");
|
head(s, ~"while");
|
||||||
print_expr(s, test);
|
print_expr(s, test);
|
||||||
space(s.s);
|
space(s.s);
|
||||||
print_block(s, blk);
|
print_block(s, (*blk));
|
||||||
}
|
}
|
||||||
ast::expr_loop(blk, opt_ident) => {
|
ast::expr_loop(ref blk, opt_ident) => {
|
||||||
head(s, ~"loop");
|
head(s, ~"loop");
|
||||||
space(s.s);
|
space(s.s);
|
||||||
opt_ident.iter(|ident| {
|
opt_ident.iter(|ident| {
|
||||||
print_ident(s, *ident);
|
print_ident(s, *ident);
|
||||||
word_space(s, ~":");
|
word_space(s, ~":");
|
||||||
});
|
});
|
||||||
print_block(s, blk);
|
print_block(s, (*blk));
|
||||||
}
|
}
|
||||||
ast::expr_match(expr, arms) => {
|
ast::expr_match(expr, ref arms) => {
|
||||||
cbox(s, alt_indent_unit);
|
cbox(s, alt_indent_unit);
|
||||||
ibox(s, 4);
|
ibox(s, 4);
|
||||||
word_nbsp(s, ~"match");
|
word_nbsp(s, ~"match");
|
||||||
print_expr(s, expr);
|
print_expr(s, expr);
|
||||||
space(s.s);
|
space(s.s);
|
||||||
bopen(s);
|
bopen(s);
|
||||||
let len = arms.len();
|
let len = (*arms).len();
|
||||||
for arms.eachi |i, arm| {
|
for (*arms).eachi |i, arm| {
|
||||||
space(s.s);
|
space(s.s);
|
||||||
cbox(s, alt_indent_unit);
|
cbox(s, alt_indent_unit);
|
||||||
ibox(s, 0u);
|
ibox(s, 0u);
|
||||||
|
@ -1287,10 +1287,10 @@ fn print_expr(s: ps, &&expr: @ast::expr) {
|
||||||
match arm.body.node.expr {
|
match arm.body.node.expr {
|
||||||
Some(expr) => {
|
Some(expr) => {
|
||||||
match expr.node {
|
match expr.node {
|
||||||
ast::expr_block(blk) => {
|
ast::expr_block(ref blk) => {
|
||||||
// the block will close the pattern's ibox
|
// the block will close the pattern's ibox
|
||||||
print_block_unclosed_indent(
|
print_block_unclosed_indent(
|
||||||
s, blk, alt_indent_unit);
|
s, (*blk), alt_indent_unit);
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
end(s); // close the ibox for the pattern
|
end(s); // close the ibox for the pattern
|
||||||
|
@ -1312,7 +1312,7 @@ fn print_expr(s: ps, &&expr: @ast::expr) {
|
||||||
}
|
}
|
||||||
bclose_(s, expr.span, alt_indent_unit);
|
bclose_(s, expr.span, alt_indent_unit);
|
||||||
}
|
}
|
||||||
ast::expr_fn(proto, decl, body, cap_clause) => {
|
ast::expr_fn(proto, decl, ref body, cap_clause) => {
|
||||||
// containing cbox, will be closed by print-block at }
|
// containing cbox, will be closed by print-block at }
|
||||||
cbox(s, indent_unit);
|
cbox(s, indent_unit);
|
||||||
// head-box, will be closed by print-block at start
|
// head-box, will be closed by print-block at start
|
||||||
|
@ -1321,9 +1321,9 @@ fn print_expr(s: ps, &&expr: @ast::expr) {
|
||||||
Some(proto), ast::inherited);
|
Some(proto), ast::inherited);
|
||||||
print_fn_args_and_ret(s, decl, *cap_clause, None);
|
print_fn_args_and_ret(s, decl, *cap_clause, None);
|
||||||
space(s.s);
|
space(s.s);
|
||||||
print_block(s, body);
|
print_block(s, (*body));
|
||||||
}
|
}
|
||||||
ast::expr_fn_block(decl, body, cap_clause) => {
|
ast::expr_fn_block(decl, ref body, cap_clause) => {
|
||||||
// in do/for blocks we don't want to show an empty
|
// in do/for blocks we don't want to show an empty
|
||||||
// argument list, but at this point we don't know which
|
// argument list, but at this point we don't know which
|
||||||
// we are inside.
|
// we are inside.
|
||||||
|
@ -1332,16 +1332,16 @@ fn print_expr(s: ps, &&expr: @ast::expr) {
|
||||||
print_fn_block_args(s, decl, *cap_clause);
|
print_fn_block_args(s, decl, *cap_clause);
|
||||||
space(s.s);
|
space(s.s);
|
||||||
// }
|
// }
|
||||||
assert body.node.stmts.is_empty();
|
assert (*body).node.stmts.is_empty();
|
||||||
assert body.node.expr.is_some();
|
assert (*body).node.expr.is_some();
|
||||||
// we extract the block, so as not to create another set of boxes
|
// we extract the block, so as not to create another set of boxes
|
||||||
match body.node.expr.get().node {
|
match (*body).node.expr.get().node {
|
||||||
ast::expr_block(blk) => {
|
ast::expr_block(ref blk) => {
|
||||||
print_block_unclosed(s, blk);
|
print_block_unclosed(s, (*blk));
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
// this is a bare expression
|
// this is a bare expression
|
||||||
print_expr(s, body.node.expr.get());
|
print_expr(s, (*body).node.expr.get());
|
||||||
end(s); // need to close a box
|
end(s); // need to close a box
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1356,12 +1356,12 @@ fn print_expr(s: ps, &&expr: @ast::expr) {
|
||||||
ast::expr_do_body(body) => {
|
ast::expr_do_body(body) => {
|
||||||
print_expr(s, body);
|
print_expr(s, body);
|
||||||
}
|
}
|
||||||
ast::expr_block(blk) => {
|
ast::expr_block(ref blk) => {
|
||||||
// containing cbox, will be closed by print-block at }
|
// containing cbox, will be closed by print-block at }
|
||||||
cbox(s, indent_unit);
|
cbox(s, indent_unit);
|
||||||
// head-box, will be closed by print-block after {
|
// head-box, will be closed by print-block after {
|
||||||
ibox(s, 0u);
|
ibox(s, 0u);
|
||||||
print_block(s, blk);
|
print_block(s, (*blk));
|
||||||
}
|
}
|
||||||
ast::expr_copy(e) => { word_space(s, ~"copy"); print_expr(s, e); }
|
ast::expr_copy(e) => { word_space(s, ~"copy"); print_expr(s, e); }
|
||||||
ast::expr_unary_move(e) => {
|
ast::expr_unary_move(e) => {
|
||||||
|
@ -1447,7 +1447,7 @@ fn print_expr(s: ps, &&expr: @ast::expr) {
|
||||||
word_nbsp(s, ~"assert");
|
word_nbsp(s, ~"assert");
|
||||||
print_expr(s, expr);
|
print_expr(s, expr);
|
||||||
}
|
}
|
||||||
ast::expr_mac(m) => print_mac(s, m),
|
ast::expr_mac(ref m) => print_mac(s, (*m)),
|
||||||
ast::expr_paren(e) => {
|
ast::expr_paren(e) => {
|
||||||
popen(s);
|
popen(s);
|
||||||
print_expr(s, e);
|
print_expr(s, e);
|
||||||
|
@ -1768,14 +1768,14 @@ fn print_type_params(s: ps, &¶ms: ~[ast::ty_param]) {
|
||||||
fn print_meta_item(s: ps, &&item: @ast::meta_item) {
|
fn print_meta_item(s: ps, &&item: @ast::meta_item) {
|
||||||
ibox(s, indent_unit);
|
ibox(s, indent_unit);
|
||||||
match item.node {
|
match item.node {
|
||||||
ast::meta_word(name) => word(s.s, name),
|
ast::meta_word(ref name) => word(s.s, (*name)),
|
||||||
ast::meta_name_value(name, value) => {
|
ast::meta_name_value(ref name, value) => {
|
||||||
word_space(s, name);
|
word_space(s, (*name));
|
||||||
word_space(s, ~"=");
|
word_space(s, ~"=");
|
||||||
print_literal(s, @value);
|
print_literal(s, @value);
|
||||||
}
|
}
|
||||||
ast::meta_list(name, items) => {
|
ast::meta_list(ref name, items) => {
|
||||||
word(s.s, name);
|
word(s.s, (*name));
|
||||||
popen(s);
|
popen(s);
|
||||||
commasep(s, consistent, items, print_meta_item);
|
commasep(s, consistent, items, print_meta_item);
|
||||||
pclose(s);
|
pclose(s);
|
||||||
|
@ -1803,10 +1803,10 @@ fn print_view_path(s: ps, &&vp: @ast::view_path) {
|
||||||
word(s.s, ~"::*");
|
word(s.s, ~"::*");
|
||||||
}
|
}
|
||||||
|
|
||||||
ast::view_path_list(path, idents, _) => {
|
ast::view_path_list(path, ref idents, _) => {
|
||||||
print_path(s, path, false);
|
print_path(s, path, false);
|
||||||
word(s.s, ~"::{");
|
word(s.s, ~"::{");
|
||||||
do commasep(s, inconsistent, idents) |s, w| {
|
do commasep(s, inconsistent, (*idents)) |s, w| {
|
||||||
print_ident(s, w.node.name);
|
print_ident(s, w.node.name);
|
||||||
}
|
}
|
||||||
word(s.s, ~"}");
|
word(s.s, ~"}");
|
||||||
|
@ -1948,15 +1948,15 @@ fn maybe_print_trailing_comment(s: ps, span: codemap::span,
|
||||||
let mut cm;
|
let mut cm;
|
||||||
match s.cm { Some(ccm) => cm = ccm, _ => return }
|
match s.cm { Some(ccm) => cm = ccm, _ => return }
|
||||||
match next_comment(s) {
|
match next_comment(s) {
|
||||||
Some(cmnt) => {
|
Some(ref cmnt) => {
|
||||||
if cmnt.style != comments::trailing { return; }
|
if (*cmnt).style != comments::trailing { return; }
|
||||||
let span_line = cm.lookup_char_pos(span.hi);
|
let span_line = cm.lookup_char_pos(span.hi);
|
||||||
let comment_line = cm.lookup_char_pos(cmnt.pos);
|
let comment_line = cm.lookup_char_pos((*cmnt).pos);
|
||||||
let mut next = cmnt.pos + BytePos(1u);
|
let mut next = (*cmnt).pos + BytePos(1u);
|
||||||
match next_pos { None => (), Some(p) => next = p }
|
match next_pos { None => (), Some(p) => next = p }
|
||||||
if span.hi < cmnt.pos && cmnt.pos < next &&
|
if span.hi < (*cmnt).pos && (*cmnt).pos < next &&
|
||||||
span_line.line == comment_line.line {
|
span_line.line == comment_line.line {
|
||||||
print_comment(s, cmnt);
|
print_comment(s, (*cmnt));
|
||||||
s.cur_cmnt += 1u;
|
s.cur_cmnt += 1u;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1970,7 +1970,7 @@ fn print_remaining_comments(s: ps) {
|
||||||
if next_comment(s).is_none() { hardbreak(s.s); }
|
if next_comment(s).is_none() { hardbreak(s.s); }
|
||||||
loop {
|
loop {
|
||||||
match next_comment(s) {
|
match next_comment(s) {
|
||||||
Some(cmnt) => { print_comment(s, cmnt); s.cur_cmnt += 1u; }
|
Some(ref cmnt) => { print_comment(s, (*cmnt)); s.cur_cmnt += 1u; }
|
||||||
_ => break
|
_ => break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1979,8 +1979,8 @@ fn print_remaining_comments(s: ps) {
|
||||||
fn print_literal(s: ps, &&lit: @ast::lit) {
|
fn print_literal(s: ps, &&lit: @ast::lit) {
|
||||||
maybe_print_comment(s, lit.span.lo);
|
maybe_print_comment(s, lit.span.lo);
|
||||||
match next_lit(s, lit.span.lo) {
|
match next_lit(s, lit.span.lo) {
|
||||||
Some(ltrl) => {
|
Some(ref ltrl) => {
|
||||||
word(s.s, ltrl.lit);
|
word(s.s, (*ltrl).lit);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_ => ()
|
_ => ()
|
||||||
|
@ -2030,9 +2030,9 @@ fn lit_to_str(l: @ast::lit) -> ~str {
|
||||||
|
|
||||||
fn next_lit(s: ps, pos: BytePos) -> Option<comments::lit> {
|
fn next_lit(s: ps, pos: BytePos) -> Option<comments::lit> {
|
||||||
match s.literals {
|
match s.literals {
|
||||||
Some(lits) => {
|
Some(ref lits) => {
|
||||||
while s.cur_lit < vec::len(lits) {
|
while s.cur_lit < vec::len((*lits)) {
|
||||||
let ltrl = lits[s.cur_lit];
|
let ltrl = (*lits)[s.cur_lit];
|
||||||
if ltrl.pos > pos { return None; }
|
if ltrl.pos > pos { return None; }
|
||||||
s.cur_lit += 1u;
|
s.cur_lit += 1u;
|
||||||
if ltrl.pos == pos { return Some(ltrl); }
|
if ltrl.pos == pos { return Some(ltrl); }
|
||||||
|
@ -2046,9 +2046,9 @@ fn next_lit(s: ps, pos: BytePos) -> Option<comments::lit> {
|
||||||
fn maybe_print_comment(s: ps, pos: BytePos) {
|
fn maybe_print_comment(s: ps, pos: BytePos) {
|
||||||
loop {
|
loop {
|
||||||
match next_comment(s) {
|
match next_comment(s) {
|
||||||
Some(cmnt) => {
|
Some(ref cmnt) => {
|
||||||
if cmnt.pos < pos {
|
if (*cmnt).pos < pos {
|
||||||
print_comment(s, cmnt);
|
print_comment(s, (*cmnt));
|
||||||
s.cur_cmnt += 1u;
|
s.cur_cmnt += 1u;
|
||||||
} else { break; }
|
} else { break; }
|
||||||
}
|
}
|
||||||
|
@ -2117,9 +2117,9 @@ fn to_str<T>(t: T, f: fn@(ps, T), intr: @ident_interner) -> ~str {
|
||||||
|
|
||||||
fn next_comment(s: ps) -> Option<comments::cmnt> {
|
fn next_comment(s: ps) -> Option<comments::cmnt> {
|
||||||
match s.comments {
|
match s.comments {
|
||||||
Some(cmnts) => {
|
Some(ref cmnts) => {
|
||||||
if s.cur_cmnt < vec::len(cmnts) {
|
if s.cur_cmnt < vec::len((*cmnts)) {
|
||||||
return Some(cmnts[s.cur_cmnt]);
|
return Some((*cmnts)[s.cur_cmnt]);
|
||||||
} else { return None::<comments::cmnt>; }
|
} else { return None::<comments::cmnt>; }
|
||||||
}
|
}
|
||||||
_ => return None::<comments::cmnt>
|
_ => return None::<comments::cmnt>
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#[allow(vecs_implicitly_copyable)];
|
#[allow(vecs_implicitly_copyable)];
|
||||||
#[allow(non_camel_case_types)];
|
#[allow(non_camel_case_types)];
|
||||||
#[allow(deprecated_mode)];
|
#[allow(deprecated_mode)];
|
||||||
#[allow(deprecated_pattern)];
|
#[warn(deprecated_pattern)];
|
||||||
|
|
||||||
extern mod core(vers = "0.5");
|
extern mod core(vers = "0.5");
|
||||||
extern mod std(vers = "0.5");
|
extern mod std(vers = "0.5");
|
||||||
|
|
|
@ -125,10 +125,10 @@ fn visit_item<E>(i: @item, e: E, v: vt<E>) {
|
||||||
(v.visit_ty)(t, e, v);
|
(v.visit_ty)(t, e, v);
|
||||||
(v.visit_expr)(ex, e, v);
|
(v.visit_expr)(ex, e, v);
|
||||||
}
|
}
|
||||||
item_fn(decl, purity, tp, body) => {
|
item_fn(decl, purity, tp, ref body) => {
|
||||||
(v.visit_fn)(fk_item_fn(/* FIXME (#2543) */ copy i.ident,
|
(v.visit_fn)(fk_item_fn(/* FIXME (#2543) */ copy i.ident,
|
||||||
/* FIXME (#2543) */ copy tp,
|
/* FIXME (#2543) */ copy tp,
|
||||||
purity), decl, body,
|
purity), decl, (*body),
|
||||||
i.span, i.id, e, v);
|
i.span, i.id, e, v);
|
||||||
}
|
}
|
||||||
item_mod(m) => (v.visit_mod)(m, i.span, i.id, e, v),
|
item_mod(m) => (v.visit_mod)(m, i.span, i.id, e, v),
|
||||||
|
@ -140,9 +140,9 @@ fn visit_item<E>(i: @item, e: E, v: vt<E>) {
|
||||||
(v.visit_ty)(t, e, v);
|
(v.visit_ty)(t, e, v);
|
||||||
(v.visit_ty_params)(tps, e, v);
|
(v.visit_ty_params)(tps, e, v);
|
||||||
}
|
}
|
||||||
item_enum(enum_definition, tps) => {
|
item_enum(ref enum_definition, tps) => {
|
||||||
(v.visit_ty_params)(tps, e, v);
|
(v.visit_ty_params)(tps, e, v);
|
||||||
visit_enum_def(enum_definition, tps, e, v);
|
visit_enum_def((*enum_definition), tps, e, v);
|
||||||
}
|
}
|
||||||
item_impl(tps, traits, ty, methods) => {
|
item_impl(tps, traits, ty, methods) => {
|
||||||
(v.visit_ty_params)(tps, e, v);
|
(v.visit_ty_params)(tps, e, v);
|
||||||
|
@ -158,14 +158,14 @@ fn visit_item<E>(i: @item, e: E, v: vt<E>) {
|
||||||
(v.visit_ty_params)(tps, e, v);
|
(v.visit_ty_params)(tps, e, v);
|
||||||
(v.visit_struct_def)(struct_def, i.ident, tps, i.id, e, v);
|
(v.visit_struct_def)(struct_def, i.ident, tps, i.id, e, v);
|
||||||
}
|
}
|
||||||
item_trait(tps, traits, methods) => {
|
item_trait(tps, traits, ref methods) => {
|
||||||
(v.visit_ty_params)(tps, e, v);
|
(v.visit_ty_params)(tps, e, v);
|
||||||
for traits.each |p| { visit_path(p.path, e, v); }
|
for traits.each |p| { visit_path(p.path, e, v); }
|
||||||
for methods.each |m| {
|
for (*methods).each |m| {
|
||||||
(v.visit_trait_method)(*m, e, v);
|
(v.visit_trait_method)(*m, e, v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
item_mac(m) => visit_mac(m, e, v)
|
item_mac(ref m) => visit_mac((*m), e, v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,8 +180,8 @@ fn visit_enum_def<E>(enum_definition: ast::enum_def, tps: ~[ast::ty_param],
|
||||||
(v.visit_struct_def)(struct_def, vr.node.name, tps,
|
(v.visit_struct_def)(struct_def, vr.node.name, tps,
|
||||||
vr.node.id, e, v);
|
vr.node.id, e, v);
|
||||||
}
|
}
|
||||||
enum_variant_kind(enum_definition) => {
|
enum_variant_kind(ref enum_definition) => {
|
||||||
visit_enum_def(enum_definition, tps, e, v);
|
visit_enum_def((*enum_definition), tps, e, v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Visit the disr expr if it exists
|
// Visit the disr expr if it exists
|
||||||
|
@ -197,7 +197,7 @@ fn visit_ty<E>(t: @Ty, e: E, v: vt<E>) {
|
||||||
ty_vec(mt) | ty_ptr(mt) | ty_rptr(_, mt) => {
|
ty_vec(mt) | ty_ptr(mt) | ty_rptr(_, mt) => {
|
||||||
(v.visit_ty)(mt.ty, e, v);
|
(v.visit_ty)(mt.ty, e, v);
|
||||||
}
|
}
|
||||||
ty_rec(flds) => for flds.each |f| {
|
ty_rec(ref flds) => for (*flds).each |f| {
|
||||||
(v.visit_ty)(f.node.mt.ty, e, v);
|
(v.visit_ty)(f.node.mt.ty, e, v);
|
||||||
},
|
},
|
||||||
ty_tup(ts) => for ts.each |tt| {
|
ty_tup(ts) => for ts.each |tt| {
|
||||||
|
@ -320,7 +320,7 @@ fn visit_ty_method<E>(m: ty_method, e: E, v: vt<E>) {
|
||||||
|
|
||||||
fn visit_trait_method<E>(m: trait_method, e: E, v: vt<E>) {
|
fn visit_trait_method<E>(m: trait_method, e: E, v: vt<E>) {
|
||||||
match m {
|
match m {
|
||||||
required(ty_m) => (v.visit_ty_method)(ty_m, e, v),
|
required(ref ty_m) => (v.visit_ty_method)((*ty_m), e, v),
|
||||||
provided(m) => visit_method_helper(m, e, v)
|
provided(m) => visit_method_helper(m, e, v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -364,7 +364,7 @@ fn visit_stmt<E>(s: @stmt, e: E, v: vt<E>) {
|
||||||
stmt_decl(d, _) => (v.visit_decl)(d, e, v),
|
stmt_decl(d, _) => (v.visit_decl)(d, e, v),
|
||||||
stmt_expr(ex, _) => (v.visit_expr)(ex, e, v),
|
stmt_expr(ex, _) => (v.visit_expr)(ex, e, v),
|
||||||
stmt_semi(ex, _) => (v.visit_expr)(ex, e, v),
|
stmt_semi(ex, _) => (v.visit_expr)(ex, e, v),
|
||||||
stmt_mac(mac, _) => visit_mac(mac, e, v)
|
stmt_mac(ref mac, _) => visit_mac((*mac), e, v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,13 +404,13 @@ fn visit_expr<E>(ex: @expr, e: E, v: vt<E>) {
|
||||||
(v.visit_expr)(element, e, v);
|
(v.visit_expr)(element, e, v);
|
||||||
(v.visit_expr)(count, e, v);
|
(v.visit_expr)(count, e, v);
|
||||||
}
|
}
|
||||||
expr_rec(flds, base) => {
|
expr_rec(ref flds, base) => {
|
||||||
for flds.each |f| { (v.visit_expr)(f.node.expr, e, v); }
|
for (*flds).each |f| { (v.visit_expr)(f.node.expr, e, v); }
|
||||||
visit_expr_opt(base, e, v);
|
visit_expr_opt(base, e, v);
|
||||||
}
|
}
|
||||||
expr_struct(p, flds, base) => {
|
expr_struct(p, ref flds, base) => {
|
||||||
visit_path(p, e, v);
|
visit_path(p, e, v);
|
||||||
for flds.each |f| { (v.visit_expr)(f.node.expr, e, v); }
|
for (*flds).each |f| { (v.visit_expr)(f.node.expr, e, v); }
|
||||||
visit_expr_opt(base, e, v);
|
visit_expr_opt(base, e, v);
|
||||||
}
|
}
|
||||||
expr_tup(elts) => for elts.each |el| { (v.visit_expr)(*el, e, v); },
|
expr_tup(elts) => for elts.each |el| { (v.visit_expr)(*el, e, v); },
|
||||||
|
@ -431,29 +431,29 @@ fn visit_expr<E>(ex: @expr, e: E, v: vt<E>) {
|
||||||
expr_assert(x) => (v.visit_expr)(x, e, v),
|
expr_assert(x) => (v.visit_expr)(x, e, v),
|
||||||
expr_lit(_) => (),
|
expr_lit(_) => (),
|
||||||
expr_cast(x, t) => { (v.visit_expr)(x, e, v); (v.visit_ty)(t, e, v); }
|
expr_cast(x, t) => { (v.visit_expr)(x, e, v); (v.visit_ty)(t, e, v); }
|
||||||
expr_if(x, b, eo) => {
|
expr_if(x, ref b, eo) => {
|
||||||
(v.visit_expr)(x, e, v);
|
(v.visit_expr)(x, e, v);
|
||||||
(v.visit_block)(b, e, v);
|
(v.visit_block)((*b), e, v);
|
||||||
visit_expr_opt(eo, e, v);
|
visit_expr_opt(eo, e, v);
|
||||||
}
|
}
|
||||||
expr_while(x, b) => {
|
expr_while(x, ref b) => {
|
||||||
(v.visit_expr)(x, e, v);
|
(v.visit_expr)(x, e, v);
|
||||||
(v.visit_block)(b, e, v);
|
(v.visit_block)((*b), e, v);
|
||||||
}
|
}
|
||||||
expr_loop(b, _) => (v.visit_block)(b, e, v),
|
expr_loop(ref b, _) => (v.visit_block)((*b), e, v),
|
||||||
expr_match(x, arms) => {
|
expr_match(x, ref arms) => {
|
||||||
(v.visit_expr)(x, e, v);
|
(v.visit_expr)(x, e, v);
|
||||||
for arms.each |a| { (v.visit_arm)(*a, e, v); }
|
for (*arms).each |a| { (v.visit_arm)(*a, e, v); }
|
||||||
}
|
}
|
||||||
expr_fn(proto, decl, body, cap_clause) => {
|
expr_fn(proto, decl, ref body, cap_clause) => {
|
||||||
(v.visit_fn)(fk_anon(proto, cap_clause), decl, body,
|
(v.visit_fn)(fk_anon(proto, cap_clause), decl, (*body),
|
||||||
ex.span, ex.id, e, v);
|
ex.span, ex.id, e, v);
|
||||||
}
|
}
|
||||||
expr_fn_block(decl, body, cap_clause) => {
|
expr_fn_block(decl, ref body, cap_clause) => {
|
||||||
(v.visit_fn)(fk_fn_block(cap_clause), decl, body,
|
(v.visit_fn)(fk_fn_block(cap_clause), decl, (*body),
|
||||||
ex.span, ex.id, e, v);
|
ex.span, ex.id, e, v);
|
||||||
}
|
}
|
||||||
expr_block(b) => (v.visit_block)(b, e, v),
|
expr_block(ref b) => (v.visit_block)((*b), e, v),
|
||||||
expr_assign(a, b) => {
|
expr_assign(a, b) => {
|
||||||
(v.visit_expr)(b, e, v);
|
(v.visit_expr)(b, e, v);
|
||||||
(v.visit_expr)(a, e, v);
|
(v.visit_expr)(a, e, v);
|
||||||
|
@ -482,7 +482,7 @@ fn visit_expr<E>(ex: @expr, e: E, v: vt<E>) {
|
||||||
(v.visit_expr)(lv, e, v);
|
(v.visit_expr)(lv, e, v);
|
||||||
(v.visit_expr)(x, e, v);
|
(v.visit_expr)(x, e, v);
|
||||||
}
|
}
|
||||||
expr_mac(mac) => visit_mac(mac, e, v),
|
expr_mac(ref mac) => visit_mac((*mac), e, v),
|
||||||
expr_paren(x) => (v.visit_expr)(x, e, v),
|
expr_paren(x) => (v.visit_expr)(x, e, v),
|
||||||
}
|
}
|
||||||
(v.visit_expr_post)(ex, e, v);
|
(v.visit_expr_post)(ex, e, v);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue