[svn] r7251: nemerle/trunk/ncc: generation/ILEmitter.n hierarchy/BuiltinMethod.n hierarchy/ClassMembers.n ...

nazgul svnadmin at nemerle.org
Thu Jan 11 23:41:59 CET 2007


Log:
More debug locations emitted

Author: nazgul
Date: Thu Jan 11 23:41:53 2007
New Revision: 7251

Modified:
   nemerle/trunk/ncc/generation/ILEmitter.n
   nemerle/trunk/ncc/hierarchy/BuiltinMethod.n
   nemerle/trunk/ncc/hierarchy/ClassMembers.n
   nemerle/trunk/ncc/hierarchy/TypeBuilder.n
   nemerle/trunk/ncc/hierarchy/TypeInfo.n
   nemerle/trunk/ncc/typing/Typer.n
   nemerle/trunk/ncc/typing/Typer2.n

Modified: nemerle/trunk/ncc/generation/ILEmitter.n
==============================================================================
--- nemerle/trunk/ncc/generation/ILEmitter.n	(original)
+++ nemerle/trunk/ncc/generation/ILEmitter.n	Thu Jan 11 23:41:53 2007
@@ -119,13 +119,13 @@
       match (_fun_header.body) {
         | FunBody.Typed (body) =>
           when (IsDebugEnabled) {
-            Mark (body.Location.FromStart ());
+            Mark (beginLocation (body.Location));
             _ilg.Emit (OpCodes.Nop);   
           }
           emit (body);
           
           when (IsDebugEnabled) {
-            Mark (body.Location.FromEnd());
+            Mark (endLocation (body.Location));
           }
           unless (body.Throws)
             _ilg.Emit (OpCodes.Ret);
@@ -142,6 +142,15 @@
       })
     }
 
+    private static beginLocation (mutable loc : Location) : Location {
+      loc = loc.FromStart ();
+      Location (loc.FileIndex, loc.Line, loc.Column, loc.EndLine, loc.EndColumn + 1)
+    }
+    private static endLocation (mutable loc : Location) : Location {
+      loc = loc.FromEnd ();
+      Location (loc.FileIndex, loc.Line, loc.Column - 1, loc.EndLine, loc.EndColumn)
+    }
+    
     private is_always_true (expr : TExpr) : bool
     {
       | Literal (Literal.Bool (true)) => true
@@ -869,11 +878,13 @@
 
         /* load the value of a local variable or a method parameter */
         | LocalRef (decl) =>
+          Mark (expr.loc);
           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) =>
+          Mark (expr.loc);
           def result_will_be_address = expr.NeedAddress;
           
           if (result_will_be_address) 
@@ -894,6 +905,7 @@
 
         /* load the value of a static field */
         | StaticRef (t, f is IField, _) =>
+          Mark (expr.loc);
           def field_info = GetFieldInfo (t.SystemType, f);
           
           assert (field_info.IsStatic, "GlobalRef to a non-static field");

Modified: nemerle/trunk/ncc/hierarchy/BuiltinMethod.n
==============================================================================
--- nemerle/trunk/ncc/hierarchy/BuiltinMethod.n	(original)
+++ nemerle/trunk/ncc/hierarchy/BuiltinMethod.n	Thu Jan 11 23:41:53 2007
@@ -154,6 +154,7 @@
       get { true }
     }
 
+    public IsAbstract : bool   {      get { false }    }
     public IsObsolete : bool
     {
       get { false }

Modified: nemerle/trunk/ncc/hierarchy/ClassMembers.n
==============================================================================
--- nemerle/trunk/ncc/hierarchy/ClassMembers.n	(original)
+++ nemerle/trunk/ncc/hierarchy/ClassMembers.n	Thu Jan 11 23:41:53 2007
@@ -61,8 +61,6 @@
     set { attributes = value }
   }
 
-  public IsAbstract : bool { get { Attributes %&& NemerleAttributes.Abstract } }
-
   _ast : PT.ClassMember;
 
   public Ast : PT.ClassMember

