当前位置: 首页>>代码示例>>C#>>正文


C# DSASM.SymbolNode类代码示例

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


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

示例1: UpdateModifiedSymbols

            private void UpdateModifiedSymbols(SymbolNode symbol)
            {
                Validity.Assert(null != symbol);
                Validity.Assert(!string.IsNullOrEmpty(symbol.name));
                Validity.Assert(null != mapModifiedSymbols);

                // TODO Jun: Turn this into a multi-key dictionary where the keys are: name, classindex and procindex
                string key = symbol.name;
                if (!mapModifiedSymbols.ContainsKey(key))
                {
                    mapModifiedSymbols.Add(key, symbol);
                }
            }
开发者ID:algobasket,项目名称:Dynamo,代码行数:13,代码来源:RuntimeMemory.cs

示例2: GetStackIndex

            public int GetStackIndex(SymbolNode symbolNode)
            {
                int offset = symbolNode.index;

                int depth = 0;
                int blockOffset = 0;
                // TODO Jun: the property 'localFunctionIndex' must be deprecated and just use 'functionIndex'.
                // The GC currenlty has an issue of needing to reset 'functionIndex' at codegen
                bool isGlobal = Constants.kInvalidIndex == symbolNode.absoluteClassScope && Constants.kGlobalScope == symbolNode.absoluteFunctionIndex;
                if (!isGlobal)
                {
                    depth = (int)GetAtRelative(ProtoCore.DSASM.StackFrame.kFrameIndexStackFrameDepth).opdata;
                    blockOffset = depth * StackFrame.kStackFrameSize;
                }
                offset -= blockOffset;
                return offset;
            }
开发者ID:algobasket,项目名称:Dynamo,代码行数:17,代码来源:RuntimeMemory.cs

示例3: EmitReturnNull

        protected override void EmitReturnNull()
        {
            int startpc = pc;

            EmitPushNull();
            EmitReturnToRegister();

            // Build and append a graphnode for this return statememt
            ProtoCore.DSASM.SymbolNode returnNode = new ProtoCore.DSASM.SymbolNode();
            returnNode.name = ProtoCore.DSDefinitions.Keyword.Return;

            ProtoCore.AssociativeGraph.GraphNode retNode = new ProtoCore.AssociativeGraph.GraphNode();
            //retNode.symbol = returnNode;
            retNode.PushSymbolReference(returnNode);
            retNode.procIndex = globalProcIndex;
            retNode.classIndex = globalClassIndex;
            retNode.updateBlock.startpc = startpc;
            retNode.updateBlock.endpc = pc - 1;
            retNode.isReturn = true;

            PushGraphNode(retNode);
        }
开发者ID:AutodeskFractal,项目名称:Dynamo,代码行数:22,代码来源:CodeGen.cs

示例4: AllocateArg

        private int AllocateArg(
            string ident,
            int funcIndex,
            ProtoCore.Type datatype,
            int size = 1,
            int datasize = ProtoCore.DSASM.Constants.kPrimitiveSize,
            AssociativeNode nodeArray = null,
            ProtoCore.DSASM.MemoryRegion region = ProtoCore.DSASM.MemoryRegion.kMemStack)
        {
            ProtoCore.DSASM.SymbolNode node = new ProtoCore.DSASM.SymbolNode(
                ident,
                ProtoCore.DSASM.Constants.kInvalidIndex,
                ProtoCore.DSASM.Constants.kInvalidIndex,
                funcIndex,
                datatype,
                datatype,
                size,
                datasize,
                true,
                codeBlock.symbolTable.RuntimeIndex,
                region,
                false,
                null,
                globalClassIndex);

            node.name = ident;
            node.isTemp = ident.StartsWith("%");
            node.size = datasize;
            node.functionIndex = funcIndex;
            node.absoluteFunctionIndex = funcIndex;
            node.datatype = datatype;
            node.isArgument = true;
            node.memregion = ProtoCore.DSASM.MemoryRegion.kMemStack;
            node.classScope = globalClassIndex;
            node.absoluteClassScope = globalClassIndex;
            node.codeBlockId = codeBlock.codeBlockId;
            if (this.isEmittingImportNode)
                node.ExternLib = core.CurrentDSFileName;

            // Comment Jun: The local count will be adjusted and all dependent symbol offsets after the function body has been traversed
            int locOffset = 0;

            // This will be offseted by the local count after locals have been allocated
            node.index = -1 - ProtoCore.DSASM.StackFrame.kStackFrameSize - (locOffset + argOffset);
            ++argOffset;

            int symbolindex = ProtoCore.DSASM.Constants.kInvalidIndex;
            if (ProtoCore.DSASM.Constants.kInvalidIndex != globalClassIndex)
            {
                symbolindex = core.ClassTable.ClassNodes[globalClassIndex].Symbols.Append(node);
            }
            else
            {
                symbolindex = codeBlock.symbolTable.Append(node);
            }
            return symbolindex;
        }
开发者ID:AutodeskFractal,项目名称:Dynamo,代码行数:57,代码来源:CodeGen.cs

示例5: Allocate

        private ProtoCore.DSASM.SymbolNode Allocate(
            int classIndex,  // In which class table this variable will be allocated to ?
            int classScope,  // Variable's class scope. For example, it is a variable in base class
            int funcIndex,   // In which function this variable is defined? 
            string ident, 
            ProtoCore.Type datatype, 
            int datasize = ProtoCore.DSASM.Constants.kPrimitiveSize, 
            bool isStatic = false,
            ProtoCore.CompilerDefinitions.AccessModifier access = ProtoCore.CompilerDefinitions.AccessModifier.kPublic,
            ProtoCore.DSASM.MemoryRegion region = ProtoCore.DSASM.MemoryRegion.kMemStack,
            int line = -1,
            int col = -1,
            GraphNode graphNode = null
            )
        {
            bool allocateForBaseVar = classScope < classIndex;
            bool isProperty = classIndex != Constants.kInvalidIndex && funcIndex == Constants.kInvalidIndex;
            if (!allocateForBaseVar && !isProperty && core.ClassTable.IndexOf(ident) != ProtoCore.DSASM.Constants.kInvalidIndex)
                buildStatus.LogSemanticError(String.Format(Resources.ClassNameAsVariableError, ident), null, line, col, graphNode);

            ProtoCore.DSASM.SymbolNode symbolnode = new ProtoCore.DSASM.SymbolNode();
            symbolnode.name = ident;
            symbolnode.isTemp = ident.StartsWith("%");
            symbolnode.size = datasize;
            symbolnode.functionIndex = funcIndex;
            symbolnode.absoluteFunctionIndex = funcIndex;
            symbolnode.datatype = datatype;
            symbolnode.staticType = TypeSystem.BuildPrimitiveTypeObject(PrimitiveType.kTypeVar, Constants.kArbitraryRank);
            symbolnode.isArgument = false;
            symbolnode.memregion = region;
            symbolnode.classScope = classScope;
            symbolnode.absoluteClassScope = classScope;
            symbolnode.runtimeTableIndex = codeBlock.symbolTable.RuntimeIndex;
            symbolnode.isStatic = isStatic;
            symbolnode.access = access;
            symbolnode.codeBlockId = codeBlock.codeBlockId;
            if (this.isEmittingImportNode)
                symbolnode.ExternLib = core.CurrentDSFileName;

            int symbolindex = ProtoCore.DSASM.Constants.kInvalidIndex;

            if (IsInLanguageBlockDefinedInFunction())
            {
                symbolnode.classScope = Constants.kGlobalScope;
                symbolnode.functionIndex = Constants.kGlobalScope;
            }

            if (ProtoCore.DSASM.Constants.kInvalidIndex != classIndex && !IsInLanguageBlockDefinedInFunction())
            {
                // NOTE: the following comment and code is OBSOLETE - member
                // variable is not supported now
                // 
                // Yu Ke: it is possible that class table contains same-named 
                // symbols if a class inherits some member variables from base 
                // class, so we need to check name + class index + function 
                // index.
                // 
                //if (core.classTable.list[classIndex].symbols.IndexOf(ident, classIndex, funcIndex) != (int)ProtoCore.DSASM.Constants.kInvalidIndex)
                //    return null;

                symbolindex = core.ClassTable.ClassNodes[classIndex].Symbols.IndexOf(ident);
                if (symbolindex != ProtoCore.DSASM.Constants.kInvalidIndex)
                {
                    ProtoCore.DSASM.SymbolNode node = core.ClassTable.ClassNodes[classIndex].Symbols.symbolList[symbolindex];
                    if (node.functionIndex == ProtoCore.DSASM.Constants.kGlobalScope &&
                        funcIndex == ProtoCore.DSASM.Constants.kGlobalScope)
                        return null;
                }

                symbolindex = core.ClassTable.ClassNodes[classIndex].Symbols.Append(symbolnode);
                if (symbolindex == ProtoCore.DSASM.Constants.kInvalidIndex)
                {
                    return null;
                }

                if (isStatic)
                {
                    Validity.Assert(funcIndex == ProtoCore.DSASM.Constants.kGlobalScope);
                    ProtoCore.DSASM.SymbolNode staticSymbolnode = new ProtoCore.DSASM.SymbolNode();
                    staticSymbolnode.name = ident;
                    staticSymbolnode.isTemp = ident.StartsWith("%");
                    staticSymbolnode.size = datasize;
                    staticSymbolnode.functionIndex = funcIndex;
                    staticSymbolnode.datatype = datatype;
                    staticSymbolnode.staticType = TypeSystem.BuildPrimitiveTypeObject(PrimitiveType.kTypeVar, Constants.kArbitraryRank);
                    staticSymbolnode.isArgument = false;
                    staticSymbolnode.memregion = region;
                    staticSymbolnode.classScope = classScope;
                    staticSymbolnode.runtimeTableIndex = codeBlock.symbolTable.RuntimeIndex;
                    staticSymbolnode.isStatic = isStatic;
                    staticSymbolnode.access = access;
                    staticSymbolnode.codeBlockId = codeBlock.codeBlockId;
                    if (this.isEmittingImportNode)
                        staticSymbolnode.ExternLib = core.CurrentDSFileName;

                    // If inherits a static property from base class, that propery
                    // symbol should have been added to code block's symbol table,
                    // so we just update symbolTableIndex 
                    int staticSymbolindex = codeBlock.symbolTable.IndexOf(ident, classScope);
                    if (staticSymbolindex == ProtoCore.DSASM.Constants.kInvalidIndex)
//.........这里部分代码省略.........
开发者ID:AutodeskFractal,项目名称:Dynamo,代码行数:101,代码来源:CodeGen.cs

示例6: PushSymbolAsDependent

        /// <summary>
        /// Pushes the symbol as a dependent to graphNode if codegeneration semantic conditions are met
        /// </summary>
        /// <param name="symbol"></param>
        /// <param name="graphNode"></param>
        private ProtoCore.AssociativeGraph.GraphNode PushSymbolAsDependent(SymbolNode symbol, ProtoCore.AssociativeGraph.GraphNode graphNode)
        {
            // Check for symbols that need to be pushed as dependents
            // Temporary properties and default args are autogenerated and are not part of the assocaitve behavior
            // For temp properties, refer to: EmitGettersForRHSIdentList
            // For default arg temp vars, refer to usage of: Constants.kTempDefaultArg
            if (CoreUtils.IsPropertyTemp(symbol.name) || CoreUtils.IsDefaultArgTemp(symbol.name))
            {
                return null;
            }

            ProtoCore.AssociativeGraph.GraphNode dependentNode = new ProtoCore.AssociativeGraph.GraphNode();
            dependentNode.PushSymbolReference(symbol, UpdateNodeType.kSymbol);
            graphNode.PushDependent(dependentNode);
            return dependentNode;
        }
开发者ID:AutodeskFractal,项目名称:Dynamo,代码行数:21,代码来源:CodeGen.cs

示例7: Allocate

        private ProtoCore.DSASM.SymbolNode Allocate( 
            string ident,
            int funcIndex,
            ProtoCore.Type datatype,
            int size = 1,
            int datasize = ProtoCore.DSASM.Constants.kPrimitiveSize,
            ImperativeNode nodeArray = null,
            ProtoCore.DSASM.MemoryRegion region = ProtoCore.DSASM.MemoryRegion.kMemStack)
        {
            if (compileStateTracker.ClassTable.IndexOf(ident) != ProtoCore.DSASM.Constants.kInvalidIndex)
                buildStatus.LogSemanticError(ident + " is a class name, can't be used as a variable.");

            ProtoCore.DSASM.SymbolNode symbolnode = new ProtoCore.DSASM.SymbolNode(
                ident,
                ProtoCore.DSASM.Constants.kInvalidIndex,
                ProtoCore.DSASM.Constants.kInvalidIndex,
                funcIndex,
                datatype,
                compileStateTracker.TypeSystem.BuildTypeObject((int)PrimitiveType.kTypeVar, false),
                size,
                datasize,
                false,
                codeBlock.symbolTable.runtimeIndex,
                region,
                false,
                null,
                globalClassIndex,
                ProtoCore.DSASM.AccessSpecifier.kPublic,
                false,
                codeBlock.codeBlockId);

            if (this.isEmittingImportNode)
                symbolnode.ExternLib = compileStateTracker.CurrentDSFileName;

            Debug.Assert(ProtoCore.DSASM.Constants.kInvalidIndex == symbolnode.symbolTableIndex);

            if (null == nodeArray)
            {
                AllocateVar(symbolnode);
            }
            else
            {
                AllocateArray(symbolnode, nodeArray);
            }

            // This is to handle that a variable is defined in a language
            // block which defined in a function, so the variable's scope
            // is that language block instead of function
            if (IsInLanguageBlockDefinedInFunction())
            {
                symbolnode.classScope = Constants.kGlobalScope;
                symbolnode.functionIndex = Constants.kGlobalScope;
            }

            int symbolindex = ProtoCore.DSASM.Constants.kInvalidIndex;
            if (ProtoCore.DSASM.Constants.kInvalidIndex != globalClassIndex && !IsInLanguageBlockDefinedInFunction())
            {

                symbolindex = compileStateTracker.ClassTable.ClassNodes[globalClassIndex].symbols.Append(symbolnode);
            }
            else
            {
                // Do not import global symbols from external libraries
                //if (this.isEmittingImportNode && core.IsParsingPreloadedAssembly)
                //{
                //    bool importGlobalSymbolFromLib = !string.IsNullOrEmpty(symbolnode.ExternLib) &&
                //        symbolnode.functionIndex == -1 && symbolnode.classScope == -1;

                //    if (importGlobalSymbolFromLib)
                //    {
                //        return symbolnode;
                //    }
                //}

                symbolindex = codeBlock.symbolTable.Append(symbolnode);
            }

            // TODO Jun: Set the symbol table index of the first local variable of 'funcIndex'
            // This will no longer required once the functiontable is refactored to include a symbol table
            // if the current codeblock is a while block, the procedureTable will be null
            if (null != localProcedure && null == localProcedure.firstLocal && !IsInLanguageBlockDefinedInFunction())
            {
                localProcedure.firstLocal = symbolnode.index;
            }

            if (ProtoCore.DSASM.MemoryRegion.kMemHeap == symbolnode.memregion)
            {
                EmitInstrConsole(ProtoCore.DSASM.kw.alloca, symbolindex.ToString());
                EmitAlloc(symbolindex);
            }

            symbolnode.symbolTableIndex = symbolindex;
            return symbolnode;
        }
开发者ID:seasailor,项目名称:designscript,代码行数:94,代码来源:CodeGen.cs

示例8: TraverseDotFunctionCall

        public ProtoCore.DSASM.ProcedureNode TraverseDotFunctionCall(ProtoCore.AST.Node node, ProtoCore.AST.Node parentNode, int lefttype, int depth, ref ProtoCore.Type inferedType, 
            ProtoCore.AssociativeGraph.GraphNode graphNode = null, ProtoCore.DSASM.AssociativeSubCompilePass subPass = ProtoCore.DSASM.AssociativeSubCompilePass.kNone,
            ProtoCore.AST.AssociativeAST.BinaryExpressionNode bnode = null)
        {
            FunctionCallNode funcCall = null;
            ProtoCore.DSASM.ProcedureNode procCallNode = null;
            ProtoCore.DSASM.ProcedureNode procDotCallNode = null;
            string procName = null;
            List<ProtoCore.Type> arglist = new List<ProtoCore.Type>();
            ProtoCore.Type dotCallType = new ProtoCore.Type();
            dotCallType.UID = (int)PrimitiveType.kTypeVar;
            dotCallType.IsIndexable = false;

            bool isConstructor = false;
            bool isStaticCall = false;
            bool isStaticCallAllowed = false;
            bool isUnresolvedDot = false;
            bool isUnresolvedMethod = false;

            int classIndex = ProtoCore.DSASM.Constants.kInvalidIndex;
            string className = string.Empty;

            ProtoCore.AST.AssociativeAST.FunctionDotCallNode dotCall = node as ProtoCore.AST.AssociativeAST.FunctionDotCallNode;
            funcCall = dotCall.DotCall;
            procName = dotCall.FunctionCall.Function.Name;

            List<AssociativeNode> replicationGuide = (dotCall.FunctionCall.Function as IdentifierNode).ReplicationGuides;

            var dotCallFirstArgument = dotCall.DotCall.FormalArguments[0];
            if (dotCallFirstArgument is FunctionDotCallNode)
            {
                isUnresolvedDot = true;
            }
            else if (dotCallFirstArgument is IdentifierNode || dotCallFirstArgument is ThisPointerNode)
            {
                // Check if the lhs identifer is a class name
                string lhsName = "";
                int ci = Constants.kInvalidIndex;

                if (dotCallFirstArgument is IdentifierNode)
                {
                    lhsName = (dotCallFirstArgument as IdentifierNode).Name;
                    ci = compileStateTracker.ClassTable.IndexOf(lhsName);
                    classIndex = ci;
                    className = lhsName;

                    // As a class name can be used as property name, we need to
                    // check if this identifier is a property or a class name.
                    //
                    if (ci != Constants.kInvalidIndex && globalClassIndex != Constants.kInvalidIndex)
                    {
                        ProtoCore.DSASM.SymbolNode symbolnode;
                        bool isAccessbile = false;
                        bool hasAllocated = VerifyAllocation(lhsName, globalClassIndex, globalProcIndex, out symbolnode, out isAccessbile);

                        // Well, found a property whose name is class name. Now
                        // we need to check if the RHS function call is
                        // constructor or not.
                        if (hasAllocated && isAccessbile && symbolnode.functionIndex == ProtoCore.DSASM.Constants.kInvalidIndex)
                        {
                            var procnode = GetProcedureFromInstance(ci, dotCall.FunctionCall);
                            if (procnode != null && !procnode.isConstructor)
                            {
                                ci = Constants.kInvalidIndex;
                                lhsName = "";
                            }
                        }
                    }
                }

                if (ci != ProtoCore.DSASM.Constants.kInvalidIndex)
                {
                    // It is a class name
                    dotCall.DotCall.FormalArguments[0] = new IntNode { value = ci.ToString() };
                    dotCallFirstArgument = dotCall.DotCall.FormalArguments[0];

                    inferedType.UID = dotCallType.UID = ci;

                    string rhsName = dotCall.FunctionCall.Function.Name;
                    procCallNode = GetProcedureFromInstance(ci, dotCall.FunctionCall, graphNode);
                    if (null != procCallNode)
                    {
                        isConstructor = procCallNode.isConstructor;

                        // It's a static call if its not a constructor
                        isStaticCall = !procCallNode.isConstructor;

                        // If this is a static call and the first method found was not static
                        // Look further
                        if (isStaticCall && !procCallNode.isStatic)
                        {
                            ProtoCore.DSASM.ProcedureNode staticProcCallNode = compileStateTracker.ClassTable.ClassNodes[ci].GetFirstStaticMemberFunction(procName);
                            if (null != staticProcCallNode)
                            {
                                procCallNode = staticProcCallNode;
                            }
                        }

                        isStaticCallAllowed = procCallNode.isStatic && isStaticCall;
                    }
//.........这里部分代码省略.........
开发者ID:samuto,项目名称:designscript,代码行数:101,代码来源:CodeGen.cs

示例9: 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

示例10: EmitPushForSymbolW

        protected void EmitPushForSymbolW(SymbolNode symbol, int blockId, int line = ProtoCore.DSASM.Constants.kInvalidIndex, int col = ProtoCore.DSASM.Constants.kInvalidIndex)
        {
            SetEntry();
            Instruction instr = new Instruction();
            instr.opCode = ProtoCore.DSASM.OpCode.PUSHW;
            instr.op1 = BuildOperand(symbol);
            instr.op2 = StackValue.BuildClassIndex(symbol.classScope);
            instr.op3 = StackValue.BuildBlockIndex(blockId);

            ++pc;
            //instr.debug = GetDebugObject(line, col, pc);
            AppendInstruction(instr);
        }
开发者ID:ankushraizada,项目名称:Dynamo,代码行数:13,代码来源:CodeGen.cs

示例11: EmitPushForSymbol

        protected void EmitPushForSymbol(SymbolNode symbol, int blockId, ProtoCore.AST.Node identNode)
        {
            SetEntry();
            Instruction instr = new Instruction();
            instr.opCode = ProtoCore.DSASM.OpCode.PUSH;
            instr.op1 = BuildOperand(symbol);
            instr.op2 = StackValue.BuildClassIndex(symbol.classScope);
            instr.op3 = StackValue.BuildBlockIndex(blockId);

            ++pc;

            DebugProperties.BreakpointOptions options = core.DebuggerProperties.breakOptions;
            if (options.HasFlag(DebugProperties.BreakpointOptions.EmitIdentifierBreakpoint))
            {
                instr.debug = GetDebugObject(identNode.line, identNode.col,
                    identNode.endLine, identNode.endCol, pc);
            }

            AppendInstruction(instr, identNode.line, identNode.col);
        }
开发者ID:ankushraizada,项目名称:Dynamo,代码行数:20,代码来源:CodeGen.cs

示例12: EmitPopForSymbolW

        protected void EmitPopForSymbolW(SymbolNode symbol,
            int blockId,
            int line = ProtoCore.DSASM.Constants.kInvalidIndex,
            int col = ProtoCore.DSASM.Constants.kInvalidIndex,
            int eline = ProtoCore.DSASM.Constants.kInvalidIndex,
            int ecol = ProtoCore.DSASM.Constants.kInvalidIndex)
        {
            Validity.Assert(symbol != null);
            if (symbol == null)
            {
                return;
            }

            Instruction instr = new Instruction();
            instr.opCode = ProtoCore.DSASM.OpCode.POPW;
            instr.op1 = BuildOperand(symbol);
            instr.op2 = StackValue.BuildClassIndex(symbol.classScope);
            instr.op3 = StackValue.BuildBlockIndex(blockId);

            ++pc;

            AppendInstruction(instr);
        }
开发者ID:ankushraizada,项目名称:Dynamo,代码行数:23,代码来源:CodeGen.cs

示例13: EmitPopForSymbol

        protected void EmitPopForSymbol(SymbolNode symbol,
            int blockId,
            int line = ProtoCore.DSASM.Constants.kInvalidIndex, 
            int col = ProtoCore.DSASM.Constants.kInvalidIndex,
            int eline = ProtoCore.DSASM.Constants.kInvalidIndex, 
            int ecol = ProtoCore.DSASM.Constants.kInvalidIndex)
        {
            Validity.Assert(symbol != null);
            if (symbol == null)
            {
                return;
            }

            Instruction instr = new Instruction();
            instr.opCode = ProtoCore.DSASM.OpCode.POP;
            instr.op1 = BuildOperand(symbol);
            instr.op2 = StackValue.BuildClassIndex(symbol.classScope);
            instr.op3 = StackValue.BuildBlockIndex(blockId);

            ++pc;

            bool outputBreakpoint = false;
            DebugProperties.BreakpointOptions options = core.DebuggerProperties.breakOptions;
            if (options.HasFlag(DebugProperties.BreakpointOptions.EmitPopForTempBreakpoint))
                outputBreakpoint = true;

            // Do not emit breakpoints for null or var type declarations
            if (!core.DebuggerProperties.breakOptions.HasFlag(DebugProperties.BreakpointOptions.SuppressNullVarDeclarationBreakpoint))
            {
                // Don't need no pop for temp (unless caller demands it).
                if (outputBreakpoint || !symbol.name.StartsWith("%"))
                    instr.debug = GetDebugObject(line, col, eline, ecol, pc);
            }
            AppendInstruction(instr, line, col);
        }
开发者ID:ankushraizada,项目名称:Dynamo,代码行数:35,代码来源:CodeGen.cs

示例14: AllocateArg

        private int AllocateArg(string ident, int funcIndex, ProtoCore.Type datatype)
        {
            ProtoCore.DSASM.SymbolNode symbolnode = new ProtoCore.DSASM.SymbolNode(
                ident,
                ProtoCore.DSASM.Constants.kInvalidIndex,
                funcIndex,
                datatype,
                datatype,
                true,
                codeBlock.symbolTable.RuntimeIndex,
                MemoryRegion.MemStack);
            symbolnode.codeBlockId = codeBlock.codeBlockId;
            if (this.isEmittingImportNode)
                symbolnode.ExternLib = core.CurrentDSFileName;

            int symbolindex = ProtoCore.DSASM.Constants.kInvalidIndex;
            if (ProtoCore.DSASM.Constants.kInvalidIndex != codeBlock.symbolTable.IndexOf(symbolnode))
            {
                buildStatus.LogSemanticError(String.Format(Resources.IdentifierRedefinition,ident));
            }
            else
            {
                int locOffset = localProcedure.LocalCount;
                locOffset = localProcedure.LocalCount;
                symbolnode.index = -1 - ProtoCore.DSASM.StackFrame.StackFrameSize - (locOffset + argOffset);
                ++argOffset;

                symbolindex = codeBlock.symbolTable.Append(symbolnode);
            }
            return symbolindex;
        }
开发者ID:limrzx,项目名称:Dynamo,代码行数:31,代码来源:CodeGen.cs

示例15: CyclicDependencyTest

        private bool CyclicDependencyTest(ProtoCore.AssociativeGraph.GraphNode node, ref SymbolNode cyclicSymbol1, ref SymbolNode cyclicSymbol2)
        {
            if (null == node || node.updateNodeRefList.Count == 0)
            {
                return true;
            }

            var indexMap = new Dictionary<GraphNode, int>();
            var lowlinkMap = new Dictionary<GraphNode, int>();
            var S = new Stack<GraphNode>();
            int index = 0;

            for (int n = 0; n < codeBlock.instrStream.dependencyGraph.GraphList.Count; ++n)
            {
                ProtoCore.AssociativeGraph.GraphNode subNode = codeBlock.instrStream.dependencyGraph.GraphList[n];
                indexMap[subNode] = Constants.kInvalidIndex;
            }

            var dependencyList = StrongConnectComponent(node, ref index, lowlinkMap, indexMap, S);
            if (dependencyList == null)
            {
                return true;
            }
            else
            {
                GraphNode firstNode = dependencyList[0];
                GraphNode lastNode = node;

                string symbol1 = firstNode.updateNodeRefList[0].nodeList[0].symbol.name;
                string symbol2 = lastNode.updateNodeRefList[0].nodeList[0].symbol.name;
                string message = String.Format(ProtoCore.BuildData.WarningMessage.kInvalidStaticCyclicDependency, symbol1, symbol2);

                compileStateTracker.BuildStatus.LogWarning(ProtoCore.BuildData.WarningID.kInvalidStaticCyclicDependency, message, compileStateTracker.CurrentDSFileName);
                firstNode.isCyclic = true;

                cyclicSymbol1 = firstNode.updateNodeRefList[0].nodeList[0].symbol;
                cyclicSymbol2 = lastNode.updateNodeRefList[0].nodeList[0].symbol;

                firstNode.cyclePoint = lastNode;

                return false;
            }
        }
开发者ID:samuto,项目名称:designscript,代码行数:43,代码来源:CodeGen.cs


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