コード例 #1
0
        private void nestIfs(JSProgram program, string prevScopeName, Queue <bool> enableIf, string from, string to)
        {
            string left             = program.AddConstantBlock(enableIf.Dequeue() ? 3 : 2);
            string right            = program.AddConstantBlock(3);
            string conditionalBlock = program.AddBoolOPBlock(BoolOPTypes.EQ, left, right);

            string scopeName = program.GetUniqueName();

            program.AddScope(scopeName);
            program.SetScope(scopeName);
            string guardedBlock = AddFluidBlock(program, from, to);

            if (enableIf.Count > 0)
            {
                nestIfs(program, scopeName, enableIf, to, to);
            }
            program.SetScope(prevScopeName);

            program.AddIfSegment(conditionalBlock, guardedBlock);
            AddFluidBlock(program, to, to);
        }