Beispiel #1
0
 public override bool VisitWhileExpression(WhileExpressionAST whileExpression)
 {
     whileExpression.ExpressionConditional.Accept(this);
     whileExpression.ReturnType = TigerType.GetType <ErrorType>();
     if (whileExpression.ExpressionConditional.ReturnType != TigerType.GetType <IntType>())
     {
         _errorListener.Add(new AnalysisError(AnalysisError.LoadMessage("IfCond"), whileExpression.Line, whileExpression.Columns));
     }
     else
     {
         //guardo, si hay, el ciclo previo
         LoopAST prevLoop = _scope.ContainerLoop;
         _scope.ContainerLoop = whileExpression;
         if (whileExpression.BodyExpressions.Accept(this))
         {
             //repongo el ciclo q habia
             _scope.ContainerLoop       = prevLoop;
             whileExpression.ReturnType = TigerType.GetType <NoType>();
             return(true);
         }
     }
     return(false);
 }
Beispiel #2
0
 public Scope(Scope scope, LoopAST loopAST)
     : this(scope)
 {
     ContainerLoop = loopAST;
 }