[svn] r7752: nemerle/trunk: macros/Internals.n macros/assertions.n macros/compiler.n macros/core.n macros/...

IT svnadmin at nemerle.org
Mon Jul 30 04:02:04 CEST 2007


Log:
1. Working on debugging. 
2. Location refactoring.

Author: IT
Date: Mon Jul 30 04:01:47 2007
New Revision: 7752

Modified:
   nemerle/trunk/macros/Internals.n
   nemerle/trunk/macros/assertions.n
   nemerle/trunk/macros/compiler.n
   nemerle/trunk/macros/core.n
   nemerle/trunk/macros/operators.n
   nemerle/trunk/ncc/generation/DecisionTreeCompiler.n
   nemerle/trunk/ncc/generation/ILEmitter.n
   nemerle/trunk/ncc/generation/Typer3.n
   nemerle/trunk/ncc/generation/Typer4.n
   nemerle/trunk/ncc/hierarchy/ClassMembers.n
   nemerle/trunk/ncc/hierarchy/CustomAttribute.n
   nemerle/trunk/ncc/hierarchy/DelegateClassGen.n
   nemerle/trunk/ncc/hierarchy/MacroClassGen.n
   nemerle/trunk/ncc/hierarchy/NamespaceTree.n
   nemerle/trunk/ncc/hierarchy/TypeBuilder.n
   nemerle/trunk/ncc/misc/PrettyPrint.n
   nemerle/trunk/ncc/parsing/AST.n
   nemerle/trunk/ncc/parsing/MainParser.n
   nemerle/trunk/ncc/parsing/ParseTree.n
   nemerle/trunk/ncc/typing/ConstantFolder.n
   nemerle/trunk/ncc/typing/DecisionTreeBuilder.n
   nemerle/trunk/ncc/typing/MacroRegistry.n
   nemerle/trunk/ncc/typing/Macros.n
   nemerle/trunk/ncc/typing/OverloadPossibility.n
   nemerle/trunk/ncc/typing/TypedTree.n
   nemerle/trunk/ncc/typing/Typer-CallTyper.n
   nemerle/trunk/ncc/typing/Typer-DelayedTyping.n
   nemerle/trunk/ncc/typing/Typer-PatternTyper.n
   nemerle/trunk/ncc/typing/Typer.n
   nemerle/trunk/ncc/typing/Typer2.n

Modified: nemerle/trunk/macros/Internals.n
==============================================================================
--- nemerle/trunk/macros/Internals.n	(original)
+++ nemerle/trunk/macros/Internals.n	Mon Jul 30 04:01:47 2007
@@ -223,11 +223,11 @@
           val.Attributes |= NemerleAttributes.Static;
 
         def newdecl = <[ decl: ..$(val.modifiers) $(unique : name) : $(val.ty); ]>;
-        newdecl.loc = val.loc;
+        newdecl.Location = val.Location;
         t.Define (newdecl)
 
       | _ =>
-        Message.FatalError (field_box.loc, "malformed PropertyEmbeddedField (ICE?)")
+        Message.FatalError (field_box.Location, "malformed PropertyEmbeddedField (ICE?)")
     }
   }
 
@@ -271,11 +271,11 @@
           val.Attributes |= NemerleAttributes.Static;
 
         def newdecl = <[ decl: ..$(val.modifiers) $(unique : name) : $(val.ty); ]>;
-        newdecl.loc = val.loc;
+        newdecl.Location = val.Location;
         t.Define (newdecl)
 
       | _ =>
-        Message.FatalError (field_box.loc, "malformed EventEmbeddedField (ICE?)")
+        Message.FatalError (field_box.Location, "malformed EventEmbeddedField (ICE?)")
     }
   }
 
@@ -291,14 +291,3 @@
   }
 }
 
-
-
-
-
-
-
-
-
-
-
-

Modified: nemerle/trunk/macros/assertions.n
==============================================================================
--- nemerle/trunk/macros/assertions.n	(original)
+++ nemerle/trunk/macros/assertions.n	Mon Jul 30 04:01:47 2007
@@ -35,13 +35,13 @@
     match (cond) {
       | <[ false ]> =>
         // skip cond in this case so it gets 'a type
-        <[ throw AssertionException ($(cond.loc.File : string), 
-                                     $(cond.loc.Line : int),
+        <[ throw AssertionException ($(cond.Location.File : string), 
+                                     $(cond.Location.Line : int),
                                      "", $message) ]>
       | _ =>
         <[ unless ($cond) 
-             throw AssertionException ($(cond.loc.File : string), 
-                                       $(cond.loc.Line : int),
+             throw AssertionException ($(cond.Location.File : string), 
+                                       $(cond.Location.Line : int),
                                        $(cond.ToString () : string),
                                        $message) ]>
     }
@@ -71,7 +71,7 @@
     ]>);
     
     m.Body = newBody;
-    m.Body.loc = loc; // restore IsGenerated to false
+    m.Body.Location = loc; // restore IsGenerated to false
   }
 
   /// Example: foo ([Requires (value != 4)] i : int) : void { ... }

Modified: nemerle/trunk/macros/compiler.n
==============================================================================
--- nemerle/trunk/macros/compiler.n	(original)
+++ nemerle/trunk/macros/compiler.n	Mon Jul 30 04:01:47 2007
@@ -58,8 +58,8 @@
          unless (Message.SeenError)
            Message.Debug ("Internal compiler error, please report a bug to bugs.nemerle.org. "
                           "You can try modifying program near this location.");
-         throw AssertionException ($(cond.loc.File : string), 
-                                   $(cond.loc.Line : int),
+         throw AssertionException ($(cond.Location.File : string), 
+                                   $(cond.Location.Line : int),
                                    $cond.ToString (), $message)
        }
     ]>

Modified: nemerle/trunk/macros/core.n
==============================================================================
--- nemerle/trunk/macros/core.n	(original)
+++ nemerle/trunk/macros/core.n	Mon Jul 30 04:01:47 2007
@@ -590,8 +590,8 @@
 
   macro abort (message = <[ "" ]>) 
   {
-    <[ throw AssertionException ($(message.loc.File : string), 
-                                 $(message.loc.Line : int), "", $message) ]>
+    <[ throw AssertionException ($(message.Location.File : string), 
+                                 $(message.Location.Line : int), "", $message) ]>
   }
 
   /** MACROS EXTENDING TYPE SYSTEM OF LANGUAGE */
@@ -1114,7 +1114,7 @@
             def nseq = 
             List.Flatten (List.RevMap (List.Rev (seq), fun (e : Parsetree.PExpr) { 
               [<[
-                 def $("_line" : usesite) = $(e.loc.Line : int);
+                 def $("_line" : usesite) = $(e.Location.Line : int);
                  def $("_expr" : usesite) = $(exps_strings.Pop () : string);
                  $tracecall;
                ]>, e]
@@ -1134,7 +1134,7 @@
     };
     def bod = Macros.TraverseExpr (None (), m.Body, false, add);
     def newBody = Util.locate(m.Body.Location, <[ 
-      def $("_file" : usesite) = $(m.Body.loc.File : string);
+      def $("_file" : usesite) = $(m.Body.Location.File : string);
       def $("_method" : usesite) = $(m.Name : string);
       $bod;
     ]>);

Modified: nemerle/trunk/macros/operators.n
==============================================================================
--- nemerle/trunk/macros/operators.n	(original)
+++ nemerle/trunk/macros/operators.n	Mon Jul 30 04:01:47 2007
@@ -183,13 +183,13 @@
       | <[ $(nm : name) ]> => <[ parameter: $(nm : name) ]>
       | <[ $(nm : name) : $ty ]> => <[ parameter: $(nm : name) : $ty ]>
       | _ =>
-        Message.Error (x.loc, $"unsupported syntax for parameter of 'parms => body' lambda expression: $x");
+        Message.Error (x.Location, $"unsupported syntax for parameter of 'parms => body' lambda expression: $x");
         <[ parameter: $(Util.tmpname ("_") : dyn) ]>
     }
 
     def convert_to_ref (x) {
-      | <[ parameter: $(nm : name) ]> => PT.PExpr.Ref (x.loc, nm)
-      | _ => Message.FatalError (x.loc, "illegal spliced parameter?")
+      | <[ parameter: $(nm : name) ]> => PT.PExpr.Ref (x.Location, nm)
+      | _ => Message.FatalError (x.Location, "illegal spliced parameter?")
     }
 
     def convert_body (body, parms, loc) {
@@ -197,16 +197,16 @@
         | <[ match($(null)) { ..$cases } ]> =>
           def match_val = match (parms) {
             | [] => null
-            | [<[ parameter: $(nm : name) ]> as x] => PT.PExpr.Ref (x.loc, nm)
+            | [<[ parameter: $(nm : name) ]> as x] => PT.PExpr.Ref (x.Location, nm)
             | _ :: _ :: _ => PT.PExpr.Tuple (loc, parms.Map (convert_to_ref))
-            | x :: _ => Message.FatalError (x.loc, "illegal spliced parameter?")
+            | x :: _ => Message.FatalError (x.Location, "illegal spliced parameter?")
           }
-          PT.PExpr.Match (body.loc, match_val, cases)
+          PT.PExpr.Match (body.Location, match_val, cases)
         | _ => body
       }
     }
 
-    def loc = parms.loc;
+    def loc = parms.Location;
     def parms = match (parms) {
       | <[ () ]> => []
       | <[ (..$parms) ]> => parms.Map (convert_to_parm)

Modified: nemerle/trunk/ncc/generation/DecisionTreeCompiler.n
==============================================================================
--- nemerle/trunk/ncc/generation/DecisionTreeCompiler.n	(original)
+++ nemerle/trunk/ncc/generation/DecisionTreeCompiler.n	Mon Jul 30 04:01:47 2007
@@ -63,14 +63,14 @@
             def id = Util.next_id (body.Type.Manager);
             label_id = Some (id);
             if (parent.debug_mode) {
-              body = TExpr.Sequence (body.loc, body.Type, body,
+              body = TExpr.Sequence (body.Location, body.Type, body,
                           TExpr.Goto (Location.Default, 
                                       body.Type, parent.jump_out_id, 1));
-              body = TExpr.Label (body.loc, body.Type, id, body);
+              body = TExpr.Label (body.Location, body.Type, id, body);
               TExpr.Goto (null, id, 1)
             } else {
               body_emitted = true;
-              TExpr.Label (body.loc, body.Type, id, body)
+              TExpr.Label (body.Location, body.Type, id, body)
             }
         }
       }