Modified: nemerle/trunk/ncc/hierarchy/TypeBuilder.n
==============================================================================
--- nemerle/trunk/ncc/hierarchy/TypeBuilder.n	(original)
+++ nemerle/trunk/ncc/hierarchy/TypeBuilder.n	Thu Jan 11 23:41:53 2007
@@ -218,11 +218,6 @@
     }
   }
 
-  public IsAbstract : bool
-  {
-    get { attributes %&& NemerleAttributes.Abstract }
-  } 
-
   public override IsInterface : bool
   {
     get { if (TyManager.run_phase <= 2)
@@ -2315,7 +2310,7 @@
                 ..$attrs $(meth_header.name : usesite) 
                           (..$(meth_parms)) : $(meth_header.ret_type : typed)
                 {
-                  $(if (meth.Attributes %&& NemerleAttributes.Abstract) <[ null : this ]> else <[ base ]>).
+                  $(if (meth.IsAbstract) <[ null : this ]> else <[ base ]>).
                     $(meth_header.name : usesite) (..$meth_call_parms)
                 }
               ]>) :> MethodBuilder;

Modified: nemerle/trunk/ncc/hierarchy/TypeInfo.n
==============================================================================
--- nemerle/trunk/ncc/hierarchy/TypeInfo.n	(original)
+++ nemerle/trunk/ncc/hierarchy/TypeInfo.n	Thu Jan 11 23:41:53 2007
@@ -122,6 +122,7 @@
   GetConstructorInfo () : System.Reflection.ConstructorInfo;
   IsVarArgs : bool { get; }
   IsFinal : bool { get; }  
+  IsAbstract : bool { get; }  
   IsExtension : bool { get; }
   BuiltinKind : BuiltinMethodKind { get; }
   new GetMemType () : MType.Fun;
@@ -175,6 +176,8 @@
     get { attributes %&& NemerleAttributes.Internal }
   }
   
+  public IsAbstract : bool { get { attributes %&& NemerleAttributes.Abstract } }
+  
   public virtual HasBeenUsed : bool { // for the 'unused' warnings    
     get { true; } // default impl
     set {

Modified: nemerle/trunk/ncc/typing/Typer.n
==============================================================================
--- nemerle/trunk/ncc/typing/Typer.n	(original)
+++ nemerle/trunk/ncc/typing/Typer.n	Thu Jan 11 23:41:53 2007
@@ -1647,6 +1647,7 @@
           //Message.Debug ("push seq");
           PushLocals ();
           def res = loop ([], l);
+          res.loc = expression.Location;
           //Message.Debug ("pop seq");
           PopLocals ();
           res
@@ -1896,6 +1897,7 @@
                   if (acc == null) case.body = VoidLiteral ();
                   else case.body = acc;
                   x.ty = case.body.Type;
+                  x.loc = acc.Location;                  
                   x
 
                 | TExpr.Cache as c when c.body == null =>

Modified: nemerle/trunk/ncc/typing/Typer2.n
==============================================================================
--- nemerle/trunk/ncc/typing/Typer2.n	(original)
+++ nemerle/trunk/ncc/typing/Typer2.n	Thu Jan 11 23:41:53 2007
@@ -895,7 +895,7 @@
           def is_base = IsBaseRef (obj);
           // Message.Debug ($ "prop $meth ty=$ty $obj $(IsBaseRef (obj))");
           
-          when (is_base &&  meth.Attributes %&& NemerleAttributes.Abstract)
+          when (is_base &&  meth.IsAbstract)
             ReportError (messenger, $"cannot call an abstract base $meth");
           
           def the_ref = TExpr.MethodRef (ty, obj, meth, [], is_base);
@@ -960,7 +960,7 @@
 
           //Message.Debug ($"$(ctx %&& (Context.IsCalledValue | Context.IsDelegeteCtorParm)) obj=$(obj.GetType())/$obj ");
 
-          when (is_base && meth.Attributes %&& NemerleAttributes.Abstract)
+          when (is_base && meth.IsAbstract)
             ReportError (messenger, $"cannot call an abstract base $meth");
           
           CheckTypeArguments(expr.Location, meth, type_parms);



More information about the svn mailing list