X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fmcs%2Fiterators.cs;h=47919ec8ce2b5fda133bddbb93509096ba9ef671;hb=08a728d237965feb2bbd485f909998b17c0bbb11;hp=5dce0ed1593086082b897df277c32585ca7bd15e;hpb=811674bc6331c98d33134e2a37a7c7dd66402227;p=mono.git diff --git a/mcs/mcs/iterators.cs b/mcs/mcs/iterators.cs index 5dce0ed1593..47919ec8ce2 100644 --- a/mcs/mcs/iterators.cs +++ b/mcs/mcs/iterators.cs @@ -30,6 +30,7 @@ namespace Mono.CSharp protected T machine_initializer; int resume_pc; ExceptionStatement inside_try_block; + TryCatch inside_catch_block; protected YieldStatement (Expression expr, Location l) { @@ -69,6 +70,7 @@ namespace Mono.CSharp machine_initializer = bc.CurrentAnonymousMethod as T; inside_try_block = bc.CurrentTryBlock; + inside_catch_block = bc.CurrentTryCatch; return true; } @@ -80,7 +82,7 @@ namespace Mono.CSharp if (inside_try_block == null) { resume_pc = machine_initializer.AddResumePoint (this); } else { - resume_pc = inside_try_block.AddResumePoint (this, resume_pc, machine_initializer); + resume_pc = inside_try_block.AddResumePoint (this, resume_pc, machine_initializer, inside_catch_block); unwind_protect = true; inside_try_block = null; } @@ -202,7 +204,6 @@ namespace Mono.CSharp Field pc_field; StateMachineMethod method; - int local_name_idx; protected StateMachine (ParametersBlock block, TypeDefinition parent, MemberBase host, TypeParameters tparams, string name, MemberKind kind) : base (block, parent, host, tparams, name, kind) @@ -244,12 +245,19 @@ namespace Mono.CSharp return base.DoDefineMembers (); } - protected override string GetVariableMangledName (LocalVariable local_info) + protected override string GetVariableMangledName (ResolveContext rc, LocalVariable local_info) { if (local_info.IsCompilerGenerated) - return base.GetVariableMangledName (local_info); + return base.GetVariableMangledName (rc, local_info); - return "<" + local_info.Name + ">__" + local_name_idx++.ToString ("X"); + // + // Special format which encodes original variable name and + // it's scope to support lifted variables debugging. This + // is same what csc does and allows to correctly set fields + // scope information (like ambiguity, our of scope, etc). + // + var id = rc.CurrentBlock.Explicit.GetDebugSymbolScopeIndex (); + return "<" + local_info.Name + ">__" + id; } }