[svn] r6212: nemerle/trunk/ncc: testsuite/positive/macrolib.n typing/Typer.n

nazgul svnadmin at nemerle.org
Mon May 1 12:34:35 CEST 2006


Log:
Add InErrorMode parameter to Typer, so macros can avoid rerunning

Author: nazgul
Date: Mon May  1 12:34:30 2006
New Revision: 6212

Modified:
   nemerle/trunk/ncc/testsuite/positive/macrolib.n
   nemerle/trunk/ncc/typing/Typer.n

Modified: nemerle/trunk/ncc/testsuite/positive/macrolib.n
==============================================================================
--- nemerle/trunk/ncc/testsuite/positive/macrolib.n	(original)
+++ nemerle/trunk/ncc/testsuite/positive/macrolib.n	Mon May  1 12:34:30 2006
@@ -77,6 +77,13 @@
 
 macro ala()
 {
+  /// test for <[ ]> matching
+  match (<[ def (1,2) = 3; ]>) {
+    | <[ def $_ = $_ ]> => ()
+    | _ => assert (false)
+  }
+
+  unless (Nemerle.Macros.ImplicitCTX ().InErrorMode) {
   def tb = Nemerle.Macros.ImplicitCTX ().Env.Define (<[ decl:
     public class haha {
       x : int;
@@ -86,13 +93,8 @@
     }
   ]>);
 
-  /// test for <[ ]> matching
-  match (<[ def (1,2) = 3; ]>) {
-    | <[ def $_ = $_ ]> => ()
-    | _ => assert (false)
-  }
-  
   tb.Compile ();
+  }
   <[ Console.WriteLine ("proba") ]>;
 }
 
@@ -330,6 +332,7 @@
 syntax ("metaclass", className, body)
 {
   def ctx = Nemerle.Macros.ImplicitCTX();
+  unless (ctx.InErrorMode) {
   mutable code = [];
   match ((className, body)) {
     | (<[ $(nm : name) ]>, <[ { .. $props } ]>) =>
@@ -363,6 +366,7 @@
     public delegate GeneratedDelegate(_ : string) : void;
   ]>);
   t.Compile();
+  }
     
   <[ () ]>
 }

Modified: nemerle/trunk/ncc/typing/Typer.n
==============================================================================
--- nemerle/trunk/ncc/typing/Typer.n	(original)
+++ nemerle/trunk/ncc/typing/Typer.n	Mon May  1 12:34:30 2006
@@ -1044,6 +1044,10 @@
     }
 
 
+    public InErrorMode : bool {
+      get { messenger.InErrorMode } 
+    }
+
     DoExpect (expected : TyVar, actual : TyVar, place : string, is_subtyping : bool) : bool
     {
       if (messenger.InErrorMode) {



More information about the svn mailing list