[svn] r7594: nemerle/trunk/ncc/generation/ILEmitter.n

IT svnadmin at nemerle.org
Fri Apr 13 04:47:02 CEST 2007


Log:
Skip lambda .ctor breakpoints.

Author: IT
Date: Fri Apr 13 04:47:00 2007
New Revision: 7594

Modified:
   nemerle/trunk/ncc/generation/ILEmitter.n

Modified: nemerle/trunk/ncc/generation/ILEmitter.n
==============================================================================
--- nemerle/trunk/ncc/generation/ILEmitter.n	(original)
+++ nemerle/trunk/ncc/generation/ILEmitter.n	Fri Apr 13 04:47:00 2007
@@ -39,6 +39,8 @@
   using Nemerle.Compiler.Typedtree;
   using Nemerle.Logging;
 
+  using NC = Nemerle.Compiler;
+
   [assembly: LogFlag (EMIT, 0)]
 
 
@@ -54,15 +56,17 @@
   {
     private _module_builder : ModuleBuilder;
     private _ilg : ILGenerator;   
-    private _parent_type_builder : Nemerle.Compiler.TypeBuilder;
+    private _parent_type_builder : NC.TypeBuilder;
 
     private _this_is_value_type : bool;
     private _type_of_this : System.Type;
 
     private _method_name : string;
-    private _method_builder : Nemerle.Compiler.MethodBuilder;
+    private _method_builder : NC.MethodBuilder;
     private mutable _method_start_label : Label;
     private mutable _debug_doc : ISymbolDocumentWriter;        
+    private mutable _is_ctor   : bool;
+    private mutable _is_lambda : bool;
 
     private _labels : Hashtable [int, Label] = Hashtable ();
     private _label_usage : Hashtable [int, TExpr] = Hashtable ();
@@ -77,7 +81,7 @@
     /**
      * Creates and executes a code generator for a method
      */
-    internal this (method_builder : Nemerle.Compiler.MethodBuilder)
+    internal this (method_builder : NC.MethodBuilder)
     {
       Manager = method_builder.Manager;
       _method_builder = method_builder;
@@ -100,16 +104,17 @@
       match (_method_builder.GetHeader ().body) {
         | FunBody.Typed (body) =>
 
-          def do_debug = IsDebugEnabled && !(is_ctor(_method_builder) && _method_builder.DeclaringType.is_lambda);
+          _is_ctor   = is_ctor(_method_builder);
+          _is_lambda = _method_builder.DeclaringType.is_lambda;
 
-          when (do_debug) {
+          when (IsDebugEnabled) {
             Mark (beginLocation (_method_builder.BodyLocation));
             _ilg.Emit (OpCodes.Nop);
           }
 
           emit (body);
 
-          when (do_debug) {
+          when (IsDebugEnabled) {
             Mark (endLocation (_method_builder.BodyLocation));
           }
 
@@ -216,7 +221,7 @@
     }
 
     IsDebugEnabled : bool {
-      get { _debug_doc != null }   
+      get { _debug_doc != null && !(_is_ctor && _is_lambda) }
     }
     
 
@@ -530,6 +535,8 @@
     {
       when (IsDebugEnabled)
       {
+        def mark()
+        {
         def parm = call.parms.Find(p =>
           if (p == null || p.required_type == null) false
           else p.expr.Location.Line != p.expr.Location.EndLine || p.required_type.Fix().IsFunction);
@@ -544,6 +551,13 @@
             Mark (Location(loc.FileIndex, loc.Line, loc.Column, p.expr.Location.Line, p.expr.Location.Column));
         }
       }
+
+        match (call.func)
+        {
+        | StaticRef(_, mb is NC.MethodBuilder, _) when is_ctor(mb) && mb.DeclaringType.is_lambda => ();
+        | _ => mark();
+        }
+      }
     }
 
     MarkCall(call : TExpr.Call) : void



More information about the svn mailing list