Exemple #1
0
 internal ControlFlowNode(int blockIndex, int offset, ControlFlowNodeType nodeType)
 {
     this.BlockIndex = blockIndex;
     this.Offset     = offset;
     this.NodeType   = nodeType;
     this.Start      = this.End = null;
 }
Exemple #2
0
        ControlFlowNode CreateEndNode(Statement statement, bool addToNodeList = true)
        {
            Statement nextStatement;

            if (statement == rootStatement)
            {
                nextStatement = null;
            }
            else
            {
                // Find the next statement in the same role:
                AstNode next = statement;
                do
                {
                    next = next.NextSibling;
                } while (next != null && next.Role != statement.Role);
                nextStatement = next as Statement;
            }
            ControlFlowNodeType type = nextStatement != null ? ControlFlowNodeType.BetweenStatements : ControlFlowNodeType.EndNode;
            ControlFlowNode     node = CreateNode(statement, nextStatement, type);

            if (addToNodeList)
            {
                nodes.Add(node);
            }
            return(node);
        }
 public ControlFlowNode(StatementSyntax previousStatement, StatementSyntax nextStatement, ControlFlowNodeType type)
 {
     if (previousStatement == null && nextStatement == null)
         throw new ArgumentException("previousStatement and nextStatement must not be both null");
     this.PreviousStatement = previousStatement;
     this.NextStatement = nextStatement;
     this.Type = type;
 }
Exemple #4
0
 internal ControlFlowNode(int blockIndex, ExceptionHandler exceptionHandler, ControlFlowNode endFinallyOrFaultNode)
 {
     this.BlockIndex            = blockIndex;
     this.NodeType              = endFinallyOrFaultNode != null ? ControlFlowNodeType.FinallyOrFaultHandler : ControlFlowNodeType.CatchHandler;
     this.ExceptionHandler      = exceptionHandler;
     this.EndFinallyOrFaultNode = endFinallyOrFaultNode;
     Debug.Assert((exceptionHandler.HandlerType == ExceptionHandlerType.Finally || exceptionHandler.HandlerType == ExceptionHandlerType.Fault) == (endFinallyOrFaultNode != null));
     this.Offset = exceptionHandler.HandlerStart.Offset;
 }
Exemple #5
0
        ControlFlowNode CreateSpecialNode(Statement statement, ControlFlowNodeType type, bool addToNodeList = true)
        {
            ControlFlowNode node = CreateNode(null, statement, type);

            if (addToNodeList)
            {
                nodes.Add(node);
            }
            return(node);
        }
Exemple #6
0
 public ControlFlowNode(Statement previousStatement, Statement nextStatement, ControlFlowNodeType type)
 {
     if (previousStatement == null && nextStatement == null)
     {
         throw new ArgumentException("previousStatement and nextStatement must not be both null");
     }
     this.PreviousStatement = previousStatement;
     this.NextStatement     = nextStatement;
     this.Type = type;
 }
Exemple #7
0
 internal ControlFlowNode(int blockIndex, LinkedListNode <Instruction> start, LinkedListNode <Instruction> end)
 {
     if (start == null)
     {
         throw new ArgumentNullException("start");
     }
     if (end == null)
     {
         throw new ArgumentNullException("end");
     }
     this.BlockIndex = blockIndex;
     this.NodeType   = ControlFlowNodeType.Normal;
     this.Start      = start;
     this.End        = end;
     this.Offset     = start.Value.Offset;
 }
Exemple #8
0
 internal ControlFlowNode(int blockIndex, Instruction start, Instruction end)
 {
     if (start == null)
     {
         throw new ArgumentNullException("start");
     }
     if (end == null)
     {
         throw new ArgumentNullException("end");
     }
     this.BlockIndex = blockIndex;
     this.NodeType   = ControlFlowNodeType.Normal;
     this.Start      = start;
     this.End        = end;
     this.Offset     = start.Address;
 }
 internal ControlFlowNode(int blockIndex, Instruction start, Instruction end)
 {
     if (start == null)
     {
         throw new ArgumentNullException("start");
     }
     if (end == null)
     {
         throw new ArgumentNullException("end");
     }
     BlockIndex = blockIndex;
     NodeType   = ControlFlowNodeType.Normal;
     Start      = start;
     End        = end;
     Offset     = start.Offset;
 }
Exemple #10
0
        ControlFlowNode CreateEndNode(StatementSyntax statement, bool addToNodeList = true)
        {
            StatementSyntax nextStatement;

            if (statement == rootStatement)
            {
                nextStatement = null;
            }
            else
            {
                // Find the next statement in the same role:
                var list = statement.Parent.ChildNodes().ToList();
                var idx  = list.IndexOf(statement);
                nextStatement = idx >= 0 && idx + 1 < list.Count ? list[idx + 1] as StatementSyntax : null;
            }
            ControlFlowNodeType type = nextStatement != null ? ControlFlowNodeType.BetweenStatements : ControlFlowNodeType.EndNode;
            ControlFlowNode     node = CreateNode(statement, nextStatement, type);

            if (addToNodeList)
            {
                nodes.Add(node);
            }
            return(node);
        }
Exemple #11
0
		internal ControlFlowNode(int blockIndex, LinkedListNode<Instruction> start, LinkedListNode<Instruction> end)
		{
			if (start == null)
				throw new ArgumentNullException("start");
			if (end == null)
				throw new ArgumentNullException("end");
			this.BlockIndex = blockIndex;
			this.NodeType = ControlFlowNodeType.Normal;
			this.Start = start;
			this.End = end;
			this.Offset = start.Value.Offset;
		}
Exemple #12
0
        // Written according to the reachability rules in the C# spec (§8.1 End points and reachability)

        protected virtual ControlFlowNode CreateNode(Statement previousStatement, Statement nextStatement, ControlFlowNodeType type)
        {
            cancellationToken.ThrowIfCancellationRequested();
            return(new ControlFlowNode(previousStatement, nextStatement, type));
        }
		internal ControlFlowNode(int blockIndex, int offset, ControlFlowNodeType nodeType)
		{
			this.BlockIndex = blockIndex;
			this.Offset = offset;
			this.NodeType = nodeType;
		}
Exemple #14
0
		internal SsaBlock(ControlFlowNode node)
		{
			this.NodeType = node.NodeType;
			this.BlockIndex = node.BlockIndex;
		}
 ControlFlowNode CreateSpecialNode(StatementSyntax statement, ControlFlowNodeType type, bool addToNodeList = true)
 {
     ControlFlowNode node = CreateNode(null, statement, type);
     if (addToNodeList)
         nodes.Add(node);
     return node;
 }
		internal ControlFlowNode(int blockIndex, Instruction start, Instruction end)
		{
			if (start == null)
				throw new ArgumentNullException("start");
			if (end == null)
				throw new ArgumentNullException("end");
			BlockIndex = blockIndex;
			NodeType = ControlFlowNodeType.Normal;
			Start = start;
			End = end;
			Offset = start.Offset;
		}
Exemple #17
0
 internal SsaBlock(ControlFlowNode node)
 {
     this.NodeType   = node.NodeType;
     this.BlockIndex = node.BlockIndex;
 }
 internal ControlFlowNode(int blockIndex, int offset, ControlFlowNodeType nodeType)
 {
     BlockIndex = blockIndex;
     Offset     = offset;
     NodeType   = nodeType;
 }
Exemple #19
0
 internal ControlFlowNode(int blockIndex)
 {
     this.BlockIndex = blockIndex;
     this.NodeType = ControlFlowNodeType.Normal;
 }
Exemple #20
0
 internal ControlFlowNode(int blockIndex, uint?offset, ControlFlowNodeType nodeType)
 {
     this.BlockIndex = blockIndex;
     this.Offset     = offset;
     this.NodeType   = nodeType;
 }
 internal ControlFlowNode(int blockIndex)
 {
     this.BlockIndex = blockIndex;
     this.NodeType   = ControlFlowNodeType.Normal;
 }
Exemple #22
0
 public DefiniteAssignmentNode(Statement previousStatement, Statement nextStatement, ControlFlowNodeType type)
     : base(previousStatement, nextStatement, type)
 {
 }
Exemple #23
0
 protected override ControlFlowNode CreateNode(Statement previousStatement, Statement nextStatement, ControlFlowNodeType type)
 {
     return(new DefiniteAssignmentNode(previousStatement, nextStatement, type));
 }
		internal ControlFlowNode(int blockIndex, int offset, ControlFlowNodeType nodeType)
		{
			BlockIndex = blockIndex;
			Offset = offset;
			NodeType = nodeType;
		}
        // Written according to the reachability rules in the C# spec (§8.1 End points and reachability)

        protected virtual ControlFlowNode CreateNode(Statement previousStatement, Statement nextStatement, ControlFlowNodeType type)
        {
            return(new ControlFlowNode(previousStatement, nextStatement, type));
        }
		internal ControlFlowNode(int blockIndex, ExceptionHandler exceptionHandler, ControlFlowNode endFinallyOrFaultNode)
		{
			BlockIndex = blockIndex;
			NodeType = endFinallyOrFaultNode != null ? ControlFlowNodeType.FinallyOrFaultHandler : ControlFlowNodeType.CatchHandler;
			ExceptionHandler = exceptionHandler;
			EndFinallyOrFaultNode = endFinallyOrFaultNode;
			Debug.Assert((exceptionHandler.HandlerType == ExceptionHandlerType.Finally || exceptionHandler.HandlerType == ExceptionHandlerType.Fault) == (endFinallyOrFaultNode != null));
			Offset = exceptionHandler.HandlerStart.Offset;
		}
        // Written according to the reachability rules in the C# spec (§8.1 End points and reachability)

        protected virtual ControlFlowNode CreateNode(StatementSyntax previousStatement, StatementSyntax nextStatement, ControlFlowNodeType type)
        {
            cancellationToken.ThrowIfCancellationRequested();
            return new ControlFlowNode(previousStatement, nextStatement, type);
        }