librustc: Remove use mod
from the language
This commit is contained in:
parent
2c5afa4753
commit
25129ee81c
8 changed files with 15 additions and 53 deletions
|
@ -274,7 +274,6 @@ fn mk_std(cx: &TestCtxt) -> @ast::view_item {
|
||||||
ast::view_item_use(
|
ast::view_item_use(
|
||||||
~[@nospan(ast::view_path_simple(id_std,
|
~[@nospan(ast::view_path_simple(id_std,
|
||||||
path_node(~[id_std]),
|
path_node(~[id_std]),
|
||||||
ast::type_value_ns,
|
|
||||||
cx.sess.next_node_id()))])
|
cx.sess.next_node_id()))])
|
||||||
} else {
|
} else {
|
||||||
ast::view_item_extern_mod(id_std, ~[@mi],
|
ast::view_item_extern_mod(id_std, ~[@mi],
|
||||||
|
|
|
@ -1413,7 +1413,7 @@ pub impl Resolver {
|
||||||
|
|
||||||
let mut module_path = ~[];
|
let mut module_path = ~[];
|
||||||
match view_path.node {
|
match view_path.node {
|
||||||
view_path_simple(_, full_path, _, _) => {
|
view_path_simple(_, full_path, _) => {
|
||||||
let path_len = full_path.idents.len();
|
let path_len = full_path.idents.len();
|
||||||
assert!(path_len != 0);
|
assert!(path_len != 0);
|
||||||
|
|
||||||
|
@ -1435,7 +1435,7 @@ pub impl Resolver {
|
||||||
// Build up the import directives.
|
// Build up the import directives.
|
||||||
let module_ = self.get_module_from_parent(parent);
|
let module_ = self.get_module_from_parent(parent);
|
||||||
match view_path.node {
|
match view_path.node {
|
||||||
view_path_simple(binding, full_path, _, _) => {
|
view_path_simple(binding, full_path, _) => {
|
||||||
let source_ident = *full_path.idents.last();
|
let source_ident = *full_path.idents.last();
|
||||||
let subclass = @SingleImport(binding,
|
let subclass = @SingleImport(binding,
|
||||||
source_ident);
|
source_ident);
|
||||||
|
|
|
@ -1100,11 +1100,6 @@ pub struct path_list_ident_ {
|
||||||
|
|
||||||
pub type path_list_ident = spanned<path_list_ident_>;
|
pub type path_list_ident = spanned<path_list_ident_>;
|
||||||
|
|
||||||
#[auto_encode]
|
|
||||||
#[auto_decode]
|
|
||||||
#[deriving(Eq)]
|
|
||||||
pub enum namespace { module_ns, type_value_ns }
|
|
||||||
|
|
||||||
pub type view_path = spanned<view_path_>;
|
pub type view_path = spanned<view_path_>;
|
||||||
|
|
||||||
#[auto_encode]
|
#[auto_encode]
|
||||||
|
@ -1117,7 +1112,7 @@ pub enum view_path_ {
|
||||||
// or just
|
// or just
|
||||||
//
|
//
|
||||||
// foo::bar::baz (with 'baz =' implicitly on the left)
|
// foo::bar::baz (with 'baz =' implicitly on the left)
|
||||||
view_path_simple(ident, @Path, namespace, node_id),
|
view_path_simple(ident, @Path, node_id),
|
||||||
|
|
||||||
// foo::bar::*
|
// foo::bar::*
|
||||||
view_path_glob(@Path, node_id),
|
view_path_glob(@Path, node_id),
|
||||||
|
|
|
@ -413,7 +413,7 @@ pub fn id_visitor(vfn: @fn(node_id)) -> visit::vt<()> {
|
||||||
view_item_use(ref vps) => {
|
view_item_use(ref vps) => {
|
||||||
for vps.each |vp| {
|
for vps.each |vp| {
|
||||||
match vp.node {
|
match vp.node {
|
||||||
view_path_simple(_, _, _, id) => vfn(id),
|
view_path_simple(_, _, id) => vfn(id),
|
||||||
view_path_glob(_, id) => vfn(id),
|
view_path_glob(_, id) => vfn(id),
|
||||||
view_path_list(_, _, id) => vfn(id)
|
view_path_list(_, _, id) => vfn(id)
|
||||||
}
|
}
|
||||||
|
@ -551,7 +551,8 @@ pub fn walk_pat(pat: @pat, it: &fn(@pat)) {
|
||||||
|
|
||||||
pub fn view_path_id(p: @view_path) -> node_id {
|
pub fn view_path_id(p: @view_path) -> node_id {
|
||||||
match p.node {
|
match p.node {
|
||||||
view_path_simple(_, _, _, id) | view_path_glob(_, id) |
|
view_path_simple(_, _, id) |
|
||||||
|
view_path_glob(_, id) |
|
||||||
view_path_list(_, _, id) => id
|
view_path_list(_, _, id) => id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -374,7 +374,6 @@ impl ext_ctxt_ast_builder for @ext_ctxt {
|
||||||
],
|
],
|
||||||
codemap::dummy_sp()
|
codemap::dummy_sp()
|
||||||
),
|
),
|
||||||
ast::type_value_ns,
|
|
||||||
self.next_id()
|
self.next_id()
|
||||||
),
|
),
|
||||||
span: codemap::dummy_sp()
|
span: codemap::dummy_sp()
|
||||||
|
|
|
@ -40,7 +40,7 @@ use ast::{item_mac, item_mod, item_struct, item_trait, item_ty, lit, lit_};
|
||||||
use ast::{lit_bool, lit_float, lit_float_unsuffixed, lit_int};
|
use ast::{lit_bool, lit_float, lit_float_unsuffixed, lit_int};
|
||||||
use ast::{lit_int_unsuffixed, lit_nil, lit_str, lit_uint, local, m_const};
|
use ast::{lit_int_unsuffixed, lit_nil, lit_str, lit_uint, local, m_const};
|
||||||
use ast::{m_imm, m_mutbl, mac_, mac_invoc_tt, matcher, match_nonterminal};
|
use ast::{m_imm, m_mutbl, mac_, mac_invoc_tt, matcher, match_nonterminal};
|
||||||
use ast::{match_seq, match_tok, method, mode, module_ns, mt, mul, mutability};
|
use ast::{match_seq, match_tok, method, mode, mt, mul, mutability};
|
||||||
use ast::{named_field, neg, node_id, noreturn, not, pat, pat_box, pat_enum};
|
use ast::{named_field, neg, node_id, noreturn, not, pat, pat_box, pat_enum};
|
||||||
use ast::{pat_ident, pat_lit, pat_range, pat_region, pat_struct};
|
use ast::{pat_ident, pat_lit, pat_range, pat_region, pat_struct};
|
||||||
use ast::{pat_tup, pat_uniq, pat_wild, private};
|
use ast::{pat_tup, pat_uniq, pat_wild, private};
|
||||||
|
@ -54,7 +54,7 @@ use ast::{tt_nonterminal, tuple_variant_kind, Ty, ty_, ty_bot, ty_box};
|
||||||
use ast::{ty_field, ty_fixed_length_vec, ty_closure, ty_bare_fn};
|
use ast::{ty_field, ty_fixed_length_vec, ty_closure, ty_bare_fn};
|
||||||
use ast::{ty_infer, ty_method};
|
use ast::{ty_infer, ty_method};
|
||||||
use ast::{ty_nil, TyParam, TyParamBound, ty_path, ty_ptr, ty_rptr};
|
use ast::{ty_nil, TyParam, TyParamBound, ty_path, ty_ptr, ty_rptr};
|
||||||
use ast::{ty_tup, ty_u32, ty_uniq, ty_vec, type_value_ns, uniq};
|
use ast::{ty_tup, ty_u32, ty_uniq, ty_vec, uniq};
|
||||||
use ast::{unnamed_field, unsafe_blk, unsafe_fn, view_item};
|
use ast::{unnamed_field, unsafe_blk, unsafe_fn, view_item};
|
||||||
use ast::{view_item_, view_item_extern_mod, view_item_use};
|
use ast::{view_item_, view_item_extern_mod, view_item_use};
|
||||||
use ast::{view_path, view_path_glob, view_path_list, view_path_simple};
|
use ast::{view_path, view_path_glob, view_path_list, view_path_simple};
|
||||||
|
@ -4224,13 +4224,6 @@ pub impl Parser {
|
||||||
fn parse_view_path(&self) -> @view_path {
|
fn parse_view_path(&self) -> @view_path {
|
||||||
let lo = self.span.lo;
|
let lo = self.span.lo;
|
||||||
|
|
||||||
let namespace;
|
|
||||||
if self.eat_keyword(&~"mod") {
|
|
||||||
namespace = module_ns;
|
|
||||||
} else {
|
|
||||||
namespace = type_value_ns;
|
|
||||||
}
|
|
||||||
|
|
||||||
let first_ident = self.parse_ident();
|
let first_ident = self.parse_ident();
|
||||||
let mut path = ~[first_ident];
|
let mut path = ~[first_ident];
|
||||||
debug!("parsed view_path: %s", *self.id_to_str(first_ident));
|
debug!("parsed view_path: %s", *self.id_to_str(first_ident));
|
||||||
|
@ -4250,8 +4243,9 @@ pub impl Parser {
|
||||||
rp: None,
|
rp: None,
|
||||||
types: ~[] };
|
types: ~[] };
|
||||||
return @spanned(lo, self.span.hi,
|
return @spanned(lo, self.span.hi,
|
||||||
view_path_simple(first_ident, path, namespace,
|
view_path_simple(first_ident,
|
||||||
self.get_id()));
|
path,
|
||||||
|
self.get_id()));
|
||||||
}
|
}
|
||||||
|
|
||||||
token::MOD_SEP => {
|
token::MOD_SEP => {
|
||||||
|
@ -4306,8 +4300,9 @@ pub impl Parser {
|
||||||
idents: path,
|
idents: path,
|
||||||
rp: None,
|
rp: None,
|
||||||
types: ~[] };
|
types: ~[] };
|
||||||
return @spanned(lo, self.span.hi,
|
return @spanned(lo,
|
||||||
view_path_simple(last, path, namespace, self.get_id()));
|
self.span.hi,
|
||||||
|
view_path_simple(last, path, self.get_id()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// matches view_paths = view_path | view_path , view_paths
|
// matches view_paths = view_path | view_path , view_paths
|
||||||
|
|
|
@ -1816,10 +1816,7 @@ pub fn print_meta_item(s: @ps, item: @ast::meta_item) {
|
||||||
|
|
||||||
pub fn print_view_path(s: @ps, vp: @ast::view_path) {
|
pub fn print_view_path(s: @ps, vp: @ast::view_path) {
|
||||||
match vp.node {
|
match vp.node {
|
||||||
ast::view_path_simple(ident, path, namespace, _) => {
|
ast::view_path_simple(ident, path, _) => {
|
||||||
if namespace == ast::module_ns {
|
|
||||||
word_space(s, ~"mod");
|
|
||||||
}
|
|
||||||
if path.idents[vec::len(path.idents)-1u] != ident {
|
if path.idents[vec::len(path.idents)-1u] != ident {
|
||||||
print_ident(s, ident);
|
print_ident(s, ident);
|
||||||
space(s.s);
|
space(s.s);
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
// xfail-fast
|
|
||||||
|
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
use mod a::b;
|
|
||||||
|
|
||||||
mod a {
|
|
||||||
pub mod b {
|
|
||||||
pub fn f() {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn main() {
|
|
||||||
b::f();
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue