예제 #1
0
        public object VisitStatementIfStatement(StatementIfStatement statementIfStatement, object o)
        {
            statementIfStatement.Condition.Visit(this);

            var savedAddr = nextAdr;

            Emit(Machine.JUMPIFop, 0, Machine.CBr, -1);

            statementIfStatement.Statements.Visit(this, o);

            Patch(savedAddr, nextAdr);

            return(null);
        }
예제 #2
0
파일: Checker.cs 프로젝트: Laegas/CMC
        public object VisitStatementIfStatement(StatementIfStatement statementIfStatement, object o)
        {
            idTable.EnterNestedScopeLevel();

            var variableType = (VariableType.ValueTypeEnum)statementIfStatement.Condition.Visit(this);

            if (variableType != VariableType.ValueTypeEnum.BOOLY)
            {
                throw new Exception("If statement condition must evaluate to booly value");
            }

            statementIfStatement.Statements.Visit(this);

            idTable.ExitNestedScopeLevel();

            return(null);
        }