mirror of https://github.com/icsharpcode/ILSpy.git
8 changed files with 57 additions and 107 deletions
@ -1,40 +0,0 @@ |
|||||||
using System; |
|
||||||
|
|
||||||
using Ast = ICSharpCode.NRefactory.Ast; |
|
||||||
using Decompiler.ControlFlow; |
|
||||||
|
|
||||||
namespace ICSharpCode.NRefactory.Ast |
|
||||||
{ |
|
||||||
public class MyGotoStatement: Ast.GotoStatement |
|
||||||
{ |
|
||||||
NodeLabel nodeLabel; |
|
||||||
|
|
||||||
public NodeLabel NodeLabel { |
|
||||||
get { return nodeLabel; } |
|
||||||
} |
|
||||||
|
|
||||||
public MyGotoStatement(NodeLabel nodeLabel): base(nodeLabel.Label) |
|
||||||
{ |
|
||||||
this.nodeLabel = nodeLabel; |
|
||||||
|
|
||||||
this.nodeLabel.ReferenceCount++; |
|
||||||
} |
|
||||||
|
|
||||||
public static Ast.Statement Create(Node contextNode, Node targetNode) |
|
||||||
{ |
|
||||||
// Propagate target up to the top most scope
|
|
||||||
while (targetNode.Parent != null && targetNode.Parent.HeadChild == targetNode) { |
|
||||||
targetNode = targetNode.Parent; |
|
||||||
} |
|
||||||
// If branches to the start of encapsulating loop
|
|
||||||
if (contextNode.Parent is Loop && targetNode == contextNode.Parent) { |
|
||||||
return new Ast.ContinueStatement(); |
|
||||||
} |
|
||||||
// If branches outside the encapsulating loop
|
|
||||||
if (contextNode.Parent is Loop && targetNode == contextNode.Parent.NextNode) { |
|
||||||
return new Ast.BreakStatement(); |
|
||||||
} |
|
||||||
return new Ast.MyGotoStatement(targetNode.Label); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,21 +0,0 @@ |
|||||||
using System; |
|
||||||
|
|
||||||
using Ast = ICSharpCode.NRefactory.Ast; |
|
||||||
using Decompiler.ControlFlow; |
|
||||||
|
|
||||||
namespace ICSharpCode.NRefactory.Ast |
|
||||||
{ |
|
||||||
public class MyLabelStatement: Ast.LabelStatement |
|
||||||
{ |
|
||||||
NodeLabel nodeLabel; |
|
||||||
|
|
||||||
public NodeLabel NodeLabel { |
|
||||||
get { return nodeLabel; } |
|
||||||
} |
|
||||||
|
|
||||||
public MyLabelStatement(NodeLabel nodeLabel): base(nodeLabel.Label) |
|
||||||
{ |
|
||||||
this.nodeLabel = nodeLabel; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
Loading…
Reference in new issue