[svn] r6492: nemerle/trunk/ncc/typing/Macros.n

nazgul svnadmin at nemerle.org
Mon Aug 7 23:22:16 CEST 2006


Log:
Some simplification of null handing in quoted_expr and traverse of PExpr

Author: nazgul
Date: Mon Aug  7 23:22:10 2006
New Revision: 6492

Modified:
   nemerle/trunk/ncc/typing/Macros.n

Modified: nemerle/trunk/ncc/typing/Macros.n
==============================================================================
--- nemerle/trunk/ncc/typing/Macros.n	(original)
+++ nemerle/trunk/ncc/typing/Macros.n	Mon Aug  7 23:22:10 2006
@@ -550,6 +550,7 @@
   public quoted_expr (expr : PExpr) : PExpr 
   {
     match (expr) {
+      | null => <[ null ]>
       | <[ $(id : name) ]> =>
         assert (id.context != null, id.Id);
         <[ PExpr.Ref ($(quoted_name (id, id.context.GetMacroContext ()))) ]>
@@ -570,8 +571,7 @@
         <[ PExpr.Define ($(quoted_expr (name)), $(quoted_expr (val))) ]>
 
       | <[ mutable $name = $val ]> =>
-        def qval = if (val == null) <[ null ]> else quoted_expr (val);
-        <[ PExpr.DefMutable ($(quoted_expr (name)), $qval) ]>
+        <[ PExpr.DefMutable ($(quoted_expr (name)), $(quoted_expr (val))) ]>
         
       | <[ def .. $funs ]> =>
         match (funs) {
@@ -603,9 +603,6 @@
         }
 
       | <[ throw $exc ]> =>
-        if (exc == null)
-          <[ PExpr.Throw (null) ]> // throw;
-        else        
           <[ PExpr.Throw ($(quoted_expr (exc))) ]>
 
       | <[ ref $e ]> =>
@@ -887,8 +884,7 @@
   public TraverseExpr (ctx : option[Typer], expr : PExpr, in_pattern : bool,
                        call : bool * bool * PExpr -> PExpr) : PExpr
   {
-    if (expr == null)
-      <[ $(null) ]>
+    if (expr == null) null
     else
       Util.locate (expr.loc, {
         def expr = 



More information about the svn mailing list