function evaluateWhileStatement({ node, environment, evaluate, logger, reporting, typescript, statementTraversalStack }) {
    let condition = evaluate.expression(node.expression, environment, statementTraversalStack);
    while (condition) {
        // Prepare a lexical environment for the current iteration
        const iterationEnvironment = cloneLexicalEnvironment(environment);
        // Define a new binding for a break symbol within the environment
        setInLexicalEnvironment({ env: iterationEnvironment, path: BREAK_SYMBOL, value: false, newBinding: true, reporting, node });
        // Define a new binding for a continue symbol within the environment
        setInLexicalEnvironment({ env: iterationEnvironment, path: CONTINUE_SYMBOL, value: false, newBinding: true, reporting, node });
        // Execute the Statement
        evaluate.statement(node.statement, iterationEnvironment);
        // Check if a 'break' statement has been encountered and break if so
        if (pathInLexicalEnvironmentEquals(node, iterationEnvironment, true, BREAK_SYMBOL)) {
            logger.logBreak(node, typescript);
            break;
        }
        else if (pathInLexicalEnvironmentEquals(node, iterationEnvironment, true, RETURN_SYMBOL)) {
            logger.logReturn(node, typescript);
            return;
        }
        condition = evaluate.expression(node.expression, environment, statementTraversalStack);
        // Always re-evaluate the condition before continuing
        if (pathInLexicalEnvironmentEquals(node, iterationEnvironment, true, CONTINUE_SYMBOL)) {
            logger.logContinue(node, typescript);
            // noinspection UnnecessaryContinueJS
            continue;
        }
    }
}
/**
 * Evaluates, or attempts to evaluate, a WhileStatement
 */
Evaluates, or attempts to evaluate, a WhileStatement
Evaluates or attempts to evaluate a WhileStatement
function evaluateWhileStatement({ node, environment, evaluate, logger, reporting, typescript, statementTraversalStack }) {
    let condition = evaluate.expression(node.expression, environment, statementTraversalStack);
    while (condition) {
        const iterationEnvironment = cloneLexicalEnvironment(environment);
        setInLexicalEnvironment({ env: iterationEnvironment, path: BREAK_SYMBOL, value: false, newBinding: true, reporting, node });
        setInLexicalEnvironment({ env: iterationEnvironment, path: CONTINUE_SYMBOL, value: false, newBinding: true, reporting, node });
        evaluate.statement(node.statement, iterationEnvironment);
        if (pathInLexicalEnvironmentEquals(node, iterationEnvironment, true, BREAK_SYMBOL)) {
            logger.logBreak(node, typescript);
            break;
        }
        else if (pathInLexicalEnvironmentEquals(node, iterationEnvironment, true, RETURN_SYMBOL)) {
            logger.logReturn(node, typescript);
            return;
        }
        condition = evaluate.expression(node.expression, environment, statementTraversalStack);
        if (pathInLexicalEnvironmentEquals(node, iterationEnvironment, true, CONTINUE_SYMBOL)) {
            logger.logContinue(node, typescript);
            continue;
        }
    }
}
function evaluateWhileStatement ( { node , environment , evaluate , logger , reporting , typescript , statementTraversalStack } ) { let condition = evaluate . expression ( node . expression , environment , statementTraversalStack ) ; while ( condition ) { const iterationEnvironment = cloneLexicalEnvironment ( environment ) ; setInLexicalEnvironment ( { env : iterationEnvironment , path : BREAK_SYMBOL , value : false , newBinding : true , reporting , node } ) ; setInLexicalEnvironment ( { env : iterationEnvironment , path : CONTINUE_SYMBOL , value : false , newBinding : true , reporting , node } ) ; evaluate . statement ( node . statement , iterationEnvironment ) ; if ( pathInLexicalEnvironmentEquals ( node , iterationEnvironment , true , BREAK_SYMBOL ) ) { logger . logBreak ( node , typescript ) ; break ; } else if ( pathInLexicalEnvironmentEquals ( node , iterationEnvironment , true , RETURN_SYMBOL ) ) { logger . logReturn ( node , typescript ) ; return ; } condition = evaluate . expression ( node . expression , environment , statementTraversalStack ) ; if ( pathInLexicalEnvironmentEquals ( node , iterationEnvironment , true , CONTINUE_SYMBOL ) ) { logger . logContinue ( node , typescript ) ; continue ; } } }
Evaluates, or attempts to evaluate, a WhileStatement
Evaluates or attempts to evaluate a WhileStatement
// Prepare a lexical environment for the current iteration // Define a new binding for a break symbol within the environment // Define a new binding for a continue symbol within the environment // Execute the Statement // Check if a 'break' statement has been encountered and break if so // Always re-evaluate the condition before continuing // noinspection UnnecessaryContinueJS