Exemplo n.º 1
0
        public CallFlowNode AddCallNode(
            IRoutineLocation location,
            IEnumerable <Expression> arguments           = null,
            IEnumerable <FlowVariable> returnAssignments = null,
            CallKind kind       = CallKind.Static,
            FlowNodeFlags flags = FlowNodeFlags.None)
        {
            Contract.Requires <InvalidOperationException>(this.Graph != null);
            Contract.Requires <ArgumentNullException>(location != null, nameof(location));
            Contract.Requires <ArgumentException>(kind != CallKind.ObjectCreation || location.IsConstructor, nameof(kind));

            var nodeId = this.nodeIdProvider.GenerateNewId();
            var node   = new CallFlowNode(
                this.Graph,
                nodeId,
                flags,
                location,
                arguments ?? Enumerable.Empty <Expression>(),
                returnAssignments ?? Enumerable.Empty <FlowVariable>(),
                kind);

            this.Graph.MutableNodes.Add(node);
            Contract.Assert(nodeId.Value == this.Graph.MutableNodes.IndexOf(node));

            return(node);
        }
Exemplo n.º 2
0
 public static OuterFlowEdge CreateReturn(OuterFlowEdgeId id, ReturnFlowNode returnNode, CallFlowNode callNode)
 {
     return(new OuterFlowEdge(id, OuterFlowEdgeKind.Return, returnNode, callNode));
 }
Exemplo n.º 3
0
 public static OuterFlowEdge CreateMethodCall(OuterFlowEdgeId id, CallFlowNode callNode, EnterFlowNode enterNode)
 {
     return(new OuterFlowEdge(id, OuterFlowEdgeKind.MethodCall, callNode, enterNode));
 }