Пример #1
0
        private void InterpretDoWhileExpression(DoWhileExpression expression)
        {
            do
            {
                EnterChildScope();
                Interpret(expression.Body, false);

                if (LeaveChildScope(true) || _isBreaking)
                {
                    _isBreaking = false;
                    break;
                }
            } while ((bool)((AphidObject)(InterpretExpression(expression.Condition))).Value);
        }
Пример #2
0
        private CodeStatementCollection GenerateImperativeStatement(DoWhileExpression node)
        {
            var body = GenerateImperativeStatements(node.Body);

            body.Add(new CodeConditionStatement(
                CodeHelper.BinOpExp(
                    GenerateImperativeExpression(node.Condition, isCondition: true),
                    CodeBinaryOperatorType.ValueEquality,
                    CodeHelper.False()),
                new CodeSnippetStatement("break;")));

            return new CodeStatementCollection(new[]
            {
                CodeHelper.While(CodeHelper.True(), body.OfType<CodeStatement>().ToArray())
            });
        }