[svn] r5951: nemerle/trunk: boot/Nemerle.Compiler.dll boot/Nemerle.Macros.dll boot/Nemerle.dll boot/ncc.ex...

malekith svnadmin at nemerle.org
Sun Nov 20 13:13:52 CET 2005


Log:
Update the boot compiler. Use log(...) macros instead of conditional compilation.

Author: malekith
Date: Sun Nov 20 13:13:15 2005
New Revision: 5951

Modified:
   nemerle/trunk/boot/Nemerle.Compiler.dll
   nemerle/trunk/boot/Nemerle.Macros.dll
   nemerle/trunk/boot/Nemerle.dll
   nemerle/trunk/boot/ncc.exe
   nemerle/trunk/ncc/typing/TyVar.n
   nemerle/trunk/ncc/typing/Typer.n

Modified: nemerle/trunk/boot/Nemerle.Compiler.dll
==============================================================================
Binary files. No diff available.

Modified: nemerle/trunk/boot/Nemerle.Macros.dll
==============================================================================
Binary files. No diff available.

Modified: nemerle/trunk/boot/Nemerle.dll
==============================================================================
Binary files. No diff available.

Modified: nemerle/trunk/boot/ncc.exe
==============================================================================
Binary files. No diff available.

Modified: nemerle/trunk/ncc/typing/TyVar.n
==============================================================================
--- nemerle/trunk/ncc/typing/TyVar.n	(original)
+++ nemerle/trunk/ncc/typing/TyVar.n	Sun Nov 20 13:13:15 2005
@@ -28,11 +28,13 @@
 
 using Nemerle;
 using Nemerle.Collections;
+using Nemerle.Logging;
 using System.Reflection;
 using System;
 
 using Nemerle.Compiler.SolverMacros;
 
+[assembly: LogFlag (SOLVER, false)]
 // #define VERB
 
 namespace Nemerle.Compiler 
@@ -140,9 +142,7 @@
     {
       def t = t.Self;
       
-      #if VERB
-      Message.Debug ($ "UnifyTV: $(this) =? $t");
-      #endif
+      log (SOLVER, $ "UnifyTV: $(this) =? $t");
       
       if (IsFixed)
         t.Unify (FixedValue)
@@ -172,9 +172,7 @@
     [ForwardThis (Self)]
     public virtual Unify (t : MType) : bool
     {
-      #if VERB
-      Message.Debug ($ "Unify: $(this) =? $t");
-      #endif
+      log (SOLVER, $ "Unify: $(this) =? $t");
       if (IsFixed)
         FixedValue.Unify (t)
       else if (IsFresh) {
@@ -589,9 +587,7 @@
       assert (low.IsFree);
       assert (high.IsFree);
 
-      #if VERB
-      Message.Debug ($ "AddTVRel: $low :> $high");
-      #endif
+      log (SOLVER, $ "AddTVRel: $low :> $high");
 
       if (low : object == high : object || high.IsIn (low.upper_tyvars))
         true
@@ -688,9 +684,7 @@
       WillWrite ();
       assert (Self : object == this);
 
-      #if VERB
-      Message.Debug ($ "Alias: $(this) ---> $tv");
-      #endif
+      log (SOLVER, $ "Alias: $(this) ---> $tv");
 
       if (tv.Self : object != this) {
         if (IsFromNull && !tv.CanBeNull) {
@@ -779,12 +773,11 @@
       assert (low != null);
       assert (high != null);
 
-      #if VERB
+      whenlogging (SOLVER)
       if (rev)
         Message.Debug ($ "AddRelation: $low <: $high");
       else
         Message.Debug ($ "AddRelation: $low :> $high");
-      #endif
 
       high.WillWrite ();
       def high = high.Self;
@@ -851,10 +844,10 @@
           def new_bound = Passes.Solver.Intersect (high.lower_bound, low);
           def high = high.Self;
           high.WillWrite ();
-          #if VERB
+          whenlogging (SOLVER) {
           def tv = if (high.lower_bound == null) "(null)" else high.lower_bound.ToString ();
           Message.Debug ($"new bound $tv * $low  = $new_bound");
-          #endif
+          }
           when (high.lower_bound == null || 
                 !new_bound.Equals (high.lower_bound)) {
             high.lower_bound = new_bound;

Modified: nemerle/trunk/ncc/typing/Typer.n
==============================================================================
--- nemerle/trunk/ncc/typing/Typer.n	(original)
+++ nemerle/trunk/ncc/typing/Typer.n	Sun Nov 20 13:13:15 2005
@@ -28,6 +28,7 @@
 
 using Nemerle.Collections;
 using Nemerle.Utility;
+using Nemerle.Logging;
 
 using Nemerle.Compiler;
 using Nemerle.Compiler.Typedtree;
@@ -35,6 +36,11 @@
 
 using PT = Nemerle.Compiler.Parsetree;
 
+[assembly: LogFunction (Message.Debug),
+           LogFlag (TYPING, false),
+           LogFlag (MACRO_EXPANSIONS, false)
+]
+
 namespace Nemerle.Compiler
 {
   [Record]
@@ -893,28 +899,23 @@
 
     public TypeExpr (e : PT.PExpr, expected : TyVar, is_toplevel_in_seq : bool) : TExpr
     {
-      def dump = false;
-      when (dump)
-        Message.Debug (e.loc, $ "typing expression: $e, exp=$expected");
+      log (TYPING, e.loc, $ "(typing expression: $e, exp=$expected");
       Util.locate (e.loc, {
         def e' = InterceptSpecialMacros (e, expected);
         def e' = 
           try {
             if (e' != null) {
-              when (dump)
-                Message.Debug (e.loc, $ "intercepted: $e'");
+              log (TYPING, e.loc, $ "intercepted: $e'");
               e'
             } else {
-              when (dump)
-                Message.Debug (e.loc, $ "running expand with: $e");
+              log (TYPING, e.loc, $ "running expand with: $e");
               def e = MacroRegistry.expand_macro (this, e);
-              when (dump)
-                Message.Debug (e.loc, $ "after expansion: $e");
+              log (MACRO_EXPANSIONS, e.loc, $ "after expansion: $e");
 
               def res = DoType (e, expected, is_toplevel_in_seq);
               
-              when (dump)
-                Message.Debug (e.loc, $ "done typing: $e --> $res");
+              log (TYPING, e.loc, 
+                   $ "done typing: $e --> $res : $(if (res.ty != null) res.Type else null))");
               res
             }
           } catch {
@@ -2850,7 +2851,9 @@
           disable_warnings = true;
 
         PushLocals ();
+        log (TYPING, $ "{  typing patterns: $(case.patterns), t=$matched_value_type");
         def pats = TypePatterns (matched_value_type, case.patterns);
+        log (TYPING, $ "done typing patterns: $(case.patterns), t=$matched_value_type  }");
         messenger.CleanLocalError ();
         def body = TypeExpr (case.body);
         



More information about the svn mailing list