[svn] r6480: nemerle/trunk/ncc/parsing/PreParser.n

VladD2 svnadmin at nemerle.org
Wed Aug 2 12:36:33 CEST 2006


Log:
Fix GlobalEnv in completion notification.

Author: VladD2
Date: Wed Aug  2 12:36:31 2006
New Revision: 6480

Modified:
   nemerle/trunk/ncc/parsing/PreParser.n

Modified: nemerle/trunk/ncc/parsing/PreParser.n
==============================================================================
--- nemerle/trunk/ncc/parsing/PreParser.n	(original)
+++ nemerle/trunk/ncc/parsing/PreParser.n	Wed Aug  2 12:36:31 2006
@@ -336,6 +336,7 @@
     {
       def parent_begin = parent_stream.Count;
       def current_begin = current_stream.Count;
+      mutable currentNsEnv = Env; // GlobalEnv of current namespace
 
       def get_qualified_identifier () : list [string] * Location
       {
@@ -365,7 +366,6 @@
       def parse_using_directive (tok)
       {
         finish_current (current_begin);
-        def oldEnv = Env;
         def (id, idLoc) = get_qualified_identifier ();
 
         match (get_token ()) {
@@ -377,7 +377,8 @@
             def using_tok = Token.Using (loc, Env);
             current_stream.Add (using_tok);
 
-            lexer.Manager.OnAfterUsingDirectiveParse(loc + st.Location, id, idLoc, oldEnv, Env);
+            lexer.Manager.OnAfterUsingDirectiveParse(
+              loc + st.Location, id, idLoc, currentNsEnv, Env);
             
           | Token.Operator ("=") =>
             def (id', idLoc') = get_qualified_identifier ();
@@ -397,12 +398,12 @@
             current_stream.Add (using_tok);
             
             lexer.Manager.OnAfterUsingDirectiveParse(tok.Location + st.Location, 
-              id', idLoc', oldEnv, Env);
+              id', idLoc', currentNsEnv, Env);
 
           | x => 
             Message.Error (x.Location, "expecting `;' or `='");
             lexer.Manager.OnAfterUsingDirectiveParse(tok.Location + lexer.Location, 
-              id, idLoc, oldEnv, Env);
+              id, idLoc, currentNsEnv, Env);
         }
 
         finish_current (current_begin);
@@ -417,6 +418,9 @@
           | Token.Keyword ("namespace") =>
             finish_current (current_begin);
             
+            def prevNsEnv = currentNsEnv;
+            currentNsEnv = Env;
+            
             def (id, idLoc) = get_qualified_identifier ();
             match (get_token ()) {
               | Token.BeginBrace as br =>
@@ -448,9 +452,11 @@
                 lexer.Keywords = Env.Keywords;
 
                 current_stream.Add (namespace_tok);
+               
               | x => Message.Error (x.Location, "expecting `{' opening namespace scope")
             }
             finish_current (current_begin);            
+            currentNsEnv = prevNsEnv;
             loop ()
           
           // finish entire brace group



More information about the svn mailing list