X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fmcs%2Fstatement.cs;h=fbb060f52960da9af8218171c9cf6991e8b102cc;hb=7bd7446abcbe2c93be78fd97221dcddaeb92d653;hp=b644e126dc1cecfab235cb03d5bac052d7c0b74e;hpb=3d023ebb029a2fc978126568a34f138f5a64e49c;p=mono.git diff --git a/mcs/mcs/statement.cs b/mcs/mcs/statement.cs index b644e126dc1..fbb060f5296 100644 --- a/mcs/mcs/statement.cs +++ b/mcs/mcs/statement.cs @@ -270,10 +270,14 @@ namespace Mono.CSharp { var da_false = new DefiniteAssignmentBitSet (fc.DefiniteAssignmentOnFalse); fc.DefiniteAssignment = fc.DefiniteAssignmentOnTrue; + var labels = fc.CopyLabelStack (); var res = TrueStatement.FlowAnalysis (fc); + fc.SetLabelStack (labels); + if (FalseStatement == null) { + var c = expr as Constant; if (c != null && !c.IsDefaultValue) return true_returns; @@ -288,14 +292,20 @@ namespace Mono.CSharp { if (true_returns) { fc.DefiniteAssignment = da_false; - return FalseStatement.FlowAnalysis (fc); + + res = FalseStatement.FlowAnalysis (fc); + fc.SetLabelStack (labels); + return res; } var da_true = fc.DefiniteAssignment; fc.DefiniteAssignment = da_false; + res &= FalseStatement.FlowAnalysis (fc); + fc.SetLabelStack (labels); + if (!TrueStatement.IsUnreachable) { if (false_returns || FalseStatement.IsUnreachable) fc.DefiniteAssignment = da_true; @@ -3235,9 +3245,10 @@ namespace Mono.CSharp { public override void Emit (EmitContext ec) { - if (Parent != null) { - // TODO: It's needed only when scope has variable (normal or lifted) - ec.BeginScope (GetDebugSymbolScopeIndex ()); + // TODO: It's needed only when scope has variable (normal or lifted) + var scopeIndex = GetDebugSymbolScopeIndex (); + if (scopeIndex > 0) { + ec.BeginScope (scopeIndex); } EmitScopeInitialization (ec); @@ -3248,7 +3259,7 @@ namespace Mono.CSharp { DoEmit (ec); - if (Parent != null) + if (scopeIndex > 0) ec.EndScope (); if (ec.EmitAccurateDebugInfo && HasReachableClosingBrace && !(this is ParametersBlock) && @@ -3441,7 +3452,12 @@ namespace Mono.CSharp { storey.Parent.PartialContainer.AddCompilerGeneratedClass (storey); } - public int GetDebugSymbolScopeIndex () + public void DisableDebugScopeIndex () + { + debug_scope_index = -1; + } + + public virtual int GetDebugSymbolScopeIndex () { if (debug_scope_index == 0) debug_scope_index = ++ParametersBlock.debug_scope_index; @@ -3849,6 +3865,11 @@ namespace Mono.CSharp { return res; } + public override int GetDebugSymbolScopeIndex () + { + return 0; + } + public LabeledStatement GetLabel (string name, Block block) { // @@ -8328,15 +8349,14 @@ namespace Mono.CSharp { ec.LoopBegin = ec.DefineLabel (); ec.LoopEnd = ec.DefineLabel (); - if (!(Statement is Block)) - ec.BeginCompilerScope (variable.Block.Explicit.GetDebugSymbolScopeIndex ()); + ec.BeginCompilerScope (variable.Block.Explicit.GetDebugSymbolScopeIndex ()); + body.Explicit.DisableDebugScopeIndex (); variable.CreateBuilder (ec); Statement.Emit (ec); - if (!(Statement is Block)) - ec.EndScope (); + ec.EndScope (); ec.LoopBegin = old_begin; ec.LoopEnd = old_end;