summary refs log tree commit diff
path: root/src/libsyntax/ext
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-01-08 19:37:25 -0800
committerPatrick Walton <pcwalton@mimiga.net>2013-01-08 22:02:35 -0800
commit2db3abddcd6784dc5529081c6d831c972abbe755 (patch)
tree0f18922234f5fce5fda2af3bdbd7ad4a03423ecd /src/libsyntax/ext
parent3a5b64172045e7f1ec1981c8da2150c7feb73079 (diff)
downloadrust-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')
-rw-r--r--src/libsyntax/ext/auto_encode.rs6
-rw-r--r--src/libsyntax/ext/base.rs2
-rw-r--r--src/libsyntax/ext/build.rs2
-rw-r--r--src/libsyntax/ext/concat_idents.rs2
-rw-r--r--src/libsyntax/ext/deriving.rs2
-rw-r--r--src/libsyntax/ext/expand.rs2
-rw-r--r--src/libsyntax/ext/fmt.rs2
-rw-r--r--src/libsyntax/ext/pipes/ast_builder.rs41
-rw-r--r--src/libsyntax/ext/pipes/check.rs3
-rw-r--r--src/libsyntax/ext/pipes/liveness.rs5
-rw-r--r--src/libsyntax/ext/pipes/mod.rs2
-rw-r--r--src/libsyntax/ext/pipes/parse_proto.rs3
-rw-r--r--src/libsyntax/ext/pipes/pipec.rs4
-rw-r--r--src/libsyntax/ext/pipes/proto.rs4
-rw-r--r--src/libsyntax/ext/quote.rs2
-rw-r--r--src/libsyntax/ext/source_util.rs1
-rw-r--r--src/libsyntax/ext/trace_macros.rs9
-rw-r--r--src/libsyntax/ext/tt/macro_rules.rs2
-rw-r--r--src/libsyntax/ext/tt/transcribe.rs2
19 files changed, 84 insertions, 12 deletions
diff --git a/src/libsyntax/ext/auto_encode.rs b/src/libsyntax/ext/auto_encode.rs
index b8fe00e246c..152c49461b8 100644
--- a/src/libsyntax/ext/auto_encode.rs
+++ b/src/libsyntax/ext/auto_encode.rs
@@ -88,10 +88,14 @@ node twice.
 
 */
 
+use core::prelude::*;
+
+use ast;
 use ast_util;
 use attr;
 use codemap::span;
 use ext::base::*;
+use parse;
 
 use core::vec;
 use std::map;
@@ -421,7 +425,7 @@ fn mk_impl(
     @{
         // This is a new-style impl declaration.
         // XXX: clownshoes
-        ident: ast::token::special_idents::clownshoes_extensions,
+        ident: parse::token::special_idents::clownshoes_extensions,
         attrs: ~[],
         id: cx.next_id(),
         node: ast::item_impl(trait_tps, opt_trait, ty, ~[f(ty)]),
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index dc774805ed3..7b69084a827 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use core::prelude::*;
+
 use ast;
 use ast_util::dummy_sp;
 use codemap;
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs
index d63f14b5774..4a3c8ee2259 100644
--- a/src/libsyntax/ext/build.rs
+++ b/src/libsyntax/ext/build.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use core::prelude::*;
+
 use ast;
 use codemap;
 use codemap::span;
diff --git a/src/libsyntax/ext/concat_idents.rs b/src/libsyntax/ext/concat_idents.rs
index 4f88ffeeb04..d847cfee053 100644
--- a/src/libsyntax/ext/concat_idents.rs
+++ b/src/libsyntax/ext/concat_idents.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use core::prelude::*;
+
 use ext::base::*;
 use ext::base;
 
diff --git a/src/libsyntax/ext/deriving.rs b/src/libsyntax/ext/deriving.rs
index 3cbc8f3834f..41804b1022a 100644
--- a/src/libsyntax/ext/deriving.rs
+++ b/src/libsyntax/ext/deriving.rs
@@ -11,6 +11,8 @@
 /// The compiler code necessary to implement the #[deriving_eq] and
 /// #[deriving_iter_bytes] extensions.
 
+use core::prelude::*;
+
 use ast::{Ty, and, bind_by_ref, binop, deref, enum_def, enum_variant_kind};
 use ast::{expr, expr_match, ident, item, item_, item_struct, item_enum};
 use ast::{item_impl, m_imm, meta_item, method, named_field, or, pat};
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index 27565b44c6d..8faeb167191 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use core::prelude::*;
+
 use ast::{crate, expr_, expr_mac, mac_invoc_tt};
 use ast::{tt_delim, tt_tok, item_mac, stmt_, stmt_mac, stmt_expr, stmt_semi};
 use ast;
diff --git a/src/libsyntax/ext/fmt.rs b/src/libsyntax/ext/fmt.rs
index b8a27096f73..0eaa983ccad 100644
--- a/src/libsyntax/ext/fmt.rs
+++ b/src/libsyntax/ext/fmt.rs
@@ -16,6 +16,8 @@
  * compiler syntax extension plugin interface.
  */
 
+use core::prelude::*;
+
 use ast;
 use codemap::span;
 use ext::base::*;
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;
diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs
index 184093715c6..4aed5b64747 100644
--- a/src/libsyntax/ext/quote.rs
+++ b/src/libsyntax/ext/quote.rs
@@ -18,6 +18,7 @@ use parse::token::*;
 use parse::token;
 use parse;
 
+use core::prelude::*;
 use core::str;
 
 /**
@@ -33,6 +34,7 @@ use core::str;
 
 pub mod rt {
     use ast;
+    use ext::base::ext_ctxt;
     use parse;
     use print::pprust;
 
diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs
index 47c6ea8876e..3d012b393bb 100644
--- a/src/libsyntax/ext/source_util.rs
+++ b/src/libsyntax/ext/source_util.rs
@@ -16,6 +16,7 @@ use ext::build::{mk_base_vec_e, mk_uint, mk_u8, mk_base_str};
 use print::pprust;
 
 use core::io;
+use core::prelude::*;
 use core::result;
 use core::str;
 use core::vec;
diff --git a/src/libsyntax/ext/trace_macros.rs b/src/libsyntax/ext/trace_macros.rs
index c202778d0df..d5031b97718 100644
--- a/src/libsyntax/ext/trace_macros.rs
+++ b/src/libsyntax/ext/trace_macros.rs
@@ -8,17 +8,18 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use ast::tt_delim;
 use ast;
 use codemap::span;
-use ext::base;
 use ext::base::ext_ctxt;
-use ast::tt_delim;
+use ext::base;
 use parse::lexer::{new_tt_reader, reader};
 use parse::parser::Parser;
 
+use core::option::None;
+
 fn expand_trace_macros(cx: ext_ctxt, sp: span,
-                       tt: ~[ast::token_tree]) -> base::mac_result
-{
+                       tt: ~[ast::token_tree]) -> base::mac_result {
     let sess = cx.parse_sess();
     let cfg = cx.cfg();
     let tt_rdr = new_tt_reader(cx.parse_sess().span_diagnostic,
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs
index 7386b3b67b9..1f1efdfe165 100644
--- a/src/libsyntax/ext/tt/macro_rules.rs
+++ b/src/libsyntax/ext/tt/macro_rules.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use core::prelude::*;
+
 use ast::{ident, matcher_, matcher, match_tok, match_nonterminal, match_seq};
 use ast::{tt_delim};
 use ast;
diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs
index c1745fac710..47489034a0f 100644
--- a/src/libsyntax/ext/tt/transcribe.rs
+++ b/src/libsyntax/ext/tt/transcribe.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use core::prelude::*;
+
 use ast;
 use ast::{token_tree, tt_delim, tt_tok, tt_seq, tt_nonterminal,ident};
 use ast_util;