about summary refs log tree commit diff
path: root/src/comp/syntax
diff options
context:
space:
mode:
authorMichael Sullivan <sully@msully.net>2011-07-22 12:34:47 -0700
committerMichael Sullivan <sully@msully.net>2011-07-22 17:46:52 -0700
commitf2f8943a8501e90c003ca4bddcb9f95cdb4f5dc7 (patch)
treead768bc0e0e0fc27e64ad57488173173afd3080b /src/comp/syntax
parente18d70fe12dcaa84e073f94922f625f3cebeea39 (diff)
downloadrust-f2f8943a8501e90c003ca4bddcb9f95cdb4f5dc7.tar.gz
rust-f2f8943a8501e90c003ca4bddcb9f95cdb4f5dc7.zip
Add a "fake" def_upvar and mechanisms to create it.
Diffstat (limited to 'src/comp/syntax')
-rw-r--r--src/comp/syntax/ast.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/comp/syntax/ast.rs b/src/comp/syntax/ast.rs
index 5992a857d14..a9367724c5e 100644
--- a/src/comp/syntax/ast.rs
+++ b/src/comp/syntax/ast.rs
@@ -52,6 +52,11 @@ tag def {
     def_use(def_id);
     def_native_ty(def_id);
     def_native_fn(def_id);
+
+    /* A "fake" def for upvars. This never appears in the def_map, but
+     * freevars::def_lookup will return it for a def that is an upvar.
+     * It contains the actual def. */
+    def_upvar(def_id, @def);
 }
 
 fn variant_def_ids(&def d) -> tup(def_id, def_id) {
@@ -76,6 +81,7 @@ fn def_id_of_def(def d) -> def_id {
         case (def_use(?id)) { ret id; }
         case (def_native_ty(?id)) { ret id; }
         case (def_native_fn(?id)) { ret id; }
+        case (def_upvar(?id, _)) { ret id; }
     }
     fail;
 }