/// <summary> /// Creates a new dependency edge between two nodes. /// </summary> /// <param name="origin">The dependent node.</param> /// <param name="target">The dependency node.</param> /// <param name="type">The type of dependency.</param> /// <param name="metadata">The metadata associated to the edge.</param> public DataFlowEdge(DataFlowNode <TContents> origin, DataFlowNode <TContents> target, DataDependencyType type, object metadata) { Origin = origin; Target = target; Type = type; Metadata = metadata; }
/// <summary> /// Adds a data source to the dependency, referencing a stack value produced by the provided node. /// </summary> /// <param name="node">The node producing the value.</param> /// <param name="slotIndex">The index of the stack value that was produced by the node.</param> /// <returns>The stack data source.</returns> public StackDataSource <TContents> Add(DataFlowNode <TContents> node, int slotIndex) { var source = new StackDataSource <TContents>(node, slotIndex); return(Add(source) ? source : this.First(x => x.Equals(source))); }
/// <summary> /// Adds a data source to the dependency, referencing a variable value assigned by the provided node. /// </summary> /// <param name="node">The node assigning the value.</param> /// <returns>The variable data source.</returns> public VariableDataSource <TContents> Add(DataFlowNode <TContents> node) { var source = new VariableDataSource <TContents>(node, Variable); return(Add(source) ? source : this.First(x => x.Equals(source))); }
/// <summary> /// Creates a new dependency edge between two nodes. /// </summary> /// <param name="dependent">The dependent node.</param> /// <param name="target">The dependency node.</param> public DataFlowEdge(DataFlowNode <TContents> dependent, DataSource <TContents> target) { Dependent = dependent; DataSource = target; }
/// <summary> /// Creates a new variable data source referencing a variable value assigned by the provided node. /// </summary> /// <param name="node">The node assigning the value.</param> /// <param name="variable">The variable that was assigned a value.</param> public VariableDataSource(DataFlowNode <TContents> node, IVariable variable) : base(node) { Variable = variable ?? throw new ArgumentNullException(nameof(variable)); }
/// <summary> /// Creates a new data source. /// </summary> /// <param name="node">The node producing the data.</param> protected DataSource(DataFlowNode <TContents> node) { Node = node ?? throw new ArgumentNullException(nameof(node)); }
/// <summary> /// Creates a new data dependency with the provided data sources. /// </summary> public DataDependency(DataFlowNode <TContents> sourceNode) : base(new DataSource <TContents>(sourceNode)) { }
/// <summary> /// Creates a new stack data source. /// </summary> /// <param name="node">The node producing the data.</param> /// <param name="slotIndex">gets a value indicating the stack slot index that was pushed by the instruction /// referenced in <paramref name="node"/>.</param> public DataSource(DataFlowNode <TContents> node, int slotIndex) { Node = node ?? throw new ArgumentNullException(nameof(node)); SlotIndex = slotIndex; }