Exemple #1
0
 public Task DecomposeAsync(Diagram diagram, DecompositionTerminalAssociator terminalAssociator,
                            ISemanticAnalysisTargetInfo targetInfo, CompileCancellationToken cancellationToken)
 {
     // Don't do anything; one of the transforms added by FunctionMocPlugin should remove all of these nodes from the DfirGraph during
     // target DFIR translation.
     return(AsyncHelpers.CompletedTask);
 }
Exemple #2
0
        /// <summary>
        /// Performs the code generation
        /// </summary>
        /// <param name="diagram">The diagram this node is on</param>
        /// <param name="terminalAssociator">Our terminal association manager</param>
        /// <param name="targetInfo">Semantic analysis target</param>
        /// <param name="cancellationToken">Cancelation token</param>
        public override Task DecomposeAsync(Diagram diagram, DecompositionTerminalAssociator terminalAssociator, ISemanticAnalysisTargetInfo targetInfo, CompileCancellationToken cancellationToken)
        {
            // Create a constant with our multiplier
            Constant constNode = Constant.Create(diagram, _multiplier, NITypes.Double);

            // Add a multiply primitive
            MultiplyPrimitive prim = MultiplyPrimitive.Create(diagram);

            // connect our input terminal to the first input of the multiply node
            terminalAssociator.AssociateTerminalByName("Input", prim.XTerminal);

            // Wire the constant to the second input of the multiply node
            Wire wire = Wire.Create(diagram, new Terminal[] { constNode.OutputTerminal, prim.YTerminal });

            // Connect the multiply output to our output
            terminalAssociator.AssociateTerminalByName("Result", prim.XTimesYTerminal);

            return(AsyncHelpers.CompletedTask);
        }
Exemple #3
0
 /// <summary>
 /// Gets when the node needs to be decomposed.
 /// </summary>
 /// <param name="targetInfo">Target on which this node will be decomposed.</param>
 /// <returns>When the node should decompose.</returns>
 public override DecomposeStrategy DecomposeWhen(ISemanticAnalysisTargetInfo targetInfo)
 {
     return(DecomposeStrategy.AfterSemanticAnalysis);
 }
        /// <summary>
        /// Performs the code generation
        /// </summary>
        /// <param name="diagram">The diagram this node is on</param>
        /// <param name="terminalAssociator">Our terminal association manager</param>
        /// <param name="targetInfo">Semantic analysis target</param>
        /// <param name="cancellationToken">Cancelation token</param>
        public override Task DecomposeAsync(Diagram diagram, DecompositionTerminalAssociator terminalAssociator, ISemanticAnalysisTargetInfo targetInfo, CompileCancellationToken cancellationToken)
        {
            NIType methodType = CreateMethodType();
            var    methodCall = MethodCall.CreateWithErrorTerminals(diagram, methodType.GetDeclaringType(), methodType);

            methodCall.UpdateTerminals();
            terminalAssociator.AssociateTerminalByName("names", methodCall.GetTerminalByName("names"));
            terminalAssociator.AssociateTerminalByName("extra name", methodCall.GetTerminalByName("extraName"));
            terminalAssociator.AssociateTerminalByName("length", methodCall.OutputTerminals.Last());
            return(AsyncHelpers.CompletedTask);
        }
 public RebarSupportedTargetTransform(ISemanticAnalysisTargetInfo semanticAnalysisTargetInfo)
 {
     _semanticAnalysisTargetInfo = semanticAnalysisTargetInfo;
 }