public override void EnterCondGroup(HS_Gen1Parser.CondGroupContext context) { if (_debug) { _logger.CondGroup(context, CompilerContextAction.Enter); } // Link to the previous expression or cond group. LinkDatum(); // push the types of the group members. _expectedTypes.PushTypes(_condReturnType, context.expression().Count() - 1); _expectedTypes.PushType("boolean"); var parentCond = context.Parent as HS_Gen1Parser.CondContext; var ifInfo = _opcodes.GetFunctionInfo("if")[0]; var compilerIf = new ScriptExpression { Index = _currentIndex, Opcode = ifInfo.Opcode, ReturnType = _opcodes.GetTypeInfo(_condReturnType).Opcode, Type = ScriptExpressionType.Group, Next = DatumIndex.Null, StringOffset = context.GetCorrectTextPosition(_missingCarriageReturnPositions), Value = new LongExpressionValue(_currentIndex.Next), LineNumber = 0 }; // Keep the if call closed. We will open the initial one later on. AddExpressionIncrement(compilerIf); var compilerIfName = new ScriptExpression { Index = _currentIndex, Opcode = ifInfo.Opcode, ReturnType = _opcodes.GetTypeInfo("function_name").Opcode, Type = ScriptExpressionType.Expression, Next = DatumIndex.Null, StringOffset = _strings.Cache(ifInfo.Name), Value = new LongExpressionValue(0), LineNumber = GetLineNumber(context) }; OpenDatumAddExpressionIncrement(compilerIfName); // Push the index to the condition so that we can modify it later on. _condIndeces.Push(_expressions.Count); }