public override object VisitWhileStatement([NotNull] TinyScriptParser.WhileStatementContext context) { while (true) { var condition = (bool)VisitExpression(context.expression()); if (!(condition)) { break; } VisitBlockStatement(context.blockStatement()); } return(null); }
public override object VisitWhileStatement([NotNull] TinyScriptParser.WhileStatementContext context) { var l1 = _builder.DefineLabel(); _builder.MarkLabel(l1); AssertIsBool(context, VisitExpression(context.expression())); var l2 = _builder.DefineLabel(); _builder.BrFalse(l2); VisitBlockStatement(context.blockStatement()); _builder.Br(l1); _builder.MarkLabel(l2); _builder.Nop(); return(null); }