• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# AssociativeGraph类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中AssociativeGraph的典型用法代码示例。如果您正苦于以下问题:C# AssociativeGraph类的具体用法?C# AssociativeGraph怎么用?C# AssociativeGraph使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AssociativeGraph类属于命名空间,在下文中一共展示了AssociativeGraph类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: SetFinalGraphNodeRuntimeDependents

 /// <summary>
 /// This function sets the modified temp graphnodes to the last graphnode in a statement
 /// </summary>
 /// <param name="graphnode"></param>
 public static void SetFinalGraphNodeRuntimeDependents(AssociativeGraph.GraphNode graphnode)
 {
     if (null != graphnode && graphnode.IsSSANode())
     {
         if (null != graphnode.lastGraphNode)
         {
             graphnode.lastGraphNode.symbolListWithinExpression.Add(graphnode.updateNodeRefList[0].nodeList[0].symbol);
         }
     }
 }
开发者ID:algobasket,项目名称:Dynamo,代码行数:14,代码来源:AssociativeGraph.cs


示例2: LogSemanticError

        public void LogSemanticError(string msg, string fileName = null, int line = -1, int col = -1, AssociativeGraph.GraphNode graphNode = null)
        {
            /*if (fileName == null)
            {
                fileName = "N.A.";
            }*/

            if (logErrors)
            {
                System.Console.WriteLine("{0}({1},{2}) Error:{3}", fileName, line, col, msg);
            }

            if (compileState.Options.IsDeltaExecution)
            {
                compileState.LogErrorInGlobalMap(ProtoLanguage.CompileStateTracker.ErrorType.Error, msg, fileName, line, col);
            }

            BuildData.ErrorEntry errorEntry = new BuildData.ErrorEntry
            {
                FileName = fileName,
                Message = msg,
                Line = line,
                Col = col
            };
            errors.Add(errorEntry);

            // Comment: This is true for example in Graph Execution mode
            /*if (errorAsWarning)
            {
                if (graphNode != null)
                {
                    graphNode.isDirty = false;
                    return;
                }
            }*/

            OutputMessage outputmessage = new OutputMessage(OutputMessage.MessageType.Error, msg.Trim(), fileName, line, col);
            if (MessageHandler != null)
            {
                MessageHandler.Write(outputmessage);
                if (WebMsgHandler != null)
                {
                    OutputMessage webOutputMsg = new OutputMessage(OutputMessage.MessageType.Error, msg.Trim(), "", line, col);
                    WebMsgHandler.Write(webOutputMsg);
                }
                if (!outputmessage.Continue)
                    throw new BuildHaltException(msg);
            }
            throw new BuildHaltException(msg);
        }
开发者ID:qingemeng,项目名称:designscript,代码行数:50,代码来源:BuildStatus.cs


示例3: UpdateDependencyGraph

        /// <summary>
        /// Check if an update is triggered;
        /// Find all graph nodes whos dependents contain this symbol;
        /// Mark those nodes as dirty
        /// </summary>
        public int UpdateDependencyGraph(
            int exprUID,
            int modBlkId,
            bool isSSAAssign,
            AssociativeGraph.GraphNode executingGraphNode,
            bool propertyChanged = false)
        {
            int nodesMarkedDirty = 0;
            if (executingGraphNode == null)
            {
                return nodesMarkedDirty;
            }

            int classIndex = executingGraphNode.classIndex;
            int procIndex = executingGraphNode.procIndex;

            var graph = istream.dependencyGraph;
            var graphNodes = graph.GetGraphNodesAtScope(classIndex, procIndex);
            if (graphNodes == null)
            {
                return nodesMarkedDirty;
            }

            //foreach (var graphNode in graphNodes)
            for (int i = 0; i < graphNodes.Count; ++i)
            {
                var graphNode = graphNodes[i];

                // If the graphnode is inactive then it is no longer executed
                if (!graphNode.isActive)
                {
                    continue;
                }
                //
                // Comment Jun: 
                //      This is clarifying the intention that if the graphnode is within the same SSA expression, we still allow update
                //
                bool allowUpdateWithinSSA = false;
                if (core.Options.ExecuteSSA)
                {
                    allowUpdateWithinSSA = true;
                    isSSAAssign = false; // Remove references to this when ssa flag is removed

                    // Do not update if its a property change and the current graphnode is the same expression
                    if (propertyChanged && graphNode.exprUID == Properties.executingGraphNode.exprUID)
                    {
                        continue;
                    }
                }
                else
                {
                    // TODO Jun: Remove this code immediatley after enabling SSA
                    bool withinSSAStatement = graphNode.UID == executingGraphNode.UID;
                    allowUpdateWithinSSA = !withinSSAStatement;
                }

                if (!allowUpdateWithinSSA || (propertyChanged && graphNode == Properties.executingGraphNode))
                {
                    continue;
                }

                foreach (var noderef in executingGraphNode.updateNodeRefList)
                {
                    ProtoCore.AssociativeGraph.GraphNode matchingNode = null;
                    if (!graphNode.DependsOn(noderef, ref matchingNode))
                    {
                        continue;
                    }

                    // Jun: only allow update to other expr id's (other statements) if this is the final SSA assignment
                    if (core.Options.ExecuteSSA && !propertyChanged)
                    {
                        if (null != Properties.executingGraphNode && Properties.executingGraphNode.IsSSANode())
                        {
                            // This is still an SSA statement, if a node of another statement depends on it, ignore it
                            if (graphNode.exprUID != Properties.executingGraphNode.exprUID)
                            {
                                // Defer this update until the final non-ssa node
                                deferedGraphNodes.Add(graphNode);
                                continue;
                            }
                        }
                    }

                    // @keyu: if we are modifying an object's property, e.g.,
                    // 
                    //    foo.id = 42;
                    //
                    // both dependent list and update list of the corresponding 
                    // graph node contains "foo" and "id", so if property "id"
                    // is changed, this graph node will be re-executed and the
                    // value of "id" is incorrectly set back to old value.
                    if (propertyChanged)
                    {
                        var depUpdateNodeRef = graphNode.dependentList[0].updateNodeRefList[0];
//.........这里部分代码省略.........
开发者ID:TheChosen0ne,项目名称:Dynamo,代码行数:101,代码来源:Executive.cs


示例4: SetGraphNodeStackValueNull

 private void SetGraphNodeStackValueNull(AssociativeGraph.GraphNode graphNode)
 {
     StackValue svNull = StackValue.Null;
     SetGraphNodeStackValue(graphNode, svNull);
 }
开发者ID:TheChosen0ne,项目名称:Dynamo,代码行数:5,代码来源:Executive.cs


示例5: HasCyclicDependency

 private bool HasCyclicDependency(AssociativeGraph.GraphNode node)
 {
     return node.counter > runtimeCore.Options.kDynamicCycleThreshold;
 }
开发者ID:jeremytammik,项目名称:Dynamo,代码行数:4,代码来源:Executive.cs


示例6: BuildRealDependencyForIdentList

        protected void BuildRealDependencyForIdentList(AssociativeGraph.GraphNode graphNode)
        {
            if (ssaPointerStack.Count == 0)
            {
                return;
            }

            // Push all dependent pointers
            ProtoCore.AST.AssociativeAST.IdentifierListNode identList = BuildIdentifierList(ssaPointerStack.Peek());

            // Comment Jun: perhaps this can be an assert?
            if (null != identList)
            {
                ProtoCore.Type type = new ProtoCore.Type();
                type.UID = globalClassIndex;
                ProtoCore.AssociativeGraph.UpdateNodeRef nodeRef = new AssociativeGraph.UpdateNodeRef();
                int functionIndex = globalProcIndex;
                DFSGetSymbolList_Simple(identList, ref type, ref functionIndex, nodeRef);

                if (null != graphNode && nodeRef.nodeList.Count > 0)
                {
                    ProtoCore.AssociativeGraph.GraphNode dependentNode = new ProtoCore.AssociativeGraph.GraphNode();
                    dependentNode.updateNodeRefList.Add(nodeRef);
                    graphNode.PushDependent(dependentNode);

                    // If the pointerList is a setter, then it should also be in the lhs of a graphNode
                    //  Given:
                    //      a.x = 1 
                    //  Which was converted to: 
                    //      tvar = a.set_x(1)
                    //  Set a.x as lhs of the graphnode. 
                    //  This means that statement that depends on a.x can re-execute, such as:
                    //      p = a.x;
                    //
                    List<ProtoCore.AST.AssociativeAST.AssociativeNode> topList = ssaPointerStack.Peek();
                    string propertyName = topList[topList.Count - 1].Name;
                    bool isSetter = propertyName.StartsWith(Constants.kSetterPrefix);
                    if (isSetter)
                    {
                        graphNode.updateNodeRefList.Add(nodeRef);
                        graphNode.IsLHSIdentList = true;

                        AutoGenerateUpdateArgumentReference(nodeRef, graphNode);
                    }
                }
            }
        }
开发者ID:ankushraizada,项目名称:Dynamo,代码行数:47,代码来源:CodeGen.cs


示例7: EmitStringNode

        protected void EmitStringNode(
            Node node, 
            ref Type inferedType, 
            AssociativeGraph.GraphNode graphNode = null,
            ProtoCore.CompilerDefinitions.Associative.SubCompilePass subPass = ProtoCore.CompilerDefinitions.Associative.SubCompilePass.kNone)
        {
            if (subPass == ProtoCore.CompilerDefinitions.Associative.SubCompilePass.kUnboundIdentifier)
            {
                return;
            }

            dynamic sNode = node;
            if (!enforceTypeCheck || core.TypeSystem.IsHigherRank((int)PrimitiveType.kTypeString, inferedType.UID))
            {
                inferedType.UID = (int)PrimitiveType.kTypeString;
            }

            if (core.Options.TempReplicationGuideEmptyFlag && emitReplicationGuide)
            {
                EmitInstrConsole(ProtoCore.DSASM.kw.push, 0 + "[guide]");
                StackValue opNumGuides = StackValue.BuildReplicationGuide(0);
                EmitPush(opNumGuides);
            }

            string value = (string)sNode.Value;
            StackValue svString = core.Heap.AllocateFixedString(value);
            if (core.Options.TempReplicationGuideEmptyFlag && emitReplicationGuide)
            {
                EmitInstrConsole(kw.pushg, "\"" + value + "\"");
                EmitPushG(svString, node.line, node.col);
            }
            else
            {
                EmitInstrConsole(kw.push, "\"" + value + "\"");
                EmitPush(svString, node.line, node.col);
            }

            if (IsAssociativeArrayIndexing && graphNode != null && graphNode.isIndexingLHS)
            {
                SymbolNode literalSymbol = new SymbolNode();
                literalSymbol.name = value;

                var dimNode = new AssociativeGraph.UpdateNode();
                dimNode.symbol = literalSymbol;
                dimNode.nodeType = AssociativeGraph.UpdateNodeType.kLiteral;

                graphNode.dimensionNodeList.Add(dimNode);
            }
        }
开发者ID:ankushraizada,项目名称:Dynamo,代码行数:49,代码来源:CodeGen.cs


示例8: PushGraphNode

 /// <summary>
 /// Append the graphnode to the instruction stream and procedure nodes
 /// </summary>
 /// <param name="graphnode"></param>
 protected void PushGraphNode(AssociativeGraph.GraphNode graphnode)
 {
     codeBlock.instrStream.dependencyGraph.Push(graphnode);
     if (globalProcIndex != Constants.kGlobalScope)
     {
         localProcedure.GraphNodeList.Add(graphnode);
     }
 }
开发者ID:ankushraizada,项目名称:Dynamo,代码行数:12,代码来源:CodeGen.cs


示例9: UpdateGraphNodeDependency

        //
        // Comment Jun: Revised 
        //
        //  proc UpdateGraphNodeDependency(execnode)
        //      foreach node in graphnodelist 
        //          if execnode.lhs is equal to node.lhs
        //              if execnode.HasDependents() 
        //                  if execnode.Dependents() is not equal to node.Dependents()
        //                      node.RemoveDependents()
        //                  end
        //              end
        //          end
        //      end
        //  end
        //
        private void UpdateGraphNodeDependency(AssociativeGraph.GraphNode gnode, AssociativeGraph.GraphNode executingNode)
        {
            if (gnode.UID >= executingNode.UID // for previous graphnodes
                || gnode.updateNodeRefList.Count == 0
                || gnode.updateNodeRefList.Count != executingNode.updateNodeRefList.Count
                || gnode.isAutoGenerated)
            {
                return;
            }

            for (int n = 0; n < executingNode.updateNodeRefList.Count; ++n)
            {
                if (!gnode.updateNodeRefList[n].IsEqual(executingNode.updateNodeRefList[n]))
                {
                    return;
                }
            }

            //if (executingNode.dependentList.Count > 0)
            {
                // if execnode.Dependents() is not equal to node.Dependents()
                // TODO Jun: Extend this check
                bool areDependentsEqual = false;
                if (!areDependentsEqual)
                {
                    gnode.dependentList.Clear();
                }
            }
        }
开发者ID:santom,项目名称:designscript,代码行数:44,代码来源:Executive.cs


示例10: SetGraphNodeStackValueNull

 private void SetGraphNodeStackValueNull(AssociativeGraph.GraphNode graphNode)
 {
     StackValue svNull = StackUtils.BuildNull();
     SetGraphNodeStackValue(graphNode, svNull);
 }
开发者ID:santom,项目名称:designscript,代码行数:5,代码来源:Executive.cs


示例11: SetUpStepOverFunctionCalls

        public void SetUpStepOverFunctionCalls(ProtoCore.Core core, ProcedureNode fNode, AssociativeGraph.GraphNode graphNode, bool hasDebugInfo)
        {
            int tempPC = DebugEntryPC;
            int limit = 0;  // end pc of current expression
            InstructionStream istream;

            int pc = tempPC;
            if (core.DebugProps.InlineConditionOptions.isInlineConditional == true)
            {
                tempPC = InlineConditionOptions.startPc;
                limit = InlineConditionOptions.endPc;
                istream = core.DSExecutable.instrStreamList[InlineConditionOptions.instructionStream];
            }
            else
            {
                pc = tempPC;
                istream = core.DSExecutable.instrStreamList[core.RunningBlock];
                if (istream.language == Language.kAssociative)
                {
                    limit = FindEndPCForAssocGraphNode(pc, istream, fNode, graphNode, core.Options.ExecuteSSA);
                    //Validity.Assert(limit != ProtoCore.DSASM.Constants.kInvalidIndex);
                }
                else if (istream.language == Language.kImperative)
                {
                    // Check for 'SETEXPUID' instruction to check for end of expression
                    while (++pc < istream.instrList.Count)
                    {
                        Instruction instr = istream.instrList[pc];
                        if (instr.opCode == OpCode.SETEXPUID)
                        {
                            limit = pc;
                            break;
                        }
                    }
                }
            }

            // Determine if this is outermost CALLR in the expression
            // until then do not restore any breakpoints
            // If outermost CALLR, restore breakpoints after end of expression
            pc = tempPC;
            int numNestedFunctionCalls = 0;
            while (++pc <= limit)
            {
                Instruction instr = istream.instrList[pc];
                if (instr.opCode == OpCode.CALLR && instr.debug != null)
                {
                    numNestedFunctionCalls++;
                }
            }
            if (numNestedFunctionCalls == 0)
            {
                // If this is the outermost function call 
                core.Breakpoints.Clear();
                core.Breakpoints.AddRange(AllbreakPoints);

                pc = tempPC;
                while (++pc <= limit)
                {
                    Instruction instr = istream.instrList[pc];
                    // We still want to break at the closing brace of a function or ctor call or language block
                    if (instr.debug != null && instr.opCode != OpCode.RETC && instr.opCode != OpCode.RETURN && 
                        (instr.opCode != OpCode.RETB)) 
                    {
                        if (core.Breakpoints.Contains(instr))
                            core.Breakpoints.Remove(instr);
                    }
                }
            }
        }
开发者ID:algobasket,项目名称:Dynamo,代码行数:70,代码来源:Core.cs


示例12: FindEndPCForAssocGraphNode

        private int FindEndPCForAssocGraphNode(int tempPC, InstructionStream istream, ProcedureNode fNode, AssociativeGraph.GraphNode graphNode, bool handleSSATemps)
        {
            int limit = Constants.kInvalidIndex;
            //AssociativeGraph.GraphNode currentGraphNode = executingGraphNode;
            AssociativeGraph.GraphNode currentGraphNode = graphNode;
            //Validity.Assert(currentGraphNode != null);

            if (currentGraphNode != null)
            {
                if (tempPC < currentGraphNode.updateBlock.startpc || tempPC > currentGraphNode.updateBlock.endpc)
                {
                    //   return false;
                    return Constants.kInvalidIndex;
                }

                int i = currentGraphNode.dependencyGraphListID;
                AssociativeGraph.GraphNode nextGraphNode = currentGraphNode;
                while (currentGraphNode.exprUID != ProtoCore.DSASM.Constants.kInvalidIndex 
                        && currentGraphNode.exprUID == nextGraphNode.exprUID)

                {
                    limit = nextGraphNode.updateBlock.endpc;
                    if (++i < istream.dependencyGraph.GraphList.Count)
                    {
                        nextGraphNode = istream.dependencyGraph.GraphList[i];
                    }
                    else
                    {
                        break;
                    }

                    // Is it the next statement 
                    // This check will be deprecated on full SSA
                    if (handleSSATemps)
                    {
                        if (!nextGraphNode.IsSSANode())
                        {
                            // The next graphnode is nolonger part of the current statement 
                            // This is the end pc needed to run until
                            nextGraphNode = istream.dependencyGraph.GraphList[i];
                            limit = nextGraphNode.updateBlock.endpc;
                            break;
                        }
                    }
                }
            }
            // If graph node is null in associative lang block, it either is the very first property declaration or
            // it is the very first or only function call statement ("return = f();") inside the calling function
            // Here there's most likely a DEP or RETURN respectively after the function call
            // in which case, search for the instruction and set that as the new pc limit
            else if (!fNode.name.Contains(Constants.kSetterPrefix))
            {
                while (++tempPC < istream.instrList.Count)
                {
                    Instruction instr = istream.instrList[tempPC];
                    if (instr.opCode == OpCode.DEP || instr.opCode == OpCode.RETURN)
                    {
                        limit = tempPC;
                        break;
                    }
                }
            }
            return limit;
        }
开发者ID:algobasket,项目名称:Dynamo,代码行数:64,代码来源:Core.cs


示例13: UpdateDependencyGraph

        /// <summary>
        /// Check if an update is triggered;
        /// Find all graph nodes whos dependents contain this symbol;
        /// Mark those nodes as dirty
        /// </summary>
        public int UpdateDependencyGraph(
            int exprUID,
            int modBlkId,
            bool isSSAAssign,
            AssociativeGraph.GraphNode executingGraphNode,
            bool propertyChanged = false)
        {
            int nodesMarkedDirty = 0;
            if (executingGraphNode == null)
            {
                return nodesMarkedDirty;
            }

            int classIndex = executingGraphNode.classIndex;
            int procIndex = executingGraphNode.procIndex;

            var graph = istream.dependencyGraph;
            var graphNodes = graph.GetGraphNodesAtScope(classIndex, procIndex);
            if (graphNodes == null)
            {
                return nodesMarkedDirty;
            }

            foreach (var graphNode in graphNodes)
            {
                //
                // Comment Jun: 
                //      This is clarifying the intention that if the graphnode is within the same SSA expression, we still allow update
                //
                bool allowUpdateWithinSSA = true;
                if (!allowUpdateWithinSSA || (propertyChanged && graphNode == Properties.executingGraphNode))
                {
                    continue;
                }

                foreach (var noderef in executingGraphNode.updateNodeRefList)
                {
                    ProtoCore.AssociativeGraph.GraphNode matchingNode = null;
                    if (!graphNode.DependsOn(noderef, ref matchingNode))
                    {
                        continue;
                    }

                    // @keyu: if we are modifying an object's property, e.g.,
                    // 
                    //    foo.id = 42;
                    //
                    // both dependent list and update list of the corresponding 
                    // graph node contains "foo" and "id", so if property "id"
                    // is changed, this graph node will be re-executed and the
                    // value of "id" is incorrectly set back to old value.
                    if (propertyChanged)
                    {
                        var depUpdateNodeRef = graphNode.dependentList[0].updateNodeRefList[0];
                        if (graphNode.updateNodeRefList.Count == 1)
                        {
                            var updateNodeRef = graphNode.updateNodeRefList[0];
                            if (depUpdateNodeRef.IsEqual(updateNodeRef))
                            {
                                continue;
                            }
                        }
                    }

                    //
                    // Comment Jun: We dont want to cycle between such statements:
                    //
                    // a1.a = 1;
                    // a1.a = 10;
                    //

                    Validity.Assert(null != matchingNode);
                    bool isLHSModification = matchingNode.isLHSNode;
                    bool isUpdateable = matchingNode.IsUpdateableBy(noderef);

                    // isSSAAssign means this is the graphnode of the final SSA assignment
                    // Overrride this if allowing within SSA update
                    // TODO Jun: Remove this code when SSA is completely enabled
                    bool allowSSADownstream = graphNode.UID > executingGraphNode.UID;
                    

                    // Comment Jun: 
                    //      If the triggered dependent graphnode is LHS 
                    //          and... 
                    //      the triggering node (executing graphnode)
                    if (isLHSModification && !isUpdateable)
                    {
                        break;
                    }

                    // TODO Jun: Optimization - Reimplement update delta evaluation using registers
                    //if (IsNodeModified(EX, FX))
                    if (exprUID != graphNode.exprUID && modBlkId != graphNode.modBlkUID)
                    {
                        UpdateModifierBlockDependencyGraph(graphNode);
//.........这里部分代码省略.........
开发者ID:qingemeng,项目名称:designscript,代码行数:101,代码来源:Executive.cs


示例14: DfsEmitArrayIndexHeap

        protected int DfsEmitArrayIndexHeap(Node node, AssociativeGraph.GraphNode graphNode = null, ProtoCore.AST.Node parentNode = null, ProtoCore.DSASM.AssociativeSubCompilePass subPass = ProtoCore.DSASM.AssociativeSubCompilePass.kNone)
        {
            int indexCnt = 0;
            Debug.Assert(node is ProtoCore.AST.AssociativeAST.ArrayNode || node is ProtoCore.AST.ImperativeAST.ArrayNode);

            IsAssociativeArrayIndexing = true;

            dynamic arrayNode = node;
            while (arrayNode is ProtoCore.AST.AssociativeAST.ArrayNode || arrayNode is ProtoCore.AST.ImperativeAST.ArrayNode)
            {
                ++indexCnt;
                dynamic array = arrayNode;
                ProtoCore.Type lastType = new ProtoCore.Type();
                lastType.UID = (int)PrimitiveType.kTypeVoid;
                lastType.IsIndexable = false;
                DfsTraverse(array.Expr, ref lastType, false, graphNode, subPass, parentNode);
                arrayNode = array.Type;
            }

            IsAssociativeArrayIndexing = false;

            return indexCnt;
        }
开发者ID:santom,项目名称:designscript,代码行数:23,代码来源:CodeGen.cs


示例15: EmitStringNode

        protected void EmitStringNode(
            Node node, 
            ref Type inferedType, 
            AssociativeGraph.GraphNode graphNode = null,
            AssociativeSubCompilePass subPass = AssociativeSubCompilePass.kNone)
        {
            if (subPass == AssociativeSubCompilePass.kUnboundIdentifier)
            {
                return;
            }

            dynamic sNode = node;
            if (!enforceTypeCheck || core.TypeSystem.IsHigherRank((int)PrimitiveType.kTypeString, inferedType.UID))
            {
                inferedType.UID = (int)PrimitiveType.kTypeString;
            }

            Byte[] utf8bytes = EncodingUtils.UTF8StringToUTF8Bytes((String)sNode.value);
            String value = Encoding.UTF8.GetString(utf8bytes);

            foreach (char ch in value)
            {
                String strValue = "'" + ch + "'";
                EmitInstrConsole(kw.push, strValue);

                StackValue op = StackValue.BuildChar(ch);
                EmitPush(op, node.line, node.col);
            }

            if (IsAssociativeArrayIndexing && graphNode != null && graphNode.isIndexingLHS)
            {
                SymbolNode literalSymbol = new SymbolNode();
                literalSymbol.name = value;

                var dimNode = new AssociativeGraph.UpdateNode();
                dimNode.symbol = literalSymbol;
                dimNode.nodeType = AssociativeGraph.UpdateNodeType.kLiteral;

                graphNode.dimensionNodeList.Add(dimNode);
            }

            EmitInstrConsole(kw.alloca, value.Length.ToString());
            EmitPopString(value.Length);
        }
开发者ID:RobertiF,项目名称:Dynamo,代码行数:44,代码来源:CodeGen.cs


示例16: SetGraphNodeStackValue

 private void SetGraphNodeStackValue(AssociativeGraph.GraphNode graphNode, StackValue sv)
 {
     Validity.Assert(!graphNode.isReturn);
     // TODO Jun: Expand me to handle complex ident lists
     SymbolNode symbol = graphNode.updateNodeRefList[0].nodeList[0].symbol;
     Validity.Assert(null != symbol);
     rmem.SetSymbolValue(symbol, sv);
 }
开发者ID:lewshion,项目名称:Dynamo,代码行数:8,代码来源:Executive.cs


示例17: DfsEmitArrayIndexHeap

        protected int DfsEmitArrayIndexHeap(Node node, AssociativeGraph.GraphNode graphNode = null, ProtoCore.AST.Node parentNode = null, ProtoCore.CompilerDefinitions.Associative.SubCompilePass subPass = ProtoCore.CompilerDefinitions.Associative.SubCompilePass.kNone)
        {
            int indexCnt = 0;
            Validity.Assert(node is ProtoCore.AST.AssociativeAST.ArrayNode || node is ProtoCore.AST.ImperativeAST.ArrayNode);

            IsAssociativeArrayIndexing = true;

            dynamic arrayNode = node;
            while (arrayNode is ProtoCore.AST.AssociativeAST.ArrayNode || arrayNode is ProtoCore.AST.ImperativeAST.ArrayNode)
            {
                ++indexCnt;
                dynamic array = arrayNode;
                ProtoCore.Type lastType = TypeSystem.BuildPrimitiveTypeObject(PrimitiveType.kTypeVar, 0);
                DfsTraverse(array.Expr, ref lastType, false, graphNode, subPass, parentNode);
                arrayNode = array.Type;
            }

            IsAssociativeArrayIndexing = false;

            return indexCnt;
        }
开发者ID:ankushraizada,项目名称:Dynamo,代码行数:21,代码来源:CodeGen.cs


示例18: LogUnboundVariableWarning

 /// <summary>
 /// Logs the unbound variable warning and sets the unbound symbol
 /// </summary>
 /// <param name="unboundSymbol"></param>
 /// <param name="message"></param>
 /// <param name="fileName"></param>
 /// <param name="line"></param>
 /// <param name="col"></param>
 /// <param name="graphNode"></param>
 public void LogUnboundVariableWarning(
                         SymbolNode unboundSymbol,  
                         string message, 
                         string fileName = null, 
                         int line = -1, 
                         int col = -1, 
                         AssociativeGraph.GraphNode graphNode = null)
 {
     LogWarning(BuildData.WarningID.IdUnboundIdentifier, message, core.CurrentDSFileName, line, col, graphNode, unboundSymbol);
 }
开发者ID:YanmengLi,项目名称:Dynamo,代码行数:19,代码来源:BuildStatus.cs


示例19: GenerateCallsiteIdentifierForGraphNode

        /// <summary>
        /// Generates unique identifier for the callsite associated with the graphnode
        /// </summary>
        /// <param name="graphNode"></param>
        /// <param name="procNode"></param>
        protected void GenerateCallsiteIdentifierForGraphNode(AssociativeGraph.GraphNode graphNode, string procName)
        {
            // This instance count in which the function appears lexically in the current guid
            // This must be stored and incremented
            int functionCallInstance = 0;


            // Cache this function call instance count 
            // This is the count of the number of times in which this callsite appears in the program
            int callInstance = 0;
            if (!core.CallsiteGuidMap.TryGetValue(graphNode.guid, out callInstance))
            {
                // The guid doesnt exist yet
                core.CallsiteGuidMap.Add(graphNode.guid, 0);
            }
            else
            {
                // Increment the current count
                core.CallsiteGuidMap[graphNode.guid]++;
                functionCallInstance = core.CallsiteGuidMap[graphNode.guid];
            }

            // Build the unique ID for a callsite 
            string callsiteIdentifier =
                procName + 
                "_InClassDecl" + globalClassIndex + 
                "_InFunctionScope" + globalProcIndex + 
                "_Instance" + functionCallInstance.ToString() + 
                "_" + graphNode.guid.ToString();

            // TODO Jun: Address this in MAGN-3774
            // The current limitation is retrieving the cached trace data for multiple callsites in a single CBN
            // after modifying the lines of code.
            graphNode.CallsiteIdentifier = callsiteIdentifier;
        }
开发者ID:ankushraizada,项目名称:Dynamo,代码行数:40,代码来源:CodeGen.cs


示例20: BuildRealDependencyForIdentList

        protected void BuildRealDependencyForIdentList(AssociativeGraph.GraphNode graphNode)
        {
            // Push all dependent pointers
            ProtoCore.AST.AssociativeAST.IdentifierListNode identList = BuildIdentifierList(ssaPointerList);

            // Comment Jun: perhaps this can be an assert?
            if (null != identList)
            {
                ProtoCore.Type type = new ProtoCore.Type();
                type.UID = globalClassIndex;
                ProtoCore.AssociativeGraph.UpdateNodeRef nodeRef = new AssociativeGraph.UpdateNodeRef();
                int functionIndex = globalProcIndex;
                DFSGetSymbolList_Simple(identList, ref type, ref functionIndex, nodeRef);

                if (null != graphNode && nodeRef.nodeList.Count > 0)
                {
                    ProtoCore.AssociativeGraph.GraphNode dependentNode = new ProtoCore.AssociativeGraph.GraphNode();
                    dependentNode.updateNodeRefList.Add(nodeRef);
                    graphNode.PushDependent(dependentNode);
                }
            }
        }
开发者ID:khoaho,项目名称:Dynamo,代码行数:22,代码来源:CodeGen.cs



注:本文中的AssociativeGraph类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Ast类代码示例发布时间:2022-05-24
下一篇:
C# Association类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap