Blamite.Blam.Scripting.Compiler.ScriptCompiler.ExitCondGroup C# (CSharp) Метод

ExitCondGroup() публичный Метод

public ExitCondGroup ( HS_Gen1Parser.CondGroupContext context ) : void
context HS_Gen1Parser.CondGroupContext
Результат void
        public override void ExitCondGroup(HS_Gen1Parser.CondGroupContext context)
        {
            if (_debug)
            {
                _logger.CondGroup(context, CompilerContextAction.Exit);
            }

            // Close the final value expression.
            CloseDatum();

            int index = _condIndeces.Pop();
            var beginInfo = _opcodes.GetFunctionInfo("begin")[0];

            // Grab the index to value expression of the cond group. Modify the condition expression afterwards.
            // Next has to point to the begin call, which is added by the compiler.
            var valueExpressionDatum = _expressions[index].Next;
            _expressions[index].Next = _currentIndex;

            var compilerBeginCall = new ScriptExpression
            {
                Index = _currentIndex,
                Opcode = beginInfo.Opcode,
                ReturnType = _opcodes.GetTypeInfo(_condReturnType).Opcode,
                Type = ScriptExpressionType.Group,
                Next = DatumIndex.Null,
                StringOffset = context.GetCorrectTextPosition(_missingCarriageReturnPositions),
                Value = new LongExpressionValue(_currentIndex.Next),
                LineNumber = 0
            };
            OpenDatumAddExpressionIncrement(compilerBeginCall);

            var compilerBeginName = new ScriptExpression
            {
                Index = _currentIndex,
                Opcode = beginInfo.Opcode,
                ReturnType = _opcodes.GetTypeInfo("function_name").Opcode,
                Type = ScriptExpressionType.Expression,
                Next = valueExpressionDatum,
                StringOffset = _strings.Cache(beginInfo.Name),
                Value = new LongExpressionValue(0),
                LineNumber = 0
            };
            AddExpressionIncrement(compilerBeginName);
        }