]> git.lizzy.rs Git - rust.git/commitdiff
comments only
authorJohn Clements <clements@racket-lang.org>
Tue, 24 Jun 2014 01:45:51 +0000 (18:45 -0700)
committerJohn Clements <clements@racket-lang.org>
Wed, 25 Jun 2014 21:16:12 +0000 (14:16 -0700)
src/libsyntax/ext/expand.rs

index eca04148513c0b3886b68fb95c08e994f331df97..a33e6e5e923fe593f3a1fd8bcaec55760803fc88 100644 (file)
@@ -1070,7 +1070,7 @@ pub fn new_path_finder(paths: Vec<ast::Path> ) -> NewPathExprFinderContext {
     // these following tests are quite fragile, in that they don't test what
     // *kind* of failure occurs.
 
-    // make sure that macros can leave scope
+    // make sure that macros can't escape fns
     #[should_fail]
     #[test] fn macros_cant_escape_fns_test () {
         let src = "fn bogus() {macro_rules! z (() => (3+4))}\
@@ -1088,7 +1088,7 @@ pub fn new_path_finder(paths: Vec<ast::Path> ) -> NewPathExprFinderContext {
         expand_crate(&sess,cfg,vec!(),vec!(),crate_ast);
     }
 
-    // make sure that macros can leave scope for modules
+    // make sure that macros can't escape modules
     #[should_fail]
     #[test] fn macros_cant_escape_mods_test () {
         let src = "mod foo {macro_rules! z (() => (3+4))}\
@@ -1105,7 +1105,7 @@ pub fn new_path_finder(paths: Vec<ast::Path> ) -> NewPathExprFinderContext {
         expand_crate(&sess,cfg,vec!(),vec!(),crate_ast);
     }
 
-    // macro_escape modules shouldn't cause macros to leave scope
+    // macro_escape modules should allow macros to escape
     #[test] fn macros_can_escape_flattened_mods_test () {
         let src = "#[macro_escape] mod foo {macro_rules! z (() => (3+4))}\
                    fn inty() -> int { z!() }".to_string();
@@ -1114,7 +1114,6 @@ pub fn new_path_finder(paths: Vec<ast::Path> ) -> NewPathExprFinderContext {
             "<test>".to_string(),
             src,
             Vec::new(), &sess);
-        // should fail:
         let cfg = ::syntax::ext::expand::ExpansionConfig {
             deriving_hash_type_parameter: false,
             crate_id: from_str("test").unwrap(),
@@ -1185,6 +1184,12 @@ fn expand_crate_str(crate_str: String) -> ast::Crate {
     // binding should match the second two varrefs, and the second binding
     // should match the first varref.
     //
+    // Put differently; this is a sparse representation of a boolean matrix
+    // indicating which bindings capture which identifiers.
+    //
+    // Note also that this matrix is dependent on the implicit ordering of
+    // the bindings and the varrefs discovered by the name-finder and the path-finder.
+    //
     // The comparisons are done post-mtwt-resolve, so we're comparing renamed
     // names; differences in marks don't matter any more.
     //