예제 #1
0
        /// <summary>
        /// A CodeBlock represents a body of DS code
        /// </summary>
        /// <param name="guid"></param>
        /// <param name="type"></param>
        /// <param name="langId"></param>
        /// <param name="cbID"></param>
        /// <param name="symbols"></param>
        /// <param name="procTable"></param>
        /// <param name="isBreakableBlock"></param>
        /// <param name="core"></param>
        public CodeBlock(Guid guid, CodeBlockType type, ProtoCore.Language langId, int cbID, SymbolTable symbols, ProcedureTable procTable, bool isBreakableBlock = false, ProtoCore.Core core = null)
        {
            this.guid = guid;
            blockType = type;

            parent   = null;
            children = new List <CodeBlock>();

            language    = langId;
            instrStream = new InstructionStream(langId, core);

            symbolTable    = symbols;
            procedureTable = procTable;

            isBreakable = isBreakableBlock;
            codeBlockId = core.GetRuntimeTableSize();
            core.CompleteCodeBlockList.Add(this);

            symbols.RuntimeIndex = codeBlockId;

            if (core.ProcNode != null)
            {
                core.ProcNode.ChildCodeBlocks.Add(codeBlockId);
            }
        }