function evaluatePrefixUnaryExpression({ node, environment, evaluate, reporting, typescript, statementTraversalStack }) {
    var _a, _b;
    const operandValue = evaluate.expression(node.operand, environment, statementTraversalStack);
    switch (node.operator) {
        case typescript.SyntaxKind.PlusToken: {
            return +operandValue;
        }
        case typescript.SyntaxKind.MinusToken: {
            return -operandValue;
        }
        case typescript.SyntaxKind.TildeToken: {
            return ~operandValue;
        }
        case typescript.SyntaxKind.ExclamationToken: {
            // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
            return !operandValue;
        }
        case typescript.SyntaxKind.PlusPlusToken: {
            // If the Operand isn't an identifier, this will be a SyntaxError
            if (!typescript.isIdentifier(node.operand) && !((_a = typescript.isPrivateIdentifier) === null || _a === void 0 ? void 0 : _a.call(typescript, node.operand))) {
                throw new UnexpectedNodeError({ node: node.operand, typescript });
            }
            // Find the value associated with the identifier within the environment.
            const dict = getRelevantDictFromLexicalEnvironment(environment, node.operand.text);
            const value = ++dict[node.operand.text];
            // Inform reporting hooks if any is given
            if (reporting.reportBindings != null) {
                reporting.reportBindings({ path: node.operand.text, value, node });
            }
            return value;
        }
        case typescript.SyntaxKind.MinusMinusToken: {
            // If the Operand isn't an identifier, this will be a SyntaxError
            if (!typescript.isIdentifier(node.operand) && !((_b = typescript.isPrivateIdentifier) === null || _b === void 0 ? void 0 : _b.call(typescript, node.operand))) {
                throw new UnexpectedNodeError({ node: node.operand, typescript });
            }
            // Find the value associated with the identifier within the environment.
            const dict = getRelevantDictFromLexicalEnvironment(environment, node.operand.text);
            const value = --dict[node.operand.text];
            // Inform reporting hooks if any is given
            if (reporting.reportBindings != null) {
                reporting.reportBindings({ path: node.operand.text, value, node });
            }
            return value;
        }
    }
}
/**
 * Evaluates, or attempts to evaluate, a PrefixUnaryExpression
 */
Evaluates, or attempts to evaluate, a PrefixUnaryExpression
Evaluates or attempts to evaluate a PrefixUnaryExpression
function evaluatePrefixUnaryExpression({ node, environment, evaluate, reporting, typescript, statementTraversalStack }) {
    var _a, _b;
    const operandValue = evaluate.expression(node.operand, environment, statementTraversalStack);
    switch (node.operator) {
        case typescript.SyntaxKind.PlusToken: {
            return +operandValue;
        }
        case typescript.SyntaxKind.MinusToken: {
            return -operandValue;
        }
        case typescript.SyntaxKind.TildeToken: {
            return ~operandValue;
        }
        case typescript.SyntaxKind.ExclamationToken: {
            return !operandValue;
        }
        case typescript.SyntaxKind.PlusPlusToken: {
            if (!typescript.isIdentifier(node.operand) && !((_a = typescript.isPrivateIdentifier) === null || _a === void 0 ? void 0 : _a.call(typescript, node.operand))) {
                throw new UnexpectedNodeError({ node: node.operand, typescript });
            }
            const dict = getRelevantDictFromLexicalEnvironment(environment, node.operand.text);
            const value = ++dict[node.operand.text];
            if (reporting.reportBindings != null) {
                reporting.reportBindings({ path: node.operand.text, value, node });
            }
            return value;
        }
        case typescript.SyntaxKind.MinusMinusToken: {
            if (!typescript.isIdentifier(node.operand) && !((_b = typescript.isPrivateIdentifier) === null || _b === void 0 ? void 0 : _b.call(typescript, node.operand))) {
                throw new UnexpectedNodeError({ node: node.operand, typescript });
            }
            const dict = getRelevantDictFromLexicalEnvironment(environment, node.operand.text);
            const value = --dict[node.operand.text];
            if (reporting.reportBindings != null) {
                reporting.reportBindings({ path: node.operand.text, value, node });
            }
            return value;
        }
    }
}
function evaluatePrefixUnaryExpression ( { node , environment , evaluate , reporting , typescript , statementTraversalStack } ) { var _a , _b ; const operandValue = evaluate . expression ( node . operand , environment , statementTraversalStack ) ; switch ( node . operator ) { case typescript . SyntaxKind . PlusToken : { return + operandValue ; } case typescript . SyntaxKind . MinusToken : { return - operandValue ; } case typescript . SyntaxKind . TildeToken : { return ~ operandValue ; } case typescript . SyntaxKind . ExclamationToken : { return ! operandValue ; } case typescript . SyntaxKind . PlusPlusToken : { if ( ! typescript . isIdentifier ( node . operand ) && ! ( ( _a = typescript . isPrivateIdentifier ) === null || _a === void 0 ? void 0 : _a . call ( typescript , node . operand ) ) ) { throw new UnexpectedNodeError ( { node : node . operand , typescript } ) ; } const dict = getRelevantDictFromLexicalEnvironment ( environment , node . operand . text ) ; const value = ++ dict [ node . operand . text ] ; if ( reporting . reportBindings != null ) { reporting . reportBindings ( { path : node . operand . text , value , node } ) ; } return value ; } case typescript . SyntaxKind . MinusMinusToken : { if ( ! typescript . isIdentifier ( node . operand ) && ! ( ( _b = typescript . isPrivateIdentifier ) === null || _b === void 0 ? void 0 : _b . call ( typescript , node . operand ) ) ) { throw new UnexpectedNodeError ( { node : node . operand , typescript } ) ; } const dict = getRelevantDictFromLexicalEnvironment ( environment , node . operand . text ) ; const value = -- dict [ node . operand . text ] ; if ( reporting . reportBindings != null ) { reporting . reportBindings ( { path : node . operand . text , value , node } ) ; } return value ; } } }
Evaluates, or attempts to evaluate, a PrefixUnaryExpression
Evaluates or attempts to evaluate a PrefixUnaryExpression
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions // If the Operand isn't an identifier, this will be a SyntaxError // Find the value associated with the identifier within the environment. // Inform reporting hooks if any is given // If the Operand isn't an identifier, this will be a SyntaxError // Find the value associated with the identifier within the environment. // Inform reporting hooks if any is given