Exemple #1
0
        public override IEnumerable <AssociativeNode> BuildOutputAst(
            List <AssociativeNode> inputAstNodes)
        {
            if (IsPartiallyApplied)
            {
                return(new[]
                {
                    AstFactory.BuildAssignment(
                        GetAstIdentifierForOutputIndex(0),
                        AstFactory.BuildFunctionObject(
                            new IdentifierListNode
                    {
                        LeftNode = AstFactory.BuildIdentifier("DataBridge"),
                        RightNode = AstFactory.BuildIdentifier("BridgeData")
                    },
                            2,
                            new[] { 0 },
                            new List <AssociativeNode>
                    {
                        AstFactory.BuildStringNode(GUID.ToString()),
                        AstFactory.BuildNullNode()
                    }))
                });
            }

            var resultAst = new[]
            {
                AstFactory.BuildAssignment(
                    AstFactory.BuildIdentifier(AstIdentifierBase + "_dummy"),
                    DataBridge.GenerateBridgeDataAst(GUID.ToString(), inputAstNodes[0])),
                AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), inputAstNodes[0])
            };

            return(resultAst);
        }
Exemple #2
0
 public override IEnumerable <AssociativeNode> BuildOutputAst(List <AssociativeNode> inputAstNodes)
 {
     return(new List <AssociativeNode>()
     {
         AstFactory.BuildAssignment(
             AstFactory.BuildIdentifier(AstIdentifierBase + "_dummy"),
             DataBridge.GenerateBridgeDataAst(GUID.ToString(), AstFactory.BuildExprList(inputAstNodes ?? new List <AssociativeNode>())))
     });
 }
        internal BinaryExpressionNode CreatePreCompilationAstNode(NodeModel node, List <AssociativeNode> inputAstNodes)
        {
            IdentifierNode identifier = AstFactory.BuildIdentifier(node.AstIdentifierBase + beginTag);

            string          id           = node.GUID.ToString();
            ExprListNode    exprListNode = AstFactory.BuildExprList(inputAstNodes);
            AssociativeNode bridgeData   = DataBridge.GenerateBridgeDataAst(id + profilingID, exprListNode);

            return(AstFactory.BuildAssignment(identifier, bridgeData));
        }
Exemple #4
0
        public override IEnumerable <AssociativeNode> BuildOutputAst(List <AssociativeNode> inputAstNodes)
        {
            yield return
                (AstFactory.BuildAssignment(
                     GetAstIdentifierForOutputIndex(0),
                     AstFactory.BuildFunctionCall(func, inputAstNodes)));

            yield return
                (AstFactory.BuildAssignment(
                     AstFactory.BuildIdentifier(AstIdentifierBase + "_dummy"),
                     DataBridge.GenerateBridgeDataAst(GUID.ToString(), GetAstIdentifierForOutputIndex(0))));
        }
        internal BinaryExpressionNode CreatePostCompilationAstNode(NodeModel node, List <AssociativeNode> inputAstNodes)
        {
            IdentifierNode identifier = AstFactory.BuildIdentifier(node.AstIdentifierBase + endTag);

            string id = node.GUID.ToString();
            List <AssociativeNode> outPortNodeList =
                Enumerable.Range(0, node.OutPorts.Count).Select(
                    index => (AssociativeNode)node.GetAstIdentifierForOutputIndex(index)).ToList();
            ExprListNode    exprListNode = AstFactory.BuildExprList(outPortNodeList);
            AssociativeNode bridgeData   = DataBridge.GenerateBridgeDataAst(id + profilingID, exprListNode);

            return(AstFactory.BuildAssignment(identifier, bridgeData));
        }
        public override IEnumerable <AssociativeNode> BuildOutputAst(List <AssociativeNode> inputAsNodes)
        {
            var doubleNode = AstFactory.BuildDoubleNode(number);

            //var funcNode = AstFactory.BuildFunctionCall(
            //    new Func<double, double, double>(NodeModelsEssentialsFunctions.Multiply),
            //    new List<AssociativeNode>() { doubleNode, doubleNode }
            //    );

            return(new[]
            {
                AstFactory.BuildAssignment(
                    GetAstIdentifierForOutputIndex(0),
                    doubleNode),
                AstFactory.BuildAssignment(
                    AstFactory.BuildIdentifier(AstIdentifierBase + "_dummy"),
                    DataBridge.GenerateBridgeDataAst(GUID.ToString(), doubleNode))
            });
        }
Exemple #7
0
        public override IEnumerable <AssociativeNode> BuildOutputAst(List <AssociativeNode> inputAsNodes)
        {
            //if (!InPorts[0].Connectors.Any())
            //{
            //    return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) };
            //}

            var textNode = AstFactory.BuildStringNode(text);

            //var funcNode = AstFactory.BuildFunctionCall(
            //    new Func<List<object>, int, object>(NodeModelsEssentialsFunctions.SetTextValue),
            //    new List<AssociativeNode>() { inputAsNodes[0], textNode }
            //    );

            return(new[]
            {
                AstFactory.BuildAssignment(
                    GetAstIdentifierForOutputIndex(0),
                    textNode),
                AstFactory.BuildAssignment(
                    AstFactory.BuildIdentifier(AstIdentifierBase + "_dummy"),
                    DataBridge.GenerateBridgeDataAst(GUID.ToString(), inputAsNodes[0]))
            });
        }