public object Visit(While stmt) { while (CheckIsTruthy(Evaluate(stmt.cond))) { Token signal = (Token)Execute(stmt.body); if (signal != null && signal.type == BREAK) { break; } } return(null); }
public object Visit(While stmt) { LoopType enclosingLoopType = currentLoopType; currentLoopType = LoopType.WHILE; BeginScope(); Resolve(stmt.cond); Resolve(stmt.body); EndScope(); currentLoopType = enclosingLoopType; return(null); }