diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-01-08 19:37:25 -0800 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2013-01-08 22:02:35 -0800 |
| commit | 2db3abddcd6784dc5529081c6d831c972abbe755 (patch) | |
| tree | 0f18922234f5fce5fda2af3bdbd7ad4a03423ecd /src/libsyntax/ext/pipes | |
| parent | 3a5b64172045e7f1ec1981c8da2150c7feb73079 (diff) | |
| download | rust-2db3abddcd6784dc5529081c6d831c972abbe755.tar.gz rust-2db3abddcd6784dc5529081c6d831c972abbe755.zip | |
librustc: Make unqualified identifier searches terminate at the nearest module scope. r=tjc
Diffstat (limited to 'src/libsyntax/ext/pipes')
| -rw-r--r-- | src/libsyntax/ext/pipes/ast_builder.rs | 41 | ||||
| -rw-r--r-- | src/libsyntax/ext/pipes/check.rs | 3 | ||||
| -rw-r--r-- | src/libsyntax/ext/pipes/liveness.rs | 5 | ||||
| -rw-r--r-- | src/libsyntax/ext/pipes/mod.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/pipes/parse_proto.rs | 3 | ||||
| -rw-r--r-- | src/libsyntax/ext/pipes/pipec.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/pipes/proto.rs | 4 |
7 files changed, 55 insertions, 7 deletions
diff --git a/src/libsyntax/ext/pipes/ast_builder.rs b/src/libsyntax/ext/pipes/ast_builder.rs index 7a87d909fe6..56ace4aac1b 100644 --- a/src/libsyntax/ext/pipes/ast_builder.rs +++ b/src/libsyntax/ext/pipes/ast_builder.rs @@ -13,13 +13,15 @@ // To start with, it will be use dummy spans, but it might someday do // something smarter. +use core::prelude::*; + use ast::{ident, node_id}; use ast; use ast_util::{ident_to_path, respan, dummy_sp}; use ast_util; use attr; use codemap::span; -use ext::base::mk_ctxt; +use ext::base::{ext_ctxt, mk_ctxt}; use ext::quote::rt::*; use core::vec; @@ -112,9 +114,11 @@ trait ext_ctxt_ast_builder { impl ext_ctxt: ext_ctxt_ast_builder { fn ty_option(ty: @ast::Ty) -> @ast::Ty { - self.ty_path_ast_builder(path(~[self.ident_of(~"Option")], - dummy_sp()) - .add_ty(ty)) + self.ty_path_ast_builder(path_global(~[ + self.ident_of(~"core"), + self.ident_of(~"option"), + self.ident_of(~"Option") + ], dummy_sp()).add_ty(ty)) } fn block_expr(b: ast::blk) -> @ast::expr { @@ -283,10 +287,37 @@ impl ext_ctxt: ext_ctxt_ast_builder { fn item_mod(name: ident, span: span, +items: ~[@ast::item]) -> @ast::item { + // XXX: Total hack: import `core::kinds::Owned` to work around a + // parser bug whereby `fn f<T: ::kinds::Owned>` doesn't parse. + let vi = ast::view_item_import(~[ + @{ + node: ast::view_path_simple( + self.ident_of(~"Owned"), + path( + ~[ + self.ident_of(~"core"), + self.ident_of(~"kinds"), + self.ident_of(~"Owned") + ], + ast_util::dummy_sp() + ), + ast::type_value_ns, + self.next_id() + ), + span: ast_util::dummy_sp() + } + ]); + let vi = @{ + node: vi, + attrs: ~[], + vis: ast::private, + span: ast_util::dummy_sp() + }; + self.item(name, span, ast::item_mod({ - view_items: ~[], + view_items: ~[vi], items: items})) } diff --git a/src/libsyntax/ext/pipes/check.rs b/src/libsyntax/ext/pipes/check.rs index 8eecafa8fa4..f2ba413dd38 100644 --- a/src/libsyntax/ext/pipes/check.rs +++ b/src/libsyntax/ext/pipes/check.rs @@ -29,7 +29,10 @@ that. */ +use core::prelude::*; + use ast; +use codemap::span; use ext::base::ext_ctxt; use ext::pipes::proto::{state, protocol, next_state}; use ext::pipes::proto; diff --git a/src/libsyntax/ext/pipes/liveness.rs b/src/libsyntax/ext/pipes/liveness.rs index 76749f6b2db..01e99594083 100644 --- a/src/libsyntax/ext/pipes/liveness.rs +++ b/src/libsyntax/ext/pipes/liveness.rs @@ -37,6 +37,11 @@ updating the states using rule (2) until there are no changes. */ +use core::prelude::*; + +use ext::base::ext_ctxt; +use ext::pipes::protocol; + use core::str; use std::bitv::{Bitv}; diff --git a/src/libsyntax/ext/pipes/mod.rs b/src/libsyntax/ext/pipes/mod.rs index 67b5c81ad2d..cb17e56e990 100644 --- a/src/libsyntax/ext/pipes/mod.rs +++ b/src/libsyntax/ext/pipes/mod.rs @@ -53,6 +53,8 @@ use ext::pipes::proto::{visit, protocol}; use parse::lexer::{new_tt_reader, reader}; use parse::parser::Parser; +use core::option::None; + #[legacy_exports] mod ast_builder; #[legacy_exports] diff --git a/src/libsyntax/ext/pipes/parse_proto.rs b/src/libsyntax/ext/pipes/parse_proto.rs index 0f6b9dbda28..6a6e895bd40 100644 --- a/src/libsyntax/ext/pipes/parse_proto.rs +++ b/src/libsyntax/ext/pipes/parse_proto.rs @@ -10,10 +10,11 @@ // Parsing pipes protocols from token trees. +use ext::pipes::pipec::*; use parse::parser; use parse::token; -use ext::pipes::pipec::*; +use core::prelude::*; trait proto_parser { fn parse_proto(id: ~str) -> protocol; diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs index ef9c086e3f5..e88ddb841be 100644 --- a/src/libsyntax/ext/pipes/pipec.rs +++ b/src/libsyntax/ext/pipes/pipec.rs @@ -20,6 +20,7 @@ use parse::*; use util::interner; use core::dvec::DVec; +use core::prelude::*; use core::str; use core::to_str::ToStr; use core::vec; @@ -385,7 +386,8 @@ impl protocol: gen_init { } } - cx.ty_path_ast_builder(path(~[cx.ident_of(~"__Buffer")], self.span) + cx.ty_path_ast_builder(path(~[cx.ident_of(~"super"), + cx.ident_of(~"__Buffer")], self.span) .add_tys(cx.ty_vars_global(params))) } diff --git a/src/libsyntax/ext/pipes/proto.rs b/src/libsyntax/ext/pipes/proto.rs index a2673c481b1..9953b4de50d 100644 --- a/src/libsyntax/ext/pipes/proto.rs +++ b/src/libsyntax/ext/pipes/proto.rs @@ -8,7 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use core::prelude::*; + use ast; +use codemap::span; +use ext::base::ext_ctxt; use ext::pipes::ast_builder::{path, append_types}; use core::cmp; |