@@ -82,7 +82,7 @@
         else
           assigns.FoldRight (effect_expr, fun (assign, acc) {
           def (name, value) = assign;
-          Util.locate (value.loc,
+          Util.locate (value.Location,
             TExpr.Sequence (effect_expr.Type,
               TExpr.Assign (TExpr.LocalRef (name.Type, name),
                             value),
@@ -95,7 +95,7 @@
         if (body_emitted || label_id.IsNone) prev
         else {
           body_emitted = true;
-          TExpr.Sequence (prev.loc, body.Type, prev, body)
+          TExpr.Sequence (prev.Location, body.Type, prev, body)
         }
       }
     }
@@ -137,6 +137,7 @@
                           "$(dag_to_string (decision, Manager.Options.ColorMessages))\n"
                           "$(get_stats (decision))\n");
 
+      // IT.TEMP ???
       debug_mode = if (cases.Length <= 2) false else Manager.Options.EmitDebug;
 
       collect_effects_and_guards ()
@@ -176,6 +177,7 @@
     {
       mutable body = compile (decision);
 
+      // IT.TEMP ???
       when (debug_mode)
         body = TExpr.MacroEnvelope (<[ skip_debug ]>, null, body);
 
@@ -183,14 +185,14 @@
         body = se.BuildRest (body);
 
       when (debug_mode)
-        body = TExpr.Sequence (body.loc, body.Type, 
+        body = TExpr.Sequence (body.Location, body.Type, 
                 // sequence point for the entire match
-                TExpr.Literal (body.loc, InternalType.Void, Literal.Void ()),
-                TExpr.Sequence (body.loc, body.Type, body, 
-                TExpr.Label (body.loc, body.Type, jump_out_id, 
+                TExpr.Literal (body.Location, InternalType.Void, Literal.Void ()),
+                TExpr.Sequence (body.Location, body.Type, body, 
+                  TExpr.Label (body.Location, body.Type, jump_out_id, 
                       // at the exit we got another one, otherwise
                       // the last match case is highlighted
-                      TExpr.Literal (body.loc, 
+                    TExpr.Literal (body.Location, 
                                 InternalType.Void, Literal.Void ()))));
 
       body
@@ -208,6 +210,7 @@
     // memoized TExpr or call compile2() to generate a new one
     compile (decision : Decision) : TExpr
     {
+      def expr = match (decision) {
       // for effects SharedEffect class is used to detect reusable nodes
       | Decision.Success => compile2 (decision)
 
@@ -217,7 +220,7 @@
             def label_id = Util.next_id (Manager);
             decision.LabelId = Some (label_id);
             def expr = compile2 (decision);
-            TExpr.Label (expr.loc, expr.Type, label_id, expr)
+              TExpr.Label (expr.Location, expr.Type, label_id, expr)
           | Some (id) =>
             TExpr.Goto (id, 1)
         }
@@ -225,6 +228,14 @@
       | _ => Util.locate (decision.Location, compile2 (decision))
     }
 
+      if (Manager.Options.EmitDebug && !decision.Location.IsGeneratedOrEmpty)
+      {
+        TExpr.DebugInfo(decision.Location, null, expr, null)
+      }
+      else
+        expr;
+    }
+
 
     compile2 (decision : Decision) : TExpr
     {
@@ -490,7 +501,7 @@
 
     static Sequence (e1 : TExpr, e2 : TExpr) : TExpr
     {
-      TExpr.Sequence (e1.loc, e2.Type, e1, e2)
+      TExpr.Sequence (e1.Location, e2.Type, e1, e2)
     }
 
     static HasType (e : TExpr, ti : TypeInfo) : TExpr

Modified: nemerle/trunk/ncc/generation/ILEmitter.n
==============================================================================
--- nemerle/trunk/ncc/generation/ILEmitter.n	(original)
+++ nemerle/trunk/ncc/generation/ILEmitter.n	Mon Jul 30 04:01:47 2007
@@ -131,7 +131,7 @@
       _label_usage.Iter (fun (id, v : TExpr) {
         // shouldn't happen now
         when (v != null)
-          Message.Error (v.loc, 
+          Message.Error (v.Location, 
                          $ "non local goto (block return?) detected (l$id)");
       })
     }
@@ -458,7 +458,7 @@
       unless (expr is TExpr.Goto || 
               expr is TExpr.Literal (Literal.Void) ||
               expr is TExpr.Label (_, Literal (Void))) {
-        Message.Warning (expr.loc,
+        Message.Warning (expr.Location,
                          "this expression has been skipped in code "
                          "generation because of unreachable code");
         //Message.Warning (expr.loc, expr.ToString ());
@@ -578,7 +578,7 @@
     {
       log (EMIT, $"{ emit: $expr");
       Util.cassert (expr != null);
-      Util.locate (expr.loc,
+      Util.locate (expr.Location,
       match (expr) {
 
         /* -- SEQUENCING --------------------------------------------------- */
@@ -647,7 +647,7 @@
         /* emits the if/then/else construction */
         | If (cond_expr, then_expr, else_expr) =>
           def emit_branch (expr : TExpr, else_label : Label) {
-            MaybeMark (expr.loc);
+            MaybeMark (expr.Location);
             match (expr) {
               | Call (OpCode ("=="), [nested_cond,
                  Parm where (expr = TExpr.TypeConversion(TExpr.Literal(Literal.Bool(true)), _, _, _))], _) =>
@@ -726,7 +726,7 @@
             match (cond_expr)
             {
             | HasType(LocalRef(decl), _) when decl.NameLocation.IsEmpty && decl.Name.StartsWith("_N_") => ()
-            | _ => MaybeMark (cond_expr.loc);
+            | _ => MaybeMark (cond_expr.Location);
             }
           }
 
@@ -801,7 +801,7 @@
           
         /* load runtime representation of given type */
         | TypeOf (t) =>
-          MaybeMark (expr.loc);
+          MaybeMark (expr.Location);
           _ilg.Emit (OpCodes.Ldtoken, t.SystemType);
           _ilg.Emit (OpCodes.Call, SystemTypeCache.Type_GetTypeFromHandle);
 
@@ -844,7 +844,7 @@
             _labels [id] = _ilg.DefineLabel ();
           }
           
-          Mark (expr.loc);
+          Mark (expr.Location);
           if (try_block == 0)
             _ilg.Emit (OpCodes.Br, _labels [id])
           else {
@@ -879,7 +879,7 @@
           _ilg.Emit (OpCodes.Unbox_Any, cast_to_type.SystemType);
           
         | TypeConversion (ignored, ty, _, _) when is_void (ty) =>
-          Mark (expr.loc);
+          Mark (expr.Location);
           // a little trickery, so emit can be tail called sometimes
           if (is_void (ignored.Type))
             emit (ignored)
@@ -911,11 +911,11 @@
           else {
             /* upcast / downcast non-value types */
             def cast_to_type = cast_to_type.SystemType;
-            Mark (expr.loc);
+            Mark (expr.Location);
             when (expr.SystemType.IsArray && cast_to_type.IsArray &&
                   expr.SystemType.GetElementType ().IsValueType !=
                   cast_to_type.GetElementType ().IsValueType)
-              Message.Error (expr.loc, $ "attempting to cast a value type array "
+              Message.Error (expr.Location, $ "attempting to cast a value type array "
                                          "$(expr.SystemType) to non-value type array "
                                          "$(cast_to_type) which cannot succeed");
             unless (kind is ConversionKind.UpCast)
@@ -924,7 +924,7 @@
 
         /* unbox value types or perform value type conversion */
         | TypeConversion (val, cast_to_type, kind, _) =>
-          MaybeMark (expr.loc);
+          MaybeMark (expr.Location);
           def is_checked = ! (kind is IL (false));
           emit (val);
           def type_of_expr = val.SystemType;
@@ -938,7 +938,7 @@
 
           if (type_of_expr.IsValueType) {
             /* perform conversion of value types */
-            emit_value_type_conversion (expr.loc, val.MType, cast_to_type.Fix (), is_checked)
+            emit_value_type_conversion (expr.Location, val.MType, cast_to_type.Fix (), is_checked)
           }
           else if (is_generic || 
                    SystemTypeCache.Object : object == type_of_expr || 
@@ -962,13 +962,13 @@
 
         /* load the value of a local variable or a method parameter */
         | LocalRef (decl) =>
-          MaybeMark (expr.loc);
+          MaybeMark (expr.Location);
           unless (is_void (decl.Type))
             emit_ce_ref (decl, get_address_for_value_types = expr.NeedAddress)
 
         /* load the value of a field */
         | FieldMember (base_object, field) =>
-          MaybeMark (expr.loc);
+          MaybeMark (expr.Location);
           def result_will_be_address = expr.NeedAddress;
           
           limited_debug_nesting++;
@@ -991,7 +991,7 @@
 
         /* load the value of a static field */
         | StaticRef (t, f is IField, _) =>
-          MaybeMark (expr.loc);
+          MaybeMark (expr.Location);
           def field_info = GetFieldInfo (t.SystemType, f);
           
           assert (field_info.IsStatic, "GlobalRef to a non-static field");
@@ -1010,7 +1010,7 @@
 
         /* load an array element */
         | ArrayIndexer (array_obj, [index]) =>
-          MaybeMark (expr.loc);
+          MaybeMark (expr.Location);
           limited_debug_nesting++;
           emit (array_obj);
           emit (index);
@@ -1025,7 +1025,7 @@
           
 
         | ArrayIndexer (array_obj, indexes) =>
-          MaybeMark (expr.loc);
+          MaybeMark (expr.Location);
           limited_debug_nesting++;
           emit (array_obj);
           List.Iter (indexes, emit);
@@ -1045,14 +1045,14 @@
         
         /* special case these assignments for performance */
         | Assign (LocalRef (decl), ImplicitValueTypeCtor as ctr) =>
-          Mark (expr.loc);
+          Mark (expr.Location);
           emit_ce_ref (decl, get_address_for_value_types = true);
           _ilg.Emit (OpCodes.Initobj, ctr.SystemType);
 
      
         /* assignment to ref/out parameter */
         | Assign (LocalRef (local_var), val) when local_var.IsByRefParm =>
-          Mark (expr.loc);
+          Mark (expr.Location);
           emit_ldarg (local_var.ParmIndex);
           limited_debug_nesting++;
           emit (val);
@@ -1066,7 +1066,7 @@
 
         /* assignment to a local variable */
         | Assign (LocalRef (local_var), val) =>
-          Mark (expr.loc); 
+          Mark (expr.Location); 
           limited_debug_nesting++;
           emit (val);
           limited_debug_nesting--;
@@ -1076,7 +1076,7 @@
 
         /* assignment to a field */
         | Assign (FieldMember (base_object, field) as target, val) =>
-          Mark (expr.loc);
+          Mark (expr.Location);
           limited_debug_nesting++;
           emit (base_object);
           emit (val);
@@ -1090,7 +1090,7 @@
 
         /* assignment to a static field */
         | Assign (StaticRef (t, f is IField, _) as target, val) =>
-          Mark (expr.loc);
+          Mark (expr.Location);
           limited_debug_nesting++;
           emit (val);
           limited_debug_nesting--;
@@ -1103,7 +1103,7 @@
 
         /* assignment to an array element */
         | Assign (ArrayIndexer (array_obj, [index]) as target, val) =>
-          Mark (expr.loc);
+          Mark (expr.Location);
           def type_of_val = val.SystemType;
           limited_debug_nesting++;
           emit (array_obj);
@@ -1116,7 +1116,7 @@
           emit_array_store_opcode (target.SystemType);
 
         | Assign (ArrayIndexer (array_obj, indexes), val) =>
-          Mark (expr.loc);
+          Mark (expr.Location);
           limited_debug_nesting++;
           emit (array_obj);
           List.Iter (indexes, emit);
@@ -1250,7 +1250,7 @@
 
             | "unary.-.s" =>
               _ilg.Emit (OpCodes.Ldc_I4_M1);
-              emit_value_type_conversion (expr.loc, InternalType.Int32,
+              emit_value_type_conversion (expr.Location, InternalType.Int32,
                                           parms.Head.expr.MType, true);
               _ilg.Emit (OpCodes.Mul_Ovf)
             | "unary.-.f" =>
@@ -1359,11 +1359,11 @@
 
         /* throw an exception */
         | Throw (null) =>
-          Mark (expr.loc);
+          Mark (expr.Location);
           _ilg.Emit (OpCodes.Rethrow);
         
         | Throw (exc) =>
-          Mark (expr.loc);
+          Mark (expr.Location);
           limited_debug_nesting++;
           emit (exc);
           limited_debug_nesting--;
@@ -1515,7 +1515,7 @@
             match (expr.MType) {
               | TyVarRef 
               | Class (tc,[_]) when tc.Equals (InternalType.Generic_Nullable_tc) =>
-                emit (TExpr.DefaultValue (expr.loc, expr.Type))
+                emit (TExpr.DefaultValue (expr.Location, expr.Type))
               | _ => emit_literal (l);
             }
           else if (l is Literal.Void) {
@@ -1527,7 +1527,7 @@
 
         /* loads address of given method */
         | MethodAddress (from, meth, is_virt, typarms) =>
-          MaybeMark (expr.loc);
+          MaybeMark (expr.Location);
           def meth = GetMethodInfo (from, meth, typarms);
           if (is_virt && meth.IsVirtual) {
             // ldvirtftn expects also an object reference
@@ -1541,7 +1541,7 @@
 
         /* creates object of value type using implicit ctor */
         | ImplicitValueTypeCtor =>
-          MaybeMark (expr.loc);
+          MaybeMark (expr.Location);
           when (_debug_doc != null) _ilg.BeginScope ();
           def t = expr.SystemType;
           def local_slot = _ilg.DeclareLocal (t);
@@ -1553,7 +1553,7 @@
 
         /* creates a new array, given a list of initializers */
         | Array (initializers, [size]) =>
-          MaybeMark (expr.loc);
+          MaybeMark (expr.Location);
           def element_type =
             match (expr.Type.Fix ()) {
               | MType.Array (t, _) => t.SystemType
@@ -1582,7 +1582,7 @@
           load_elements (0, initializers);
 
         | Array (initializers, dimensions) =>
-          MaybeMark (expr.loc);
+          MaybeMark (expr.Location);
           limited_debug_nesting++;
           mutable size = 0;
           foreach (element in dimensions) {
@@ -1659,7 +1659,7 @@
           _ilg.MarkSequencePoint (_debug_doc, line, col, eline, ecol);
         }
 
-        def l = di.loc;
+        def l = di.Location;
 
         match (di.pexpr)
         {

Modified: nemerle/trunk/ncc/generation/Typer3.n
==============================================================================
--- nemerle/trunk/ncc/generation/Typer3.n	(original)
+++ nemerle/trunk/ncc/generation/Typer3.n	Mon Jul 30 04:01:47 2007
@@ -184,7 +184,7 @@
 
     public Run () : void
     {
-      Util.locate (current_local_fun.loc, {
+      Util.locate (current_local_fun.Location, {
         //Message.Debug ($"T3::run: $(current_local_fun.name)");
         start_label = Util.next_id (Manager);
 
@@ -1197,43 +1197,43 @@
            => e
 
           | TExpr.FieldMember (e, z) => 
-             TExpr.FieldMember (o.loc, o.ty, inject (e), z)
+             TExpr.FieldMember (o.Location, o.ty, inject (e), z)
 
           | TExpr.MethodRef (e, z, x, c) => 
-             TExpr.MethodRef (o.loc, o.ty, inject (e), z, x, c)
+             TExpr.MethodRef (o.Location, o.ty, inject (e), z, x, c)
 
-          | TExpr.Throw (e) => TExpr.Throw (o.loc, o.ty, inject (e))
+          | TExpr.Throw (e) => TExpr.Throw (o.Location, o.ty, inject (e))
 
           | TExpr.DefFunctionsIn (q, e) => 
-             TExpr.DefFunctionsIn (o.loc, o.ty, q, inject (e))
+             TExpr.DefFunctionsIn (o.Location, o.ty, q, inject (e))
 
           | TExpr.DefValIn (z, v, e) => 
-             TExpr.DefValIn (o.loc, o.ty, z, inject (v), inject (e))
+             TExpr.DefValIn (o.Location, o.ty, z, inject (v), inject (e))
 
           | TExpr.HasType (e, z) => 
-             TExpr.HasType (o.loc, o.ty, inject (e), z)
+             TExpr.HasType (o.Location, o.ty, inject (e), z)
 
           | TExpr.MacroEnvelope (z, x, e) => 
-             TExpr.MacroEnvelope (o.loc, o.ty, z, x, inject (e))
+             TExpr.MacroEnvelope (o.Location, o.ty, z, x, inject (e))
 
           | TExpr.TypeConversion (e, z, x, c) => 
-             TExpr.TypeConversion (o.loc, o.ty, inject (e), z, x, c)
+             TExpr.TypeConversion (o.Location, o.ty, inject (e), z, x, c)
 
           | TExpr.Label (z, e) => 
-             TExpr.Label (o.loc, o.ty, z, inject (e))
+             TExpr.Label (o.Location, o.ty, z, inject (e))
 
           | TExpr.Call (e, p, t) when IsBaseCtor (e) => 
              def p = List.Map (p,
                    x => Parm (x.kind, inject (x.expr), x.name, x.required_type)
              );
-             def expr = TExpr.Call (o.loc, o.ty, e, p, t);
+             def expr = TExpr.Call (o.Location, o.ty, e, p, t);
              match ((inits, post_init)) {
                | (null, null) => expr
-               | (_, null) => TExpr.Sequence (o.loc, o.ty, inits, expr)
-               | (null, _) => TExpr.Sequence (o.loc, o.ty, expr, post_init);
-               | _ => TExpr.Sequence (o.loc, o.ty, 
+               | (_, null) => TExpr.Sequence (o.Location, o.ty, inits, expr)
+               | (null, _) => TExpr.Sequence (o.Location, o.ty, expr, post_init);
+               | _ => TExpr.Sequence (o.Location, o.ty, 
                         inits, 
-                        TExpr.Sequence (o.loc, o.ty, expr, post_init)
+                        TExpr.Sequence (o.Location, o.ty, expr, post_init)
                       )
              }
 
@@ -1241,67 +1241,67 @@
              def p = List.Map (p,
                  x => Parm (x.kind, inject (x.expr), x.name, x.required_type)
              );
-             def expr = TExpr.Call (o.loc, o.ty, e, p, t);
+             def expr = TExpr.Call (o.Location, o.ty, e, p, t);
              match (post_init) {
                | null => expr
-               | _ => TExpr.Sequence (o.loc, o.ty, expr, post_init)
+               | _ => TExpr.Sequence (o.Location, o.ty, expr, post_init)
              }
 
           | TExpr.Call => e
 
           | TExpr.Assign (a, b) => 
-             TExpr.Assign (o.loc, o.ty, inject (a), inject (b))
+             TExpr.Assign (o.Location, o.ty, inject (a), inject (b))
 
           | TExpr.TryFinally (b, h) => 
-             TExpr.TryFinally (o.loc, o.ty, inject (b), inject (h))
+             TExpr.TryFinally (o.Location, o.ty, inject (b), inject (h))
 
           | TExpr.Try (b, cs) => 
-             TExpr.Try (o.loc, o.ty, inject (b), cs)
+             TExpr.Try (o.Location, o.ty, inject (b), cs)
 
           | TExpr.Sequence (a, b) => 
-             TExpr.Sequence (o.loc, o.ty, inject (a), inject (b))
+             TExpr.Sequence (o.Location, o.ty, inject (a), inject (b))
 
           | TExpr.MultipleAssign (la) => 
-             TExpr.MultipleAssign (o.loc, o.ty, 
+             TExpr.MultipleAssign (o.Location, o.ty, 
                List.Map (  la, x => (x[0], inject (x[1]))  )
              )
 
           | TExpr.Tuple (l) => 
-             TExpr.Tuple (o.loc, o.ty, List.Map (l, inject))
+             TExpr.Tuple (o.Location, o.ty, List.Map (l, inject))
 
           | TExpr.Array (l, d) => 
-             TExpr.Array (o.loc, o.ty, 
+             TExpr.Array (o.Location, o.ty, 
                List.Map (l, inject), List.Map (d, inject)
              )
 
           | TExpr.ArrayIndexer (a, l) => 
-             TExpr.ArrayIndexer (o.loc, o.ty, 
+             TExpr.ArrayIndexer (o.Location, o.ty, 
                inject (a), 
                List.Map (l, inject)
              )
 
           | TExpr.TupleIndexer (a, z, x) => 
-             TExpr.TupleIndexer (o.loc, o.ty, inject (a), z, x)
+             TExpr.TupleIndexer (o.Location, o.ty, inject (a), z, x)
 
           | TExpr.If (c, a, b) => 
-             TExpr.If (o.loc, o.ty, inject (c), inject (a), inject (b))
+             TExpr.If (o.Location, o.ty, inject (c), inject (a), inject (b))
 
           | TExpr.Switch (e, Some (c), cs) => 
-             TExpr.Switch (o.loc, o.ty, 
+             TExpr.Switch (o.Location, o.ty, 
                inject (e), 
                Some (inject (c)), 
                List.Map (  cs, x => (x[0], inject (x[1]))  )
              )
 
           | TExpr.Switch (e, None, cs) => 
-             TExpr.Switch (o.loc, o.ty, 
+             TExpr.Switch (o.Location, o.ty, 
                inject (e), 
                None (), 
                List.Map (  cs, x => (x[0], inject (x[1]))  )
              )
 
           | TExpr.Match (e, cs) => 
-             TExpr.Match (o.loc, o.ty, 
+             TExpr.Match (o.Location, o.ty, 
                inject (e), 
                List.Map (cs, x => 
                 Match_case (x.patterns, inject (x.body), x.disable_warnings)
@@ -1310,7 +1310,7 @@
 
           | TExpr.DebugInfo (e, pe) =>
             def e = inject(e);
-            TExpr.DebugInfo (o.loc, e.ty, e, pe);
+            TExpr.DebugInfo (o.Location, e.ty, e, pe);
 
           //invalid things
           | TExpr.PropertyMember 
@@ -1337,7 +1337,7 @@
         //deny ctor calls from local funs
         def f (_) {
           | TExpr.Call (e, _, _) as o when IsCtor (e) 
-           => Message.Error (o.loc, "Constructor call inside local function "
+           => Message.Error (o.Location, "Constructor call inside local function "
                                       "or loop isn't allowed");
               Some (true)
           | _ => None ()
@@ -1369,7 +1369,7 @@
           //Value types cannot call base ctor, so they can call several this()
           def f (_) {
             | TExpr.Call (e, _, _) as o when IsBaseCtor (e)
-             => Message.Error (o.loc, "Base constructor call in struct isn't allowed");
+             => Message.Error (o.Location, "Base constructor call in struct isn't allowed");
                 Some (false)
             | _ => None ()
           }
@@ -1394,7 +1394,7 @@
               | (0, 0) => 
                 def bc = ptyper.TypeExpr ( <[ base () ]> );
                 def bc = ptyper2.Walk (Typer2.Context.TopLevel, bc);
-                TExpr.Sequence (e.loc, e.ty, bc, e);
+                TExpr.Sequence (e.Location, e.ty, bc, e);
               | (1, 1) => e
               | (0, _) => 
                 Message.Warning ("Base constructor call can be missed");
@@ -1444,19 +1444,19 @@
                 Some (true)
             | TExpr.FieldMember (e, f) as expr when IsThis (e)
              => when (IsBaseField (f))
-                  Message.Error (expr.loc,
+                  Message.Error (expr.Location,
                     "using base class field before base is constructed");
                 Some (false)
             | TExpr.MethodRef (e, m, _, _) as expr when IsThis (e)
              => if (IsBaseMethod (m))
-                  Message.Error (expr.loc,
+                  Message.Error (expr.Location,
                     "using base class method before base is constructed");
                 else
-                  Message.Error (expr.loc,
+                  Message.Error (expr.Location,
                     "using class method before base is constructed (``this'' isn't yet initialized)");
                 Some (false)
             | e when IsThis (e)
-             => Message.Error (e.loc,
+             => Message.Error (e.Location,
                   "``this'' or ``base'' usage before base is constructed");
                 Some (false)
             | _ => None ()
@@ -2012,7 +2012,7 @@
           }
         });
 
-      expr.loc = m.Location;
+      expr.Location = m.Location;
       Walk (expr)
     }
     #endregion

Modified: nemerle/trunk/ncc/generation/Typer4.n
==============================================================================
--- nemerle/trunk/ncc/generation/Typer4.n	(original)
+++ nemerle/trunk/ncc/generation/Typer4.n	Mon Jul 30 04:01:47 2007
@@ -66,7 +66,7 @@
 
     public Run () : void
     {
-      Util.locate (current_fun.loc, {
+      Util.locate (current_fun.Location, {
         match (current_fun.body) {
           | FunBody.Typed (body) =>
             label_blocks.Clear ();
@@ -205,7 +205,7 @@
     NoThrowPlease (e : TExpr) : void
     {
       when (Throws (e))
-        Message.Error (e.loc, "`throw' is not allowed here");
+        Message.Error (e.Location, "`throw' is not allowed here");
     }
 
     NoDeepVoid (expr : TExpr, t : TyVar) : void
@@ -215,7 +215,7 @@
         | Class (_, tp) =>
           foreach (t in tp)
             when (t.Fix ().Equals (InternalType.Void))
-              Message.Error (expr.loc, $ "cannot use `void' in generic specifier of $expr");
+              Message.Error (expr.Location, $ "cannot use `void' in generic specifier of $expr");
         | _ => {}
       }
     }
@@ -260,7 +260,7 @@
             if (label_blocks.Contains (id))
               g.try_block -= label_blocks [id];
             else
-              Message.Error (expr.loc, 
+              Message.Error (expr.Location, 
                              $ "non local goto (block return?) detected (l$id)");
             true
 
@@ -279,7 +279,7 @@
 
           | Assign (e1, e2) =>
             when (Throws (e1))
-              Message.Error (expr.loc, "`throw' in assignment target");
+              Message.Error (expr.Location, "`throw' in assignment target");
 
             if (e1 is TExpr.LocalRef)
               if (Throws (e2, allow_try)) {
@@ -289,7 +289,7 @@
               } else false
             else
               if (Throws (e2)) {
-                Message.Error (expr.loc, "`throw' in assignment source");
+                Message.Error (expr.Location, "`throw' in assignment source");
                 true
               } else false
 
@@ -377,7 +377,7 @@
               | p :: ps =>
                 def fst = Throws (p.expr, allow_try);
                 if (fst) 
-                  Message.Error (p.expr.loc, "`throw' is not allowed here");
+                  Message.Error (p.expr.Location, "`throw' is not allowed here");
                 else 
                   foreach (parm in ps) NoThrowPlease (parm.expr);
                   
@@ -406,7 +406,7 @@
           | TryFinally (body, handler) =>
             when (! allow_try)
               // use ice here?
-              Message.Error (expr.loc, 
+              Message.Error (expr.Location, 
                              "try-blocks cannot be used inside expressions, "
                              "this message shouldn't happen though");
             _ = Throws (body, true);
@@ -416,7 +416,7 @@
           | Try (body, cases) =>
             when (! allow_try)
               // use ice here?
-              Message.Error (expr.loc, 
+              Message.Error (expr.Location, 
                              "try-blocks cannot be used inside expressions, "
                              "this message shouldn't happen though");
             def walk_case (case) {
@@ -714,7 +714,7 @@
           | MethodRef (_expr, meth, tp, _) =>
             foreach (t in tp)
               when (t.Fix ().Equals (InternalType.Void))
-                Message.Error (expr.loc, $ "cannot use `void' in generic specifier $tp of $meth");
+                Message.Error (expr.Location, $ "cannot use `void' in generic specifier $tp of $meth");
             null
             
           | _ => null

Modified: nemerle/trunk/ncc/hierarchy/ClassMembers.n
==============================================================================
--- nemerle/trunk/ncc/hierarchy/ClassMembers.n	(original)
+++ nemerle/trunk/ncc/hierarchy/ClassMembers.n	Mon Jul 30 04:01:47 2007
@@ -82,7 +82,7 @@
     _ast = ast;
     _ast._builder = this;
     Env = ast.Env;
-    loc = ast.loc;
+    loc = ast.Location;
     modifiers = ast.modifiers;
     name = ast.Name; 
     id = Util.next_id (Manager);
@@ -1014,7 +1014,7 @@
           | <[ $t ]> => (ParmKind.Normal, bind (t))
         }
       def fp =
-        Fun_parm (loc = p.loc, name = name.Id, color = name.color,
+        Fun_parm (loc = p.Location, name = name.Id, color = name.color,
                   ty = ty, ty_loc = p.ty.Location,
                   modifiers = p.modifiers, kind = kind);
 
@@ -1042,7 +1042,7 @@
             // make the first argument intercept custom attributes
             def mods = modifiers;
             modifiers = Modifiers.Empty;
-            Fun_parm (loc = parm.loc, 
+            Fun_parm (loc = parm.Location, 
                       name = Util.tmpname ("tupled"),
                       color = Manager.MacroColors.Color,
                       kind = ParmKind.Normal,
@@ -1131,7 +1131,7 @@
       name         = this.name,
       parms        = parms,
       tenv         = tenv',
-      loc          = f.header.loc);
+      loc          = f.header.Location);
 
     fun_header.body = fun_body;
     

Modified: nemerle/trunk/ncc/hierarchy/CustomAttribute.n
==============================================================================
--- nemerle/trunk/ncc/hierarchy/CustomAttribute.n	(original)
+++ nemerle/trunk/ncc/hierarchy/CustomAttribute.n	Mon Jul 30 04:01:47 2007
@@ -279,7 +279,7 @@
     internal CheckAttribute (env : GlobalEnv, expr : PT.PExpr)
     : TypeInfo * list [PT.PExpr]
     {
-      Util.locate (expr.loc, 
+      Util.locate (expr.Location,
         match (ResolveAttribute (env, expr)) {
           | Some ((t, parms)) =>
             def parms = List.Map (parms, fun (expr) { 
@@ -499,7 +499,7 @@
         def take_string (pars) {
           | [ <[ $(x : string) ]> ] => x
           | _ =>
-            Message.FatalError (attr.loc, "given attribute must have single string as parameter")
+            Message.FatalError (attr.Location, "given attribute must have single string as parameter")
         }
         if (tc.Equals (InternalType.AssemblyVersionAttribute_tc))
         {
@@ -528,13 +528,13 @@
                   SY.Version (x1, x2, x3, (spanRevision.Ticks / 20000000) :> int)
                 | [x1, x2, x3, x4] => SY.Version (x1, x2, x3, x4)
                 | _ =>
-                  Message.Error (attr.loc, "invalid format of version attribute");
+                  Message.Error (attr.Location, "invalid format of version attribute");
                   SY.Version ();
               }
           }
           catch {
             | _ is SY.OverflowException =>
-              Message.Error (attr.loc, "wrong format of version attribute");
+              Message.Error (attr.Location, "wrong format of version attribute");
               version_object = SY.Version ();
           }
 
@@ -544,9 +544,9 @@
         {
           def key = take_string (parms);
           if (an.KeyPair != null)
-            Message.Warning (attr.loc, "AssemblyKeyFile attribute will be ignored, as key file was already specified")
+            Message.Warning (attr.Location, "AssemblyKeyFile attribute will be ignored, as key file was already specified")
           else
-            when (key != "") an.KeyPair = read_keypair (attr.loc, key);
+            when (key != "") an.KeyPair = read_keypair (attr.Location, key);
         }
         else when (tc.Equals (InternalType.AssemblyCultureAttribute_tc))
           an.CultureInfo = SY.Globalization.CultureInfo (take_string (parms));

Modified: nemerle/trunk/ncc/hierarchy/DelegateClassGen.n
==============================================================================
--- nemerle/trunk/ncc/hierarchy/DelegateClassGen.n	(original)
+++ nemerle/trunk/ncc/hierarchy/DelegateClassGen.n	Mon Jul 30 04:01:47 2007
@@ -43,9 +43,9 @@
                                     parent_type : TypeBuilder,
                                     attrs : Modifiers, header : Fun_header) : TypeBuilder
     {
-      Util.locate (header.loc, {
+      Util.locate (header.Location, {
         when ((attrs.mods %& ~NemerleAttributes.AccessModifiers) != NemerleAttributes.None)
-          Message.Error (header.loc, "delegates are only allowed to have access specifiers as attributes");
+          Message.Error (header.Location, "delegates are only allowed to have access specifiers as attributes");
         
         attrs.mods |= NemerleAttributes.Sealed;
 
@@ -92,7 +92,7 @@
       | x :: xs =>
         def hasnt_params (x) { !(x is <[ System.ParamArrayAttribute ]>) }
         if (!List.ForAll (x.modifiers.custom_attrs, hasnt_params))
-          Fun_parm (x.loc, x.name, x.ty, Modifiers (x.modifiers.mods, x.modifiers.custom_attrs.Filter (hasnt_params)))
+          Fun_parm (x.Location, x.name, x.ty, Modifiers (x.modifiers.mods, x.modifiers.custom_attrs.Filter (hasnt_params)))
           :: create_begin_invoke_parms(xs);
         else
           x :: create_begin_invoke_parms(xs);

Modified: nemerle/trunk/ncc/hierarchy/MacroClassGen.n
==============================================================================
--- nemerle/trunk/ncc/hierarchy/MacroClassGen.n	(original)
+++ nemerle/trunk/ncc/hierarchy/MacroClassGen.n	Mon Jul 30 04:01:47 2007
@@ -72,7 +72,7 @@
     internal GenerateMacroClass (Manager : ManagerClass, decl : TopDeclaration.Macro,
                                  ns_node : NamespaceTree.Node) : void
     {
-      def loc = decl.loc;      
+      def loc = decl.Location;
       def header = decl.header;      
       def name = 
         match (header.name) {
@@ -490,7 +490,7 @@
           name;
           
       // build macro class
-      Util.locate (expr.loc, {
+      Util.locate (expr.Location, {
         attrs.mods |= NemerleAttributes.Macro %| NemerleAttributes.Public %| 
                       NemerleAttributes.Sealed;
 
@@ -607,7 +607,7 @@
             macro_exprs.Map (
               fun (_) {
                 | PExpr.Sequence (seq) as x => 
-                  PExpr.Sequence (x.loc, seq + [ <[ () ]> ])
+                  PExpr.Sequence (x.Location, seq + [ <[ () ]> ])
                 | x => <[ $x; () ]>
               }
             );
@@ -721,10 +721,10 @@
                 grammar_token
                 
               | None =>
-                Message.FatalError (tok.loc, "parameters from syntax description doesn't"
+                Message.FatalError (tok.Location, "parameters from syntax description doesn't"
                                      " match macro's")
             }
-          | _ => Message.FatalError (tok.loc, "unsupported syntax token")
+          | _ => Message.FatalError (tok.Location, "unsupported syntax token")
         }
       };
       def rule = List.FoldRight (toks, null, analyze_one);

Modified: nemerle/trunk/ncc/hierarchy/NamespaceTree.n
==============================================================================
--- nemerle/trunk/ncc/hierarchy/NamespaceTree.n	(original)
+++ nemerle/trunk/ncc/hierarchy/NamespaceTree.n	Mon Jul 30 04:01:47 2007
@@ -598,7 +598,7 @@
               x :: acc
               
             | _ =>
-              Message.Error (newdecl.loc, "redefinition of external type `" +
+              Message.Error (newdecl.Location, "redefinition of external type `" +
                              x.FullName + "'");
               Message.Error (x.Location, "first defined here");
               builder = Manager.Hierarchy.CreateTypeBuilder (par, newdecl, ns_node);

Modified: nemerle/trunk/ncc/hierarchy/TypeBuilder.n
==============================================================================
--- nemerle/trunk/ncc/hierarchy/TypeBuilder.n	(original)
+++ nemerle/trunk/ncc/hierarchy/TypeBuilder.n	Mon Jul 30 04:01:47 2007
@@ -135,8 +135,8 @@
       par.contained_types = this :: par.contained_types;
 
     this.name = pt_name.Id;
-    this.loc = td.loc;
-    this.parts_location = [td.loc];
+    this.loc = td.Location;
+    this.parts_location = [td.Location];
     modifiers = td.modifiers;
     attributes = modifiers.mods;
 
@@ -974,7 +974,7 @@
           def tp2 = x.typarms;
           foreach (tv in tp2.tyvars)
             when (ht.Contains (tv.GetName ())) {
-              Message.Error (x.loc,
+              Message.Error (x.Location,
                              $ "type parameter `$(tv.GetName ())' has the same "
                                "name as type parameter from the outer "
                                "type `$(this)'");
@@ -1338,11 +1338,11 @@
       additional.Attributes |= attributes & (NemerleAttributes.Abstract | NemerleAttributes.Sealed);
       
       when (additional.Attributes != attributes)
-        Message.Error (additional.loc, $"joined partial classes `$(FullName)' "
+        Message.Error (additional.Location, $"joined partial classes `$(FullName)' "
                        "must have compatible modifiers");
     }
     else {
-      Message.Error (additional.loc, "you must specify `partial' modifier on all"
+      Message.Error (additional.Location, "you must specify `partial' modifier on all"
                      " declarations of type `" + FullName + "'");
       Message.Error (this.Location, "first defined here");
     }
@@ -1362,7 +1362,7 @@
 
         this.parts_location ::= additional.Location;
       | _ =>
-        Message.Error (additional.loc, "`partial' modifier can be used only"
+        Message.Error (additional.Location, "`partial' modifier can be used only"
                        " before `class', `struct', `interface' or `variant'")
     }
     
@@ -1651,7 +1651,7 @@
     when (class_member.Env == null)
       class_member._env = GlobalEnv;
 
-    Util.locate (class_member.loc, {
+    Util.locate (class_member.Location, {
       // if current class is static (it's a module) then sign its members to static
       when (IsModule)
         class_member.Attributes |= NemerleAttributes.Static;      
@@ -1739,7 +1739,7 @@
       else e
     }
     def no_refs = 
-      Util.locate (expr.loc, {
+      Util.locate (expr.Location, {
         Macros.TraverseExpr (None (), expr, false, resolve_ref)
       });
     
@@ -1748,16 +1748,16 @@
         match (lit.WithType (underlying_enum_type)) {
           | Some (l) => l :> Literal.Integer
           | None =>
-            Message.Error (expr.loc, $"supplied value $(lit) cannot be converted to $(underlying_enum_type)"
+            Message.Error (expr.Location, $"supplied value $(lit) cannot be converted to $(underlying_enum_type)"
                            " and isn't valid as enum field initializer");
             default_value
         }
           
       | _ =>
-        Message.Error (expr.loc, "enum definition expression is too complex");
-        Message.Hint (expr.loc, "  enum definitions are allowed to be expressions taking constants,");
-        Message.Hint (expr.loc, "  references to this enum's fields preceding this field, checked ");
-        Message.Hint (expr.loc, "  operations +, <<, >> and -, bit-wise operations |, %, ^ and ~ negation");
+        Message.Error (expr.Location, "enum definition expression is too complex");
+        Message.Hint  (expr.Location, "  enum definitions are allowed to be expressions taking constants,");
+        Message.Hint  (expr.Location, "  references to this enum's fields preceding this field, checked ");
+        Message.Hint  (expr.Location, "  operations +, <<, >> and -, bit-wise operations |, %, ^ and ~ negation");
         default_value
     }
   }
@@ -1784,7 +1784,7 @@
 
           ef.Attributes |= (NemerleAttributes.Public | NemerleAttributes.Static);
           def field = <[ decl: ..$(ef.modifiers) $(ef.name) : $field_type; ]>;
-          field.loc = ef.loc;
+          field.Location = ef.Location;
           def field = bind_and_add_member (field);
           (field :> FieldBuilder).ConstValue = current_value;
           // Message.Debug ($ "add: $(ef.ParsedName.Id) $current_value ");

Modified: nemerle/trunk/ncc/misc/PrettyPrint.n
==============================================================================
--- nemerle/trunk/ncc/misc/PrettyPrint.n	(original)
+++ nemerle/trunk/ncc/misc/PrettyPrint.n	Mon Jul 30 04:01:47 2007
@@ -1401,7 +1401,7 @@
     public override FetchUpdatedLocation (entity : Located, begin_loc : Location) : void
     {
       when (entity != null)
-        entity.loc = begin_loc + loc;   
+        entity.Location = begin_loc + loc;   
     }
   }
 }

Modified: nemerle/trunk/ncc/parsing/AST.n
==============================================================================
--- nemerle/trunk/ncc/parsing/AST.n	(original)
+++ nemerle/trunk/ncc/parsing/AST.n	Mon Jul 30 04:01:47 2007
@@ -476,7 +476,18 @@
     public this (loc : Location) { this.loc = loc }
     public IsGenerated : bool { get { loc.IsGenerated } }
 
-    public Location : Location { get { loc } }
+    public Location : Location
+    {
+      get { loc }
+      set
+      {
+//#if DEBUG
+//        when (this is Nemerle.Compiler.Typedtree.TExpr.DebugInfo)
+//          assert(!Location.IsGeneratedOrEmpty);
+//#endif
+        loc = value
+      }
+    }
   }
 
   [System.Flags]

Modified: nemerle/trunk/ncc/parsing/MainParser.n
==============================================================================
--- nemerle/trunk/ncc/parsing/MainParser.n	(original)
+++ nemerle/trunk/ncc/parsing/MainParser.n	Mon Jul 30 04:01:47 2007
@@ -713,7 +713,7 @@
                       match (maybe_parse_ellipsis ()) {
                         | Some(e) =>
                           pop_stream ();
-                          members = [ClassMember.Field (e.loc, null, null, e)]; // special encoding for <[ decl: class A { ..$mems } ]>
+                          members = [ClassMember.Field (e.Location, null, null, e)]; // special encoding for <[ decl: class A { ..$mems } ]>
                           
                         | _ =>
                           pop_stream ();
@@ -761,14 +761,14 @@
                 }
 
                 td.name = name;
-                td.loc = startLocation + end_loc;
+                td.Location = startLocation + end_loc;
                 td
 
               | "delegate" =>
                 def h = parse_fun_header (null);
                 def td = TopDeclaration.Delegate (h);
                 expect_empty ("delegate declaraion");
-                td.loc = startLocation + h.Location;
+                td.Location = startLocation + h.Location;
                 td.name = h.name;                
                 td
 
@@ -787,7 +787,7 @@
                 def expr = parse_block ([]);
                 def res = TopDeclaration.Macro (header, synt, expr);
                 res.name = header.name;
-                res.loc = startLocation + header.Location;
+                res.Location = startLocation + header.Location;
                 res
 
               | _ => Error (tok, "expecting type declaration"); TopDeclaration.Delegate (null);
@@ -900,7 +900,7 @@
               | _ =>
                 take_attributes_out (ref customs, System.AttributeTargets.Class, true, mods);
                 def td = ParseTypeDeclaration (mods, start_tok.Location);
-                ClassMember.TypeDeclaration (loc = td.loc, 
+                ClassMember.TypeDeclaration (loc = td.Location, 
                                              name = td.name, 
                                              modifiers = td.modifiers, 
                                              td = td)
@@ -919,7 +919,7 @@
 
       parse_top_extensions (modifiers, MacroTargets.Method);
       
-      mutable loc = h.loc;
+      mutable loc = h.Location;
       mutable bodyTokens = null;
       
       def body =
@@ -1124,7 +1124,7 @@
           def val = parse_expr ();
           def bodyLocation = toc.Location.FromEnd() + last_tok.Location;
          
-          val.loc = bodyLocation; // correct location
+          val.Location = bodyLocation; // correct location
 
           Util.locate (bodyLocation,
             mods.AddCustomAttribute (<[
@@ -1574,7 +1574,7 @@
         | _ => ()
       }
       
-      Fun_parm (loc = id.loc.Combine(t.Location), name = id, ty = t,
+      Fun_parm (loc = id.Location.Combine(t.Location), name = id, ty = t,
                 modifiers = mods, pattern_hack = pattern)
     }
 
@@ -1589,7 +1589,7 @@
           match (maybe_parse_ellipsis ()) {
             | Some (e) =>
               pop_stream ("ellipsis spliced expression");
-              [Fun_parm (e.loc, Splicable.Name (mkname ("")), PExpr.Void (e.loc), 
+              [Fun_parm (e.Location, Splicable.Name (mkname ("")), PExpr.Void (e.Location), 
                          Modifiers (NemerleAttributes.None, [e]))]
                          
             | _ => pop_stream (); TokenMap (group, fun () { parse_parameter (allow_patterns) });
@@ -2109,16 +2109,16 @@
             
           | Token.Keyword ("ref") =>
             def refexpr = parse_expr (TokenStoppers.All);
-            PExpr.ParmByRef (loc + refexpr.loc, refexpr)
+            PExpr.ParmByRef (loc + refexpr.Location, refexpr)
 
           | Token.Keyword ("out") =>
             def outexpr = parse_expr (TokenStoppers.All);
-            PExpr.ParmOut (loc + outexpr.loc, outexpr)
+            PExpr.ParmOut (loc + outexpr.Location, outexpr)
 
           | Token.Keyword ("throw") =>
             if (stream != null) {
               def exn = parse_expr (stop);
-              PExpr.Throw (loc + exn.loc, exn)
+              PExpr.Throw (loc + exn.Location, exn)
             }
             else
               PExpr.Throw (loc, null)
@@ -2146,7 +2146,7 @@
             loop ();
 
             match ((ids, vals)) {
-              | ([id], [val]) => PExpr.DefMutable (if (val != null) loc + val.loc else loc + id.Location, id, val)
+              | ([id], [val]) => PExpr.DefMutable (if (val != null) loc + val.Location else loc + id.Location, id, val)
               | _ => PExpr.DefMutable (loc, PExpr.Tuple (loc, ids.Reverse ()),
                                        PExpr.Tuple (loc, vals.Reverse ()))
             }
@@ -2164,7 +2164,7 @@
                                 typarms = typarms);
             
             def expr = parse_block (parms);
-            PExpr.Lambda (h.loc, Function_decl (h, expr))
+            PExpr.Lambda (h.Location, Function_decl (h, expr))
 
           | Token.Operator ("$") =>
             match (peek_token ()) {
@@ -2325,7 +2325,7 @@
               def pat = parse_expr (stop | TokenStoppers.Equal);
               expect_operator ("=");
               def expr = parse_expr (stop);
-              PExpr.Define (loc + expr.loc, pat, expr)
+              PExpr.Define (loc + expr.Location, pat, expr)
             };
             def parse_funs (acc, idopt) {
               def h = parse_fun_header (idopt, allow_patterns = true);
@@ -2378,7 +2378,7 @@
                             | Splicable.Expression (e) => PExpr.Spliced (loc, e)
                             | Splicable.HalfId (e) => PExpr.ToComplete (loc, e)
                           }
-                        PExpr.Define (loc + expr.loc, define, expr)
+                        PExpr.Define (loc + expr.Location, define, expr)
 
                       | x => fatal_error (x, "expecting `def x = expr' or `def f () { .. }'");
                     }

Modified: nemerle/trunk/ncc/parsing/ParseTree.n
==============================================================================
--- nemerle/trunk/ncc/parsing/ParseTree.n	(original)
+++ nemerle/trunk/ncc/parsing/ParseTree.n	Mon Jul 30 04:01:47 2007
@@ -315,7 +315,7 @@
     public this (id : string, loc : Location)
     {
       this(id);
-      this.loc = loc;
+      this.Location = loc;
     }
 
     public this (id : string, color : int, context : GlobalEnv)
@@ -328,7 +328,7 @@
     public this (id : string, loc : Location, color : int, context : GlobalEnv)
     {
       this(id, color, context);
-      this.loc = loc;
+      this.Location = loc;
     }
 
     static public NameInCurrentColor (id : string, context : GlobalEnv) : Name
@@ -532,10 +532,10 @@
 
     public this (from : PExpr) 
     {
-      base (from.loc, null, Modifiers (NemerleAttributes.None, []));
+      base (from.Location, null, Modifiers (NemerleAttributes.None, []));
       match (from) {
-        | PExpr.Ref (n) => name = Splicable.Name (n); ty = PExpr.Wildcard (from.loc);
-        | PExpr.Spliced (s) => name = Splicable.Expression (s); ty = PExpr.Wildcard (from.loc);          
+        | PExpr.Ref (n)     => name = Splicable.Name (n);       ty = PExpr.Wildcard (from.Location);
+        | PExpr.Spliced (s) => name = Splicable.Expression (s); ty = PExpr.Wildcard (from.Location);
         | PExpr.TypeEnforcement (PExpr.Ref (n), t) =>
           name = Splicable.Name (n); ty = t;
           

Modified: nemerle/trunk/ncc/typing/ConstantFolder.n
==============================================================================
--- nemerle/trunk/ncc/typing/ConstantFolder.n	(original)
+++ nemerle/trunk/ncc/typing/ConstantFolder.n	Mon Jul 30 04:01:47 2007
@@ -314,7 +314,7 @@
             | [fld is IField] when fld.IsLiteral =>
               match (FieldValueAsLiteral (fld, triggerObsoleteWarn)) {
                 | None => expr
-                | Some (lit) => PExpr.Literal (expr.loc, lit)
+                | Some (lit) => PExpr.Literal (expr.Location, lit)
               }
             | _ => expr
           }
@@ -349,11 +349,11 @@
         | Some (Literal.Enum (lit, enum_ty, enum_field)) when name == "~" =>
           emit_flag_warning (enum_ty);
           def res = FoldLiteral (is_checked, name, lit);
-          PExpr.Literal (expr.loc, Literal.Enum (res, enum_ty, enum_field))
+          PExpr.Literal (expr.Location, Literal.Enum (res, enum_ty, enum_field))
 
         | Some (Literal.Integer as lit) when is_known_operator (name) =>
           def res = FoldLiteral (is_checked, name, lit);
-          PExpr.Literal (expr.loc, res)
+          PExpr.Literal (expr.Location, res)
 
         | _ => expr
       }
@@ -377,7 +377,7 @@
             expr
           else
             match ((enum_ty, name)) {
-              | (None, _) => PExpr.Literal (expr.loc, lit)
+              | (None, _) => PExpr.Literal (expr.Location, lit)
                 
               | (Some (t), "|")
               | (Some (t), "&")
@@ -388,7 +388,7 @@
                 emit_flag_warning (t);
                 // IT : Need IField
                 def lit = if (lit is Literal.Enum) lit else Literal.Enum (lit :> Literal.Integer, t, null);
-                PExpr.Literal (expr.loc, lit)
+                PExpr.Literal (expr.Location, lit)
               | (Some, _) =>
                 // other operators not allowed on enums
                 expr

Modified: nemerle/trunk/ncc/typing/DecisionTreeBuilder.n
==============================================================================
--- nemerle/trunk/ncc/typing/DecisionTreeBuilder.n	(original)
+++ nemerle/trunk/ncc/typing/DecisionTreeBuilder.n	Mon Jul 30 04:01:47 2007
@@ -682,7 +682,7 @@
                   def pats' =
                     pats.Map (fun (pat) { ++id; (tt.GetField (id), pat) });
                   def pat =
-                    Pattern.Record (pat.loc, pat.ty, pats');
+                    Pattern.Record (pat.Location, pat.ty, pats');
                   Build ((path, skel, pat) :: rest)
 
                 | Pattern.Literal (lit) =>
@@ -915,7 +915,7 @@
       
       foreach (pat in pat_arr)
         when (pat != null)
-          Message.Warning (pat.loc, "this match clause is unused");
+          Message.Warning (pat.Location, "this match clause is unused");
     }
     
     /** Construct a Decision tree and call CheckMatching () on it. */

Modified: nemerle/trunk/ncc/typing/MacroRegistry.n
==============================================================================
--- nemerle/trunk/ncc/typing/MacroRegistry.n	(original)
+++ nemerle/trunk/ncc/typing/MacroRegistry.n	Mon Jul 30 04:01:47 2007
@@ -102,7 +102,7 @@
                   def expanded =
                     try {
                       ctx.Manager.MacroColors.PushNewColor (name.color, name.GetEnv (ctx.Env));
-                      Util.locate (expr.loc, x.Run (ctx, x.CallTransform (args)));
+                      Util.locate (expr.Location, x.Run (ctx, x.CallTransform (args)));
                     } finally {
                       ctx.Manager.MacroColors.PopColor ();
                     }
@@ -118,7 +118,7 @@
               def expanded = 
                 try {
                   ctx.Manager.MacroColors.PushNewColor (name.color, name.GetEnv (ctx.Env));
-                  Util.locate (expr.loc, m.Run (ctx, parms));
+                  Util.locate (expr.Location, m.Run (ctx, parms));
                 } finally {
                   ctx.Manager.MacroColors.PopColor ();
                 }

Modified: nemerle/trunk/ncc/typing/Macros.n
==============================================================================
--- nemerle/trunk/ncc/typing/Macros.n	(original)
+++ nemerle/trunk/ncc/typing/Macros.n	Mon Jul 30 04:01:47 2007
@@ -884,7 +884,7 @@
   {
     if (expr == null) null
     else
-      Util.locate (expr.loc, {
+      Util.locate (expr.Location, {
         def expr = 
           match (ctx) {
             | Some (c) => MacroRegistry.expand_macro (c, expr) [0]
@@ -1098,7 +1098,7 @@
         }
       else e
     }
-    Util.locate (expr.loc, {
+    Util.locate (expr.Location, {
       TraverseExpr (None (), expr, false, rename_expr)
     });
   }

Modified: nemerle/trunk/ncc/typing/OverloadPossibility.n
==============================================================================
--- nemerle/trunk/ncc/typing/OverloadPossibility.n	(original)
+++ nemerle/trunk/ncc/typing/OverloadPossibility.n	Mon Jul 30 04:01:47 2007
@@ -81,7 +81,7 @@
         solver.  */
     public Compile () : TExpr
     {
-      Util.locate (loc, {
+      Util.locate (Location, {
         def is_ok = 
           CheckGenericSpecifier () &&
           (is_static || {

Modified: nemerle/trunk/ncc/typing/TypedTree.n
==============================================================================
--- nemerle/trunk/ncc/typing/TypedTree.n	(original)
+++ nemerle/trunk/ncc/typing/TypedTree.n	Mon Jul 30 04:01:47 2007
@@ -130,7 +130,7 @@
                in modifiers.custom_attrs)
       {
         when (default_value.IsSome)
-          Message.Error (e.loc, 
+          Message.Error (e.Location, 
                          $ "default value specified twice for parameter "
                            "`$name'");
         default_value = Some (par.TypeExpr (e, Typer.AtLeast (ty)));
@@ -153,19 +153,19 @@
         match (provided_val) {
           | Parsetree.PExpr.Literal (lit) =>
             when (lit is Literal.Decimal)
-              Message.Error (e.loc,
+              Message.Error (e.Location,
                              $ "only `null' is allowed for default value of "
                                "type `decimal' (parameter `$name')");
             when (lit is Literal.Void)
-              Message.Error (e.loc,
+              Message.Error (e.Location,
                              $ "the void literal is not allowed for default "
                               "value of parameter `$name'");
             when (default_value.IsSome)
-              Message.Error (e.loc, 
+              Message.Error (e.Location, 
                              $ "default value specified twice for parameter "
                                "`$name'");
             when (ty == null && lit is Literal.Null)
-              Message.Error (e.loc, 
+              Message.Error (e.Location, 
                              $ "type inference not supported when default value is null (parameter "
                                "`$name')");
 
@@ -178,7 +178,7 @@
               else
                 ty.Provide (lit.GetInternalType (par.Manager.InternalType));
             when (!ok)
-              Message.Error (e.loc, 
+              Message.Error (e.Location, 
                              $ "invalid type for default value of "
                                "parameter `$name', needed $ty, got $lit");
 
@@ -188,7 +188,7 @@
                   | Some (lit) => lit
                   | None => 
                     // ice?
-                    Message.Error (e.loc, $ "cannot convert $lit to $ty");
+                    Message.Error (e.Location, $ "cannot convert $lit to $ty");
                     lit
                 }
               else lit;
@@ -196,7 +196,7 @@
             default_value = Some (TExpr.Literal (Typer.TypeOfLiteral (par.Manager, lit), lit));
             
           | _ =>
-            Message.Error (e.loc,
+            Message.Error (e.Location,
               $"Incorrect format of parameter `$name' default value. You should use 'paramName = <literal>'");
         }
       }
@@ -447,7 +447,7 @@
         | Application (c, a) =>
           Application (c, walk (a))
       } and walk (pat) {
-        def res = Util.locate (pat.loc, {
+        def res = Util.locate (pat.Location, {
           def res = f (pat);
           if (res == null) do_walk (pat) else res;
         });
@@ -603,21 +603,21 @@
         | Call (expr, parms, tail) =>
           match (unfold (expr)) {
             | PropertyMember (obj, fld) as expr =>
-              def inner = TExpr.PropertyMember (expr.loc, expr.Type, cache_obj (obj), fld);
+              def inner = TExpr.PropertyMember (expr.Location, expr.Type, cache_obj (obj), fld);
               TExpr.Call (inner, parms, tail)
             | _ => Util.ice ()
           }
 
         | DebugInfo (e, pe) =>
           def e = get_ref (unfold (e));
-          TExpr.DebugInfo (expr.loc, e.ty, e, pe)
+          TExpr.DebugInfo (expr.Location, e.ty, e, pe)
 
         | _ => Util.ice ($ "invalid cached expr: $expr")
       }
 
       def expr = unfold (t_expr);
       ref_is     = get_ref (expr);
-      ref_is.loc = t_expr.loc;
+      ref_is.Location = t_expr.Location;
       ref_is.ty  = t_expr.ty;
       body
     }
@@ -844,16 +844,16 @@
                 | _ =>
                   if (ManagerClass.Instance.IsIntelliSenseMode)
                   {
-                    System.Diagnostics.Trace.WriteLine($"type is null for $loc, $this");
+                    System.Diagnostics.Trace.WriteLine($"type is null for $(this.Location), $this");
                     ty = ManagerClass.Instance.Solver.FreshTyVar ()
                   }
                   else
-                    Util.ice ($"type is null for $loc, $this");
+                    Util.ice ($"type is null for $(this.Location), $this");
               }
             }
         }
 
-        Util.cassert (ty != null, $ "still null, $loc, $this");
+        Util.cassert (ty != null, $ "still null, $(this.Location), $this");
 
         ty
       }
@@ -893,6 +893,13 @@
     {
       base (loc);
       this.ty = ty;
+
+//#if DEBUG
+//      match (this) {
+//        | DebugInfo => assert (!loc.IsGeneratedOrEmpty);
+//        | _ => ()
+//      }
+//#endif
     }
     
 
@@ -931,7 +938,7 @@
 
     static walk (f : TExpr -> TExpr, expr : TExpr) : TExpr
     {
-      def res = Util.locate (expr.loc, {
+      def res = Util.locate (expr.Location, {
         def res = f (expr);
         def res =
           if (res == null) do_walk (f, expr) else res;
@@ -946,7 +953,7 @@
 
     static null_walk (f : TExpr -> TExpr, expr : TExpr) : TExpr
     {
-      def res = Util.locate (expr.loc, {
+      def res = Util.locate (expr.Location, {
         def res = f (expr);
         if (res == null) do_walk (f, expr) else res;
       });
@@ -1001,7 +1008,7 @@
         | Block
         | StaticEventRef =>
           // this is supposed to be run after Typer2
-          Message.Warning (expr.loc, 
+          Message.Warning (expr.Location,
                            $ "invalid expr in walk: $(expr.GetType()): $expr");
           assert (false)
 
@@ -1160,7 +1167,7 @@
           if (e' : object == e)
             null
           else
-            DebugInfo (expr.loc, e'.ty, e', pe)
+            DebugInfo (expr.Location, e'.ty, e', pe)
 
 
         | Sequence (e1, e2) =>

Modified: nemerle/trunk/ncc/typing/Typer-CallTyper.n
==============================================================================
--- nemerle/trunk/ncc/typing/Typer-CallTyper.n	(original)
+++ nemerle/trunk/ncc/typing/Typer-CallTyper.n	Mon Jul 30 04:01:47 2007
@@ -261,7 +261,7 @@
             [TExpr.Literal (InternalType.Int32,
                             Literal.FromInt (expr_list.Length))];
           def mkarray = 
-            TExpr.Array (function_called.loc, arrayty, List.Rev (expr_list), dimensions);
+            TExpr.Array (function_called.Location, arrayty, List.Rev (expr_list), dimensions);
           call_parms = regular_parms + [Parm (mkarray)];
         }
       }

Modified: nemerle/trunk/ncc/typing/Typer-DelayedTyping.n
==============================================================================
--- nemerle/trunk/ncc/typing/Typer-DelayedTyping.n	(original)
+++ nemerle/trunk/ncc/typing/Typer-DelayedTyping.n	Mon Jul 30 04:01:47 2007
@@ -141,7 +141,7 @@
               match (meth.BuiltinKind) {
                 | BuiltinMethodKind.OpCode (ch, unch) =>
                   def opcode = if (local_context.IsChecked) ch else unch;
-                  Kind.Resolved (TExpr.OpCode (expr.loc, expr.ty, opcode))
+                  Kind.Resolved (TExpr.OpCode (expr.Location, expr.ty, opcode))
                 | _ => k
               }
             | Kind.Overloaded (lst) =>
@@ -387,7 +387,7 @@
              overloads).Map (x => $"Posible overload: $x")
           | Macro (action) =>
             // the Resolve function should dump the error message
-            Util.locate (loc, {
+            Util.locate (Location, {
               def res = action.Resolve (true);
               when (res.IsSome)
                 Message.Error ($ "the macro resolution function unexpectedly succeeded "
@@ -777,7 +777,7 @@
               SetKind (Kind.Error ())
 
           | Kind.Macro (action) =>
-            Util.locate (loc,
+            Util.locate (Location,
               match (action.Resolve (false)) {
                 | Some (expr) =>
                   if (typer.Expect (expected, expr.Type, $ "result of $action execution"))
@@ -794,7 +794,7 @@
 
       public Resolve () : void
       {
-        Util.locate (loc, {
+        Util.locate (Location, {
           def tmp = typer.local_context;
           try {
             typer.local_context = local_context;

Modified: nemerle/trunk/ncc/typing/Typer-PatternTyper.n
==============================================================================
--- nemerle/trunk/ncc/typing/Typer-PatternTyper.n	(original)
+++ nemerle/trunk/ncc/typing/Typer-PatternTyper.n	Mon Jul 30 04:01:47 2007
@@ -367,7 +367,7 @@
         
       TypePattern (matched_value_type : TyVar, pattern : PT.PExpr) : Pattern
       {
-        Util.locate (pattern.loc, {
+        Util.locate (pattern.Location, {
           def typed = DoTypePattern (matched_value_type, pattern);
           when (typed.ty == null)
             typed.ty = matched_value_type;
@@ -621,7 +621,7 @@
                 Message.Warning (602, "using ``:'' as a type tests is "
                                       "deprecated, please use ``is'' instead");
               TypePattern (matched_value_type, 
-                           PT.PExpr.Is (pattern.loc, nested, needed_type))
+                           PT.PExpr.Is (pattern.Location, nested, needed_type))
             }
 
 
@@ -670,11 +670,11 @@
                 
               | ty =>
                 def typed_pattern =
-                  Pattern.HasType (pattern.loc, matched_value_type, ty);
+                  Pattern.HasType (pattern.Location, matched_value_type, ty);
                 needed_is_type.typed_object = typed_pattern;
                 match (TypePattern (needed_type, nested)) {
                   | Pattern.As (Pattern.Wildcard, decl) =>
-                    Pattern.As (pattern.loc, matched_value_type, 
+                    Pattern.As (pattern.Location, matched_value_type, 
                                 typed_pattern, decl)
                   | Pattern.Wildcard => typed_pattern
                   | _ =>
@@ -798,7 +798,10 @@
         }
 
         when (pattern.typed_object == null)
+        {
           pattern.typed_object = pat;
+          pat.Location = pattern.Location;
+        }
         pat;
       }
     }

Modified: nemerle/trunk/ncc/typing/Typer.n
==============================================================================
--- nemerle/trunk/ncc/typing/Typer.n	(original)
+++ nemerle/trunk/ncc/typing/Typer.n	Mon Jul 30 04:01:47 2007
@@ -261,7 +261,7 @@
       when (Manager.Options.ShouldDump (current_fun)) {
         match (current_fun.body) {
           | FunBody.Typed (expr) =>
-            Message.Debug (expr.loc, $ "$msg: $current_type.$(current_fun.name) -> "
+            Message.Debug (expr.Location, $ "$msg: $current_type.$(current_fun.name) -> "
                                        "$(current_fun.ret_type) : " +
                                      PrettyPrint.SprintTyExpr (None (), expr) + "\n")
           | _ => ()
@@ -276,7 +276,7 @@
 
       foreach (p : Fun_parm in current_fun.parms)
       {
-        Util.locate (p.loc, {
+        Util.locate (p.Location, {
           def is_mutable =
             p.modifiers.mods %&& NemerleAttributes.Mutable ||
             p.kind != ParmKind.Normal;
@@ -404,11 +404,11 @@
         assert (error_dt != null);
 
         def errors = error_dt.GetDescriptionForError ();
-        Util.locate (error_dt.loc,
+        Util.locate (error_dt.Location,
            ReportError (messenger, $"typing fails on $(errors.Head)"));
 
         foreach (hint in errors.Tail)
-          Util.locate (error_dt.loc,
+          Util.locate (error_dt.Location,
             ReportError (messenger, hint));
       } else {
         badness_allowed = max_badness;
@@ -751,7 +751,7 @@
 
     public static ImplicitCast (expr : TExpr, ty : TyVar) : TExpr
     {
-      TExpr.TypeConversion (expr.loc, ty, expr, ty, ConversionKind.Implicit ())
+      TExpr.TypeConversion (expr.Location, ty, expr, ty, ConversionKind.Implicit ())
     }
 
 
@@ -1064,7 +1064,7 @@
     {
       log (TYPING, expr.loc, $ "(typing expression: $expr, exp=$expected");
 
-      def texpr = Util.locate (expr.loc, {
+      def texpr = Util.locate (expr.Location, {
         def e' = InterceptSpecialMacros (expr, expected);
         def e' = 
           try {
@@ -1089,7 +1089,7 @@
                   log (MACRO_EXPANSIONS, e.loc, $ "after expansion: $e");
 
                   def debugLocation = 
-                    if (Manager.Options.EmitDebug && !expr.loc.IsGeneratedOrEmpty)
+                    if (Manager.Options.EmitDebug && !expr.Location.IsGeneratedOrEmpty)
                       GetDebugLocation(expr);
                     else
                       Location.Default;
@@ -1099,7 +1099,7 @@
                   // IT: In some cases, MacroEnvelope takes e.Location without keyword location.
                   // For example, for (mutable i;;) {} takes e.Location without 'for'.
                   // The following fixes that.
-                  def loc = if (expr.loc.IsGeneratedOrEmpty) res.Location else expr.loc;
+                  def loc = if (expr.Location.IsGeneratedOrEmpty) res.Location else expr.Location;
                   def res = TExpr.MacroEnvelope (loc, res.Type, im, orig, res);
 
                   if (debugLocation.IsEmpty)
@@ -1785,7 +1785,8 @@
       }
 
       //IT.TEMP
-      _ = if (!Manager.Options.EmitDebug || pexpr.loc.IsGeneratedOrEmpty || skip(pexpr.loc))
+      _ = 
+      if (!Manager.Options.EmitDebug || pexpr.Location.IsGeneratedOrEmpty || skip(pexpr.Location))
         Location.Default
       else
       {
@@ -1810,8 +1811,10 @@
 
             match (info.Node)
             {
-              | PT.PExpr.Sequence as s when !s.loc.IsGeneratedOrEmpty => truncate(s.loc.Line, s.loc.Column, true);
-              | PT.PExpr.Match(_, _, l) when !l.IsGeneratedOrEmpty => truncate(l.EndLine,  l.EndColumn, false);
+              | PT.PExpr.Sequence as s when !s.Location.IsGeneratedOrEmpty =>
+                truncate(s.Location.Line, s.Location.Column, true);
+              | PT.PExpr.Match(_, _, l) when !l.IsGeneratedOrEmpty =>
+                truncate(l.EndLine,  l.EndColumn, false);
               | _ => ()
             }
           });
@@ -1830,7 +1833,7 @@
             {
               when (info.Node is Located)
               {
-                def l = (info.Node :> Located).loc;
+                def l = (info.Node :> Located).Location;
 
                 when (
                   l.EndLine == loc.Line &&
@@ -1851,11 +1854,11 @@
         {
           | PT.PExpr.Sequence => ()
           | PT.PExpr.MacroCall(nm, _, _) when
-            nm.loc.IsGenerated == false &&
-            nm.loc.Line   == loc.Line &&
-            nm.loc.Column == loc.Column =>
+            nm.Location.IsGenerated == false &&
+            nm.Location.Line   == loc.Line &&
+            nm.Location.Column == loc.Column =>
 
-            loc = nm.loc;
+            loc = nm.Location;
 
           | _ =>
             truncateLoc();
@@ -1891,7 +1894,7 @@
           def warn (was_of_kind, is_of_kind) {
               Message.Warning ($ "redefinition of a local $was_of_kind "
                                  "value `$(l.Name)' $is_of_kind");
-              Message.Warning (l.loc, "  <-- previously seen here")
+              Message.Warning (l.Location, "  <-- previously seen here")
           }
 
           match ((is_mutable, l.IsMutable)) {
@@ -1953,7 +1956,7 @@
               ReportError (messenger, "ref/out parameters are not supported in local methods");
 
             def fp =
-              Fun_parm (loc = p.loc,
+              Fun_parm (loc = p.Location,
                         name = name.Id,
                         color = name.color,
                         ty = current_type.BindType (tenv, p.ty),
@@ -1973,7 +1976,7 @@
            name         = name_obj.Id,
            parms        = parms,
            tenv         = tenv,
-           loc          = fn.header.loc);
+           loc          = fn.header.Location);
 
         fn.header.typed_object = header;
 
@@ -2016,14 +2019,14 @@
                   if (acc == null) dv.body = VoidLiteral ();
                   else dv.body = acc;
                   dv.ty = dv.body.Type;
-                  dv.loc += dv.body.loc;
+                  dv.Location += dv.body.Location;
                   x
 
                 | TExpr.DefFunctionsIn (_, body) as dv when body == null =>
                   if (acc == null) dv.body = VoidLiteral ();
                   else dv.body = acc;
                   dv.ty = dv.body.Type;
-                  dv.loc += dv.body.loc;
+                  dv.Location += dv.body.Location;
                   x
                   
                 | TExpr.Match (_, [case]) when case.body == null =>
@@ -2040,7 +2043,7 @@
 
                 | x =>
                   if (acc == null) x
-                  else TExpr.Sequence (x.loc + acc.loc, acc.Type, x, acc);
+                  else TExpr.Sequence (x.Location + acc.Location, acc.Type, x, acc);
               }
             loop (acc, xs)
 
@@ -3190,7 +3193,10 @@
       }
 
       when (pfnc.typed_object == null)
+      {
         pfnc.typed_object = res;
+        res.Location = pfnc.Location;
+      }
       res
     }
     #endregion
@@ -3363,7 +3369,7 @@
         
         // conversions are added in Typer2 (for some reason?)
         unless (IsError (body))
-          Util.locate (body.loc,
+          Util.locate (body.Location,
             unless (ExpectSubtyping (expected, body.Type, "computation branch"))
               Message.HintOnce ("this means two branches of ``if'' or "
                                 "``match'' have different types"));

Modified: nemerle/trunk/ncc/typing/Typer2.n
==============================================================================
--- nemerle/trunk/ncc/typing/Typer2.n	(original)
+++ nemerle/trunk/ncc/typing/Typer2.n	Mon Jul 30 04:01:47 2007
@@ -141,7 +141,7 @@
     internal Walk (ctx : Context, expr : TExpr) : TExpr
     {
       assert (expr != null);
-      Util.locate (expr.loc, {
+      Util.locate (expr.Location, {
         messenger.CleanLocalError ();
         def expr = PushConversionDown (expr);
         def res = DoWalk (ctx, expr);
@@ -395,7 +395,7 @@
       pat.Walk (fun (_) {
         | Pattern.HasType (tc) =>
           when (pat.ty.TryRequire (tc) && messenger.NeedMessage)
-            Message.Warning (pat.loc, "using the ``is'' pattern here is redundant, "
+            Message.Warning (pat.Location, "using the ``is'' pattern here is redundant, "
                                       "please use ``:''");
           null
         
@@ -423,8 +423,8 @@
       unless (current_type.IsDelegate) {
         foreach (v in locals)
           when (!v.EverUsed && v.Name[0] != '_' && !warned.Contains (v)) {
-            Message.Warning (168, v.loc, $ "$(v) was never used");
-            Message.HintOnce (168, v.loc, "replace name with `_' or prefix it like"
+            Message.Warning (168, v.Location, $ "$(v) was never used");
+            Message.HintOnce (168, v.Location, "replace name with `_' or prefix it like"
                                " `_bar' to avoid the warning");
             warned.Set (v, null)
           }
@@ -490,7 +490,7 @@
           // check if we are not closuring some invalid things
           match (v.ValKind) {
             | LocalValue.Kind.FunParm (k) when k != ParmKind.Normal =>
-              Message.Error (v.loc, $ "cannot store ref/out parameters in"
+              Message.Error (v.Location, $ "cannot store ref/out parameters in"
                                       " closures ($v)");
             | _ => ()
           }
@@ -519,7 +519,7 @@
           Fun_parm (Util.tmpname ("fp"), 0, ty, Modifiers.Empty, ParmKind.Normal)
         });
       def lambda_header = 
-        Fun_header (expr.loc, "_N_poly_local_lambda", ret_type, Location.Default,
+        Fun_header (expr.Location, "_N_poly_local_lambda", ret_type, Location.Default,
                     parms, [], current_fun.tenv);
       def parms_refs =
         List.Map (parms, fun (fp : Fun_parm) {
@@ -566,7 +566,7 @@
           Fun_parm (Util.tmpname ("fp"), 0, ty, Modifiers.Empty, ParmKind.Normal)
         });
       def lambda_header = 
-        Fun_header (obj.loc, "_N_method_lambda", ret_type, Location.Default,
+        Fun_header (obj.Location, "_N_method_lambda", ret_type, Location.Default,
                     parms, [], current_fun.tenv);
       def parms_refs =
         List.Map (parms, fun (fp : Fun_parm) {
@@ -1353,7 +1353,7 @@
 
         | TExpr.DebugInfo (e, pe) => 
           def e = Walk (ctx, e);
-          TExpr.DebugInfo (expr.loc, e.ty, e, pe);
+          TExpr.DebugInfo (expr.Location, e.ty, e, pe);
 
         | TExpr.Goto =>
           unless (ctx %&& Context.AllowGoto)



More information about the svn mailing list