[svn] r6060: nemerle/trunk: macros/Logging.n ncc/testsuite/positive/macroprog.n

malekith svnadmin at nemerle.org
Sun Jan 15 19:27:20 CET 2006


Log:
Allow 0/1 in addition to true/false in LogFlag.

Author: malekith
Date: Sun Jan 15 19:27:18 2006
New Revision: 6060

Modified:
   nemerle/trunk/macros/Logging.n
   nemerle/trunk/ncc/testsuite/positive/macroprog.n

Modified: nemerle/trunk/macros/Logging.n
==============================================================================
--- nemerle/trunk/macros/Logging.n	(original)
+++ nemerle/trunk/macros/Logging.n	Sun Jan 15 19:27:18 2006
@@ -64,7 +64,17 @@
       Init ();
     }
     
-    public LogFlag (id : PExpr, is_on : bool) : void {
+    public LogFlag (id : PExpr, is_on : PExpr) : void {
+      def is_on =
+        match (is_on) {
+          | <[ true ]>
+          | <[ 1 ]> => true
+          | <[ false ]>
+          | <[ 0 ]> => false
+          | _ =>
+            Message.Error ("flag value should be either true/false (or 0/1)"); 
+            false
+        }
       def name = GetName (id);
       when (Flags.Contains (name))
         Message.Error ($ "redefinition of the flag `$(name)'");
@@ -106,14 +116,14 @@
 
   [Nemerle.MacroUsage (Nemerle.MacroPhase.BeforeInheritance,
                        Nemerle.MacroTargets.Assembly)]
-  macro LogFlag (id, is_on : bool)
+  macro LogFlag (id, is_on)
   {
     LogFlag (id, is_on);
   }
   
   [Nemerle.MacroUsage (Nemerle.MacroPhase.BeforeInheritance,
                        Nemerle.MacroTargets.Class)]
-  macro LogFlag (_ : TypeBuilder, id, is_on : bool)
+  macro LogFlag (_ : TypeBuilder, id, is_on)
   {
     LogFlag (id, is_on) 
   }

Modified: nemerle/trunk/ncc/testsuite/positive/macroprog.n
==============================================================================
--- nemerle/trunk/ncc/testsuite/positive/macroprog.n	(original)
+++ nemerle/trunk/ncc/testsuite/positive/macroprog.n	Sun Jan 15 19:27:18 2006
@@ -186,7 +186,7 @@
 [LogFunction (LogTest.dolog)]
 
 [LogFlag (VERB, true),
- LogFlag (DEBUG, false)]
+ LogFlag (DEBUG, 0)]
  
 public class LogTest
 {



More information about the svn mailing list