about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorJohn Clements <clements@racket-lang.org>2013-07-11 22:58:14 -0700
committerJohn Clements <clements@racket-lang.org>2013-09-06 13:35:12 -0700
commit60562ac9f8c68c1cf3b30efcd6d6954a9b82acbe (patch)
treee9ee19f59738dd6ada11f5ebe50218984a51abd7 /src/libsyntax
parentec0a64def54e0b381ede187bfe199b7620b56c45 (diff)
whitespace, reindentation, and comments only
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast.rs8
-rw-r--r--src/libsyntax/ast_util.rs12
-rw-r--r--src/libsyntax/ext/expand.rs40
-rw-r--r--src/libsyntax/ext/tt/macro_rules.rs1
4 files changed, 37 insertions, 24 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index 31729493815..6a4b2ade931 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -51,6 +51,12 @@ impl Ident {
         if (self.ctxt == other.ctxt) {
             self.name == other.name
         } else {
+            // IF YOU SEE ONE OF THESE FAILS: it means that you're comparing
+            // idents that have different contexts. You can't fix this without
+            // knowing whether the comparison should be hygienic or non-hygienic.
+            // if it should be non-hygienic (most things are), just compare the
+            // 'name' fields of the idents. Or, even better, replace the idents
+            // with Name's.
             fail!(fmt!("not allowed to compare these idents: %?, %?", self, other));
         }
     }
@@ -128,6 +134,7 @@ pub type FnIdent = Option<Ident>;
 pub struct Lifetime {
     id: NodeId,
     span: Span,
+    // FIXME #7743 : change this to Name!
     ident: Ident
 }
 
@@ -647,7 +654,6 @@ pub enum matcher_ {
     // lo, hi position-in-match-array used:
     match_seq(~[matcher], Option<::parse::token::Token>, bool, uint, uint),
     // parse a Rust NT: name to bind, name of NT, position in match array:
-    // NOTE: 'name of NT' shouldnt really be represented as an ident, should it?
     match_nonterminal(Ident, Ident, uint)
 }
 
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs
index e0d58c14a9a..57a0e12ec2f 100644
--- a/src/libsyntax/ast_util.rs
+++ b/src/libsyntax/ast_util.rs
@@ -948,11 +948,14 @@ pub fn resolve_internal(id : Ident,
                 match table.table[id.ctxt] {
                     EmptyCtxt => id.name,
                     // ignore marks here:
-                    Mark(_,subctxt) => resolve_internal(Ident{name:id.name, ctxt: subctxt},table,resolve_table),
+                    Mark(_,subctxt) =>
+                        resolve_internal(Ident{name:id.name, ctxt: subctxt},table,resolve_table),
                     // do the rename if necessary:
                     Rename(Ident{name,ctxt},toname,subctxt) => {
-                        let resolvedfrom = resolve_internal(Ident{name:name,ctxt:ctxt},table,resolve_table);
-                        let resolvedthis = resolve_internal(Ident{name:id.name,ctxt:subctxt},table,resolve_table);
+                        let resolvedfrom =
+                            resolve_internal(Ident{name:name,ctxt:ctxt},table,resolve_table);
+                        let resolvedthis =
+                            resolve_internal(Ident{name:id.name,ctxt:subctxt},table,resolve_table);
                         if ((resolvedthis == resolvedfrom)
                             && (marksof(ctxt,resolvedthis,table)
                                 == marksof(subctxt,resolvedthis,table))) {
@@ -1034,8 +1037,9 @@ pub fn segments_name_eq(a : &[ast::PathSegment], b : &[ast::PathSegment]) -> boo
     } else {
         for (idx,seg) in a.iter().enumerate() {
             if (seg.identifier.name != b[idx].identifier.name)
-                // ident -> name problems in lifetime comparison?
+                // FIXME #7743: ident -> name problems in lifetime comparison?
                 || (seg.lifetime != b[idx].lifetime)
+                // can types contain idents?
                 || (seg.types != b[idx].types) {
                 return false;
             }
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index dfeb938c709..8ee045ba8c1 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -76,19 +76,20 @@ pub fn expand_expr(extsbox: @mut SyntaxEnv,
                             // mark before:
                             let marked_before = mark_tts(*tts,fm);
                             let marked_ctxt = new_mark(fm, ctxt);
-                            let expanded = match expandfun(cx, mac.span, marked_before, marked_ctxt) {
-                                MRExpr(e) => e,
-                                MRAny(expr_maker,_,_) => expr_maker(),
-                                _ => {
-                                    cx.span_fatal(
-                                        pth.span,
-                                        fmt!(
-                                            "non-expr macro in expr pos: %s",
-                                            extnamestr
+                            let expanded =
+                                match expandfun(cx, mac.span, marked_before, marked_ctxt) {
+                                    MRExpr(e) => e,
+                                    MRAny(expr_maker,_,_) => expr_maker(),
+                                    _ => {
+                                        cx.span_fatal(
+                                            pth.span,
+                                            fmt!(
+                                                "non-expr macro in expr pos: %s",
+                                                extnamestr
+                                            )
                                         )
-                                    )
-                                }
-                            };
+                                    }
+                                };
                             // mark after:
                             let marked_after = mark_expr(expanded,fm);
 
@@ -1735,12 +1736,14 @@ mod test {
                  ~[~[0]])
                 // FIXME #6994: the next string exposes the bug referred to in issue 6994, so I'm
                 // commenting it out.
-                // the z flows into and out of two macros (g & f) along one path, and one (just g) along the
-                // other, so the result of the whole thing should be "let z_123 = 3; z_123"
-                //"macro_rules! g (($x:ident) => ({macro_rules! f(($y:ident)=>({let $y=3;$x}));f!($x)}))
+                // the z flows into and out of two macros (g & f) along one path, and one
+                // (just g) along the other, so the result of the whole thing should
+                // be "let z_123 = 3; z_123"
+                //"macro_rules! g (($x:ident) =>
+                //   ({macro_rules! f(($y:ident)=>({let $y=3;$x}));f!($x)}))
                 //   fn a(){g!(z)}"
-                // create a really evil test case where a $x appears inside a binding of $x but *shouldnt*
-                // bind because it was inserted by a different macro....
+                // create a really evil test case where a $x appears inside a binding of $x
+                // but *shouldnt* bind because it was inserted by a different macro....
             ];
         for s in tests.iter() {
             run_renaming_test(s);
@@ -1820,7 +1823,8 @@ mod test {
         // find the ext_cx binding
         let bindings = @mut ~[];
         visit::walk_crate(&mut new_name_finder(bindings), crate, ());
-        let cxbinds : ~[&ast::Ident] = bindings.iter().filter(|b|{@"ext_cx" == (ident_to_str(*b))}).collect();
+        let cxbinds : ~[&ast::Ident] =
+            bindings.iter().filter(|b|{@"ext_cx" == (ident_to_str(*b))}).collect();
         let cxbind = match cxbinds {
             [b] => b,
             _ => fail!("expected just one binding for ext_cx")
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs
index 074ec3cd195..4b0974b70bf 100644
--- a/src/libsyntax/ext/tt/macro_rules.rs
+++ b/src/libsyntax/ext/tt/macro_rules.rs
@@ -49,7 +49,6 @@ pub fn add_new_extension(cx: @ExtCtxt,
     // ...quasiquoting this would be nice.
     let argument_gram = ~[
         ms(match_seq(~[
-            // NOTE : probably just use an enum for the NT_name ?
             ms(match_nonterminal(lhs_nm, special_idents::matchers, 0u)),
             ms(match_tok(FAT_ARROW)),
             ms(match_nonterminal(rhs_nm, special_idents::tt, 1u)),