All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.shapesecurity.shift.es2017.reducer.ThunkedDirector Maven / Gradle / Ivy

There is a newer version: 1.3.2
Show newest version
// Generated by director.js
/**
 * Copyright 2018 Shape Security, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


package com.shapesecurity.shift.es2017.reducer;

import com.shapesecurity.functional.data.ImmutableList;
import com.shapesecurity.functional.data.Maybe;
import com.shapesecurity.shift.es2017.ast.*;

import javax.annotation.Nonnull;
import java.util.function.Supplier;

public final class ThunkedDirector {

    @Nonnull
    public static  State reduceArrayAssignmentTarget(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ArrayAssignmentTarget node) {
        return reducer.reduceArrayAssignmentTarget(node, reduceListMaybeAssignmentTargetAssignmentTargetWithDefault(reducer, node.elements), reduceMaybeAssignmentTarget(reducer, node.rest));
    }

    @Nonnull
    public static  State reduceArrayBinding(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ArrayBinding node) {
        return reducer.reduceArrayBinding(node, reduceListMaybeBindingBindingWithDefault(reducer, node.elements), reduceMaybeBinding(reducer, node.rest));
    }

    @Nonnull
    public static  State reduceArrayExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ArrayExpression node) {
        return reducer.reduceArrayExpression(node, reduceListMaybeSpreadElementExpression(reducer, node.elements));
    }

    @Nonnull
    public static  State reduceArrowExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ArrowExpression node) {
        return reducer.reduceArrowExpression(node, () -> reduceFormalParameters(reducer, node.params), () -> reduceFunctionBodyExpression(reducer, node.body));
    }

    @Nonnull
    public static  State reduceAssignmentExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull AssignmentExpression node) {
        return reducer.reduceAssignmentExpression(node, () -> reduceAssignmentTarget(reducer, node.binding), () -> reduceExpression(reducer, node.expression));
    }

    @Nonnull
    public static  State reduceAssignmentTarget(
      @Nonnull ThunkedReducer reducer,
      @Nonnull AssignmentTarget node) {
        if (node instanceof AssignmentTargetPattern) {
            return reduceAssignmentTargetPattern(reducer, (AssignmentTargetPattern) node);
        } else if (node instanceof SimpleAssignmentTarget) {
            return reduceSimpleAssignmentTarget(reducer, (SimpleAssignmentTarget) node);
        } else {
            throw new RuntimeException("Not reached");
        }
    }

    @Nonnull
    public static  State reduceAssignmentTargetAssignmentTargetWithDefault(
      @Nonnull ThunkedReducer reducer,
      @Nonnull AssignmentTargetAssignmentTargetWithDefault node) {
        if (node instanceof AssignmentTarget) {
            return reduceAssignmentTarget(reducer, (AssignmentTarget) node);
        } else if (node instanceof AssignmentTargetWithDefault) {
            return reduceAssignmentTargetWithDefault(reducer, (AssignmentTargetWithDefault) node);
        } else {
            throw new RuntimeException("Not reached");
        }
    }

    @Nonnull
    public static  State reduceAssignmentTargetIdentifier(
      @Nonnull ThunkedReducer reducer,
      @Nonnull AssignmentTargetIdentifier node) {
        return reducer.reduceAssignmentTargetIdentifier(node);
    }

    @Nonnull
    public static  State reduceAssignmentTargetPattern(
      @Nonnull ThunkedReducer reducer,
      @Nonnull AssignmentTargetPattern node) {
        if (node instanceof ObjectAssignmentTarget) {
            return reduceObjectAssignmentTarget(reducer, (ObjectAssignmentTarget) node);
        } else if (node instanceof ArrayAssignmentTarget) {
            return reduceArrayAssignmentTarget(reducer, (ArrayAssignmentTarget) node);
        } else {
            throw new RuntimeException("Not reached");
        }
    }

    @Nonnull
    public static  State reduceAssignmentTargetProperty(
      @Nonnull ThunkedReducer reducer,
      @Nonnull AssignmentTargetProperty node) {
        if (node instanceof AssignmentTargetPropertyIdentifier) {
            return reduceAssignmentTargetPropertyIdentifier(reducer, (AssignmentTargetPropertyIdentifier) node);
        } else if (node instanceof AssignmentTargetPropertyProperty) {
            return reduceAssignmentTargetPropertyProperty(reducer, (AssignmentTargetPropertyProperty) node);
        } else {
            throw new RuntimeException("Not reached");
        }
    }

    @Nonnull
    public static  State reduceAssignmentTargetPropertyIdentifier(
      @Nonnull ThunkedReducer reducer,
      @Nonnull AssignmentTargetPropertyIdentifier node) {
        return reducer.reduceAssignmentTargetPropertyIdentifier(node, () -> reduceAssignmentTargetIdentifier(reducer, node.binding), reduceMaybeExpression(reducer, node.init));
    }

    @Nonnull
    public static  State reduceAssignmentTargetPropertyProperty(
      @Nonnull ThunkedReducer reducer,
      @Nonnull AssignmentTargetPropertyProperty node) {
        return reducer.reduceAssignmentTargetPropertyProperty(node, () -> reducePropertyName(reducer, node.name), () -> reduceAssignmentTargetAssignmentTargetWithDefault(reducer, node.binding));
    }

    @Nonnull
    public static  State reduceAssignmentTargetWithDefault(
      @Nonnull ThunkedReducer reducer,
      @Nonnull AssignmentTargetWithDefault node) {
        return reducer.reduceAssignmentTargetWithDefault(node, () -> reduceAssignmentTarget(reducer, node.binding), () -> reduceExpression(reducer, node.init));
    }

    @Nonnull
    public static  State reduceAwaitExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull AwaitExpression node) {
        return reducer.reduceAwaitExpression(node, () -> reduceExpression(reducer, node.expression));
    }

    @Nonnull
    public static  State reduceBinaryExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull BinaryExpression node) {
        return reducer.reduceBinaryExpression(node, () -> reduceExpression(reducer, node.left), () -> reduceExpression(reducer, node.right));
    }

    @Nonnull
    public static  State reduceBinding(
      @Nonnull ThunkedReducer reducer,
      @Nonnull Binding node) {
        if (node instanceof BindingPattern) {
            return reduceBindingPattern(reducer, (BindingPattern) node);
        } else if (node instanceof BindingIdentifier) {
            return reduceBindingIdentifier(reducer, (BindingIdentifier) node);
        } else {
            throw new RuntimeException("Not reached");
        }
    }

    @Nonnull
    public static  State reduceBindingBindingWithDefault(
      @Nonnull ThunkedReducer reducer,
      @Nonnull BindingBindingWithDefault node) {
        if (node instanceof Binding) {
            return reduceBinding(reducer, (Binding) node);
        } else if (node instanceof BindingWithDefault) {
            return reduceBindingWithDefault(reducer, (BindingWithDefault) node);
        } else {
            throw new RuntimeException("Not reached");
        }
    }

    @Nonnull
    public static  State reduceBindingIdentifier(
      @Nonnull ThunkedReducer reducer,
      @Nonnull BindingIdentifier node) {
        return reducer.reduceBindingIdentifier(node);
    }

    @Nonnull
    public static  State reduceBindingPattern(
      @Nonnull ThunkedReducer reducer,
      @Nonnull BindingPattern node) {
        if (node instanceof ObjectBinding) {
            return reduceObjectBinding(reducer, (ObjectBinding) node);
        } else if (node instanceof ArrayBinding) {
            return reduceArrayBinding(reducer, (ArrayBinding) node);
        } else {
            throw new RuntimeException("Not reached");
        }
    }

    @Nonnull
    public static  State reduceBindingProperty(
      @Nonnull ThunkedReducer reducer,
      @Nonnull BindingProperty node) {
        if (node instanceof BindingPropertyIdentifier) {
            return reduceBindingPropertyIdentifier(reducer, (BindingPropertyIdentifier) node);
        } else if (node instanceof BindingPropertyProperty) {
            return reduceBindingPropertyProperty(reducer, (BindingPropertyProperty) node);
        } else {
            throw new RuntimeException("Not reached");
        }
    }

    @Nonnull
    public static  State reduceBindingPropertyIdentifier(
      @Nonnull ThunkedReducer reducer,
      @Nonnull BindingPropertyIdentifier node) {
        return reducer.reduceBindingPropertyIdentifier(node, () -> reduceBindingIdentifier(reducer, node.binding), reduceMaybeExpression(reducer, node.init));
    }

    @Nonnull
    public static  State reduceBindingPropertyProperty(
      @Nonnull ThunkedReducer reducer,
      @Nonnull BindingPropertyProperty node) {
        return reducer.reduceBindingPropertyProperty(node, () -> reducePropertyName(reducer, node.name), () -> reduceBindingBindingWithDefault(reducer, node.binding));
    }

    @Nonnull
    public static  State reduceBindingWithDefault(
      @Nonnull ThunkedReducer reducer,
      @Nonnull BindingWithDefault node) {
        return reducer.reduceBindingWithDefault(node, () -> reduceBinding(reducer, node.binding), () -> reduceExpression(reducer, node.init));
    }

    @Nonnull
    public static  State reduceBlock(
      @Nonnull ThunkedReducer reducer,
      @Nonnull Block node) {
        return reducer.reduceBlock(node, reduceListStatement(reducer, node.statements));
    }

    @Nonnull
    public static  State reduceBlockStatement(
      @Nonnull ThunkedReducer reducer,
      @Nonnull BlockStatement node) {
        return reducer.reduceBlockStatement(node, () -> reduceBlock(reducer, node.block));
    }

    @Nonnull
    public static  State reduceBreakStatement(
      @Nonnull ThunkedReducer reducer,
      @Nonnull BreakStatement node) {
        return reducer.reduceBreakStatement(node);
    }

    @Nonnull
    public static  State reduceCallExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull CallExpression node) {
        return reducer.reduceCallExpression(node, () -> reduceExpressionSuper(reducer, node.callee), reduceListSpreadElementExpression(reducer, node.arguments));
    }

    @Nonnull
    public static  State reduceCatchClause(
      @Nonnull ThunkedReducer reducer,
      @Nonnull CatchClause node) {
        return reducer.reduceCatchClause(node, () -> reduceBinding(reducer, node.binding), () -> reduceBlock(reducer, node.body));
    }

    @Nonnull
    public static  State reduceClassDeclaration(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ClassDeclaration node) {
        return reducer.reduceClassDeclaration(node, () -> reduceBindingIdentifier(reducer, node.name), reduceMaybeExpression(reducer, node._super), reduceListClassElement(reducer, node.elements));
    }

    @Nonnull
    public static  State reduceClassElement(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ClassElement node) {
        return reducer.reduceClassElement(node, () -> reduceMethodDefinition(reducer, node.method));
    }

    @Nonnull
    public static  State reduceClassExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ClassExpression node) {
        return reducer.reduceClassExpression(node, reduceMaybeBindingIdentifier(reducer, node.name), reduceMaybeExpression(reducer, node._super), reduceListClassElement(reducer, node.elements));
    }

    @Nonnull
    public static  State reduceCompoundAssignmentExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull CompoundAssignmentExpression node) {
        return reducer.reduceCompoundAssignmentExpression(node, () -> reduceSimpleAssignmentTarget(reducer, node.binding), () -> reduceExpression(reducer, node.expression));
    }

    @Nonnull
    public static  State reduceComputedMemberAssignmentTarget(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ComputedMemberAssignmentTarget node) {
        return reducer.reduceComputedMemberAssignmentTarget(node, () -> reduceExpressionSuper(reducer, node.object), () -> reduceExpression(reducer, node.expression));
    }

    @Nonnull
    public static  State reduceComputedMemberExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ComputedMemberExpression node) {
        return reducer.reduceComputedMemberExpression(node, () -> reduceExpressionSuper(reducer, node.object), () -> reduceExpression(reducer, node.expression));
    }

    @Nonnull
    public static  State reduceComputedPropertyName(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ComputedPropertyName node) {
        return reducer.reduceComputedPropertyName(node, () -> reduceExpression(reducer, node.expression));
    }

    @Nonnull
    public static  State reduceConditionalExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ConditionalExpression node) {
        return reducer.reduceConditionalExpression(node, () -> reduceExpression(reducer, node.test), () -> reduceExpression(reducer, node.consequent), () -> reduceExpression(reducer, node.alternate));
    }

    @Nonnull
    public static  State reduceContinueStatement(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ContinueStatement node) {
        return reducer.reduceContinueStatement(node);
    }

    @Nonnull
    public static  State reduceDataProperty(
      @Nonnull ThunkedReducer reducer,
      @Nonnull DataProperty node) {
        return reducer.reduceDataProperty(node, () -> reducePropertyName(reducer, node.name), () -> reduceExpression(reducer, node.expression));
    }

    @Nonnull
    public static  State reduceDebuggerStatement(
      @Nonnull ThunkedReducer reducer,
      @Nonnull DebuggerStatement node) {
        return reducer.reduceDebuggerStatement(node);
    }

    @Nonnull
    public static  State reduceDirective(
      @Nonnull ThunkedReducer reducer,
      @Nonnull Directive node) {
        return reducer.reduceDirective(node);
    }

    @Nonnull
    public static  State reduceDoWhileStatement(
      @Nonnull ThunkedReducer reducer,
      @Nonnull DoWhileStatement node) {
        return reducer.reduceDoWhileStatement(node, () -> reduceStatement(reducer, node.body), () -> reduceExpression(reducer, node.test));
    }

    @Nonnull
    public static  State reduceEmptyStatement(
      @Nonnull ThunkedReducer reducer,
      @Nonnull EmptyStatement node) {
        return reducer.reduceEmptyStatement(node);
    }

    @Nonnull
    public static  State reduceExport(
      @Nonnull ThunkedReducer reducer,
      @Nonnull Export node) {
        return reducer.reduceExport(node, () -> reduceFunctionDeclarationClassDeclarationVariableDeclaration(reducer, node.declaration));
    }

    @Nonnull
    public static  State reduceExportAllFrom(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ExportAllFrom node) {
        return reducer.reduceExportAllFrom(node);
    }

    @Nonnull
    public static  State reduceExportDeclaration(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ExportDeclaration node) {
        if (node instanceof ExportAllFrom) {
            return reduceExportAllFrom(reducer, (ExportAllFrom) node);
        } else if (node instanceof ExportFrom) {
            return reduceExportFrom(reducer, (ExportFrom) node);
        } else if (node instanceof ExportLocals) {
            return reduceExportLocals(reducer, (ExportLocals) node);
        } else if (node instanceof Export) {
            return reduceExport(reducer, (Export) node);
        } else if (node instanceof ExportDefault) {
            return reduceExportDefault(reducer, (ExportDefault) node);
        } else {
            throw new RuntimeException("Not reached");
        }
    }

    @Nonnull
    public static  State reduceExportDefault(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ExportDefault node) {
        return reducer.reduceExportDefault(node, () -> reduceFunctionDeclarationClassDeclarationExpression(reducer, node.body));
    }

    @Nonnull
    public static  State reduceExportFrom(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ExportFrom node) {
        return reducer.reduceExportFrom(node, reduceListExportFromSpecifier(reducer, node.namedExports));
    }

    @Nonnull
    public static  State reduceExportFromSpecifier(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ExportFromSpecifier node) {
        return reducer.reduceExportFromSpecifier(node);
    }

    @Nonnull
    public static  State reduceExportLocalSpecifier(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ExportLocalSpecifier node) {
        return reducer.reduceExportLocalSpecifier(node, () -> reduceIdentifierExpression(reducer, node.name));
    }

    @Nonnull
    public static  State reduceExportLocals(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ExportLocals node) {
        return reducer.reduceExportLocals(node, reduceListExportLocalSpecifier(reducer, node.namedExports));
    }

    @Nonnull
    public static  State reduceExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull Expression node) {
        if (node instanceof MemberExpression) {
            return reduceMemberExpression(reducer, (MemberExpression) node);
        } else if (node instanceof ClassExpression) {
            return reduceClassExpression(reducer, (ClassExpression) node);
        } else if (node instanceof LiteralBooleanExpression) {
            return reduceLiteralBooleanExpression(reducer, (LiteralBooleanExpression) node);
        } else if (node instanceof LiteralInfinityExpression) {
            return reduceLiteralInfinityExpression(reducer, (LiteralInfinityExpression) node);
        } else if (node instanceof LiteralNullExpression) {
            return reduceLiteralNullExpression(reducer, (LiteralNullExpression) node);
        } else if (node instanceof LiteralNumericExpression) {
            return reduceLiteralNumericExpression(reducer, (LiteralNumericExpression) node);
        } else if (node instanceof LiteralRegExpExpression) {
            return reduceLiteralRegExpExpression(reducer, (LiteralRegExpExpression) node);
        } else if (node instanceof LiteralStringExpression) {
            return reduceLiteralStringExpression(reducer, (LiteralStringExpression) node);
        } else if (node instanceof ArrayExpression) {
            return reduceArrayExpression(reducer, (ArrayExpression) node);
        } else if (node instanceof ArrowExpression) {
            return reduceArrowExpression(reducer, (ArrowExpression) node);
        } else if (node instanceof AssignmentExpression) {
            return reduceAssignmentExpression(reducer, (AssignmentExpression) node);
        } else if (node instanceof BinaryExpression) {
            return reduceBinaryExpression(reducer, (BinaryExpression) node);
        } else if (node instanceof CallExpression) {
            return reduceCallExpression(reducer, (CallExpression) node);
        } else if (node instanceof CompoundAssignmentExpression) {
            return reduceCompoundAssignmentExpression(reducer, (CompoundAssignmentExpression) node);
        } else if (node instanceof ConditionalExpression) {
            return reduceConditionalExpression(reducer, (ConditionalExpression) node);
        } else if (node instanceof FunctionExpression) {
            return reduceFunctionExpression(reducer, (FunctionExpression) node);
        } else if (node instanceof IdentifierExpression) {
            return reduceIdentifierExpression(reducer, (IdentifierExpression) node);
        } else if (node instanceof NewExpression) {
            return reduceNewExpression(reducer, (NewExpression) node);
        } else if (node instanceof NewTargetExpression) {
            return reduceNewTargetExpression(reducer, (NewTargetExpression) node);
        } else if (node instanceof ObjectExpression) {
            return reduceObjectExpression(reducer, (ObjectExpression) node);
        } else if (node instanceof UnaryExpression) {
            return reduceUnaryExpression(reducer, (UnaryExpression) node);
        } else if (node instanceof TemplateExpression) {
            return reduceTemplateExpression(reducer, (TemplateExpression) node);
        } else if (node instanceof ThisExpression) {
            return reduceThisExpression(reducer, (ThisExpression) node);
        } else if (node instanceof UpdateExpression) {
            return reduceUpdateExpression(reducer, (UpdateExpression) node);
        } else if (node instanceof YieldExpression) {
            return reduceYieldExpression(reducer, (YieldExpression) node);
        } else if (node instanceof YieldGeneratorExpression) {
            return reduceYieldGeneratorExpression(reducer, (YieldGeneratorExpression) node);
        } else if (node instanceof AwaitExpression) {
            return reduceAwaitExpression(reducer, (AwaitExpression) node);
        } else {
            throw new RuntimeException("Not reached");
        }
    }

    @Nonnull
    public static  State reduceExpressionStatement(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ExpressionStatement node) {
        return reducer.reduceExpressionStatement(node, () -> reduceExpression(reducer, node.expression));
    }

    @Nonnull
    public static  State reduceExpressionSuper(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ExpressionSuper node) {
        if (node instanceof Expression) {
            return reduceExpression(reducer, (Expression) node);
        } else if (node instanceof Super) {
            return reduceSuper(reducer, (Super) node);
        } else {
            throw new RuntimeException("Not reached");
        }
    }

    @Nonnull
    public static  State reduceExpressionTemplateElement(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ExpressionTemplateElement node) {
        if (node instanceof Expression) {
            return reduceExpression(reducer, (Expression) node);
        } else if (node instanceof TemplateElement) {
            return reduceTemplateElement(reducer, (TemplateElement) node);
        } else {
            throw new RuntimeException("Not reached");
        }
    }

    @Nonnull
    public static  State reduceForInStatement(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ForInStatement node) {
        return reducer.reduceForInStatement(node, () -> reduceVariableDeclarationAssignmentTarget(reducer, node.left), () -> reduceExpression(reducer, node.right), () -> reduceStatement(reducer, node.body));
    }

    @Nonnull
    public static  State reduceForOfStatement(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ForOfStatement node) {
        return reducer.reduceForOfStatement(node, () -> reduceVariableDeclarationAssignmentTarget(reducer, node.left), () -> reduceExpression(reducer, node.right), () -> reduceStatement(reducer, node.body));
    }

    @Nonnull
    public static  State reduceForStatement(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ForStatement node) {
        return reducer.reduceForStatement(node, reduceMaybeVariableDeclarationExpression(reducer, node.init), reduceMaybeExpression(reducer, node.test), reduceMaybeExpression(reducer, node.update), () -> reduceStatement(reducer, node.body));
    }

    @Nonnull
    public static  State reduceFormalParameters(
      @Nonnull ThunkedReducer reducer,
      @Nonnull FormalParameters node) {
        return reducer.reduceFormalParameters(node, reduceListParameter(reducer, node.items), reduceMaybeBinding(reducer, node.rest));
    }

    @Nonnull
    public static  State reduceFunctionBody(
      @Nonnull ThunkedReducer reducer,
      @Nonnull FunctionBody node) {
        return reducer.reduceFunctionBody(node, reduceListDirective(reducer, node.directives), reduceListStatement(reducer, node.statements));
    }

    @Nonnull
    public static  State reduceFunctionBodyExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull FunctionBodyExpression node) {
        if (node instanceof FunctionBody) {
            return reduceFunctionBody(reducer, (FunctionBody) node);
        } else if (node instanceof Expression) {
            return reduceExpression(reducer, (Expression) node);
        } else {
            throw new RuntimeException("Not reached");
        }
    }

    @Nonnull
    public static  State reduceFunctionDeclaration(
      @Nonnull ThunkedReducer reducer,
      @Nonnull FunctionDeclaration node) {
        return reducer.reduceFunctionDeclaration(node, () -> reduceBindingIdentifier(reducer, node.name), () -> reduceFormalParameters(reducer, node.params), () -> reduceFunctionBody(reducer, node.body));
    }

    @Nonnull
    public static  State reduceFunctionDeclarationClassDeclarationExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull FunctionDeclarationClassDeclarationExpression node) {
        if (node instanceof FunctionDeclaration) {
            return reduceFunctionDeclaration(reducer, (FunctionDeclaration) node);
        } else if (node instanceof ClassDeclaration) {
            return reduceClassDeclaration(reducer, (ClassDeclaration) node);
        } else if (node instanceof Expression) {
            return reduceExpression(reducer, (Expression) node);
        } else {
            throw new RuntimeException("Not reached");
        }
    }

    @Nonnull
    public static  State reduceFunctionDeclarationClassDeclarationVariableDeclaration(
      @Nonnull ThunkedReducer reducer,
      @Nonnull FunctionDeclarationClassDeclarationVariableDeclaration node) {
        if (node instanceof FunctionDeclaration) {
            return reduceFunctionDeclaration(reducer, (FunctionDeclaration) node);
        } else if (node instanceof ClassDeclaration) {
            return reduceClassDeclaration(reducer, (ClassDeclaration) node);
        } else if (node instanceof VariableDeclaration) {
            return reduceVariableDeclaration(reducer, (VariableDeclaration) node);
        } else {
            throw new RuntimeException("Not reached");
        }
    }

    @Nonnull
    public static  State reduceFunctionExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull FunctionExpression node) {
        return reducer.reduceFunctionExpression(node, reduceMaybeBindingIdentifier(reducer, node.name), () -> reduceFormalParameters(reducer, node.params), () -> reduceFunctionBody(reducer, node.body));
    }

    @Nonnull
    public static  State reduceGetter(
      @Nonnull ThunkedReducer reducer,
      @Nonnull Getter node) {
        return reducer.reduceGetter(node, () -> reducePropertyName(reducer, node.name), () -> reduceFunctionBody(reducer, node.body));
    }

    @Nonnull
    public static  State reduceIdentifierExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull IdentifierExpression node) {
        return reducer.reduceIdentifierExpression(node);
    }

    @Nonnull
    public static  State reduceIfStatement(
      @Nonnull ThunkedReducer reducer,
      @Nonnull IfStatement node) {
        return reducer.reduceIfStatement(node, () -> reduceExpression(reducer, node.test), () -> reduceStatement(reducer, node.consequent), reduceMaybeStatement(reducer, node.alternate));
    }

    @Nonnull
    public static  State reduceImport(
      @Nonnull ThunkedReducer reducer,
      @Nonnull Import node) {
        return reducer.reduceImport(node, reduceMaybeBindingIdentifier(reducer, node.defaultBinding), reduceListImportSpecifier(reducer, node.namedImports));
    }

    @Nonnull
    public static  State reduceImportDeclaration(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ImportDeclaration node) {
        if (node instanceof Import) {
            return reduceImport(reducer, (Import) node);
        } else if (node instanceof ImportNamespace) {
            return reduceImportNamespace(reducer, (ImportNamespace) node);
        } else {
            throw new RuntimeException("Not reached");
        }
    }

    @Nonnull
    public static  State reduceImportDeclarationExportDeclarationStatement(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ImportDeclarationExportDeclarationStatement node) {
        if (node instanceof ImportDeclaration) {
            return reduceImportDeclaration(reducer, (ImportDeclaration) node);
        } else if (node instanceof ExportDeclaration) {
            return reduceExportDeclaration(reducer, (ExportDeclaration) node);
        } else if (node instanceof Statement) {
            return reduceStatement(reducer, (Statement) node);
        } else {
            throw new RuntimeException("Not reached");
        }
    }

    @Nonnull
    public static  State reduceImportNamespace(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ImportNamespace node) {
        return reducer.reduceImportNamespace(node, reduceMaybeBindingIdentifier(reducer, node.defaultBinding), () -> reduceBindingIdentifier(reducer, node.namespaceBinding));
    }

    @Nonnull
    public static  State reduceImportSpecifier(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ImportSpecifier node) {
        return reducer.reduceImportSpecifier(node, () -> reduceBindingIdentifier(reducer, node.binding));
    }

    @Nonnull
    public static  State reduceIterationStatement(
      @Nonnull ThunkedReducer reducer,
      @Nonnull IterationStatement node) {
        if (node instanceof DoWhileStatement) {
            return reduceDoWhileStatement(reducer, (DoWhileStatement) node);
        } else if (node instanceof ForInStatement) {
            return reduceForInStatement(reducer, (ForInStatement) node);
        } else if (node instanceof ForOfStatement) {
            return reduceForOfStatement(reducer, (ForOfStatement) node);
        } else if (node instanceof ForStatement) {
            return reduceForStatement(reducer, (ForStatement) node);
        } else if (node instanceof WhileStatement) {
            return reduceWhileStatement(reducer, (WhileStatement) node);
        } else {
            throw new RuntimeException("Not reached");
        }
    }

    @Nonnull
    public static  State reduceLabeledStatement(
      @Nonnull ThunkedReducer reducer,
      @Nonnull LabeledStatement node) {
        return reducer.reduceLabeledStatement(node, () -> reduceStatement(reducer, node.body));
    }

    @Nonnull
    public static  ImmutableList> reduceListAssignmentTargetProperty(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ImmutableList list) {
        return list.map(x -> () -> reduceAssignmentTargetProperty(reducer, x));
      }


    @Nonnull
    public static  ImmutableList> reduceListBindingProperty(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ImmutableList list) {
        return list.map(x -> () -> reduceBindingProperty(reducer, x));
      }


    @Nonnull
    public static  ImmutableList> reduceListClassElement(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ImmutableList list) {
        return list.map(x -> () -> reduceClassElement(reducer, x));
      }


    @Nonnull
    public static  ImmutableList> reduceListDirective(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ImmutableList list) {
        return list.map(x -> () -> reduceDirective(reducer, x));
      }


    @Nonnull
    public static  ImmutableList> reduceListExportFromSpecifier(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ImmutableList list) {
        return list.map(x -> () -> reduceExportFromSpecifier(reducer, x));
      }


    @Nonnull
    public static  ImmutableList> reduceListExportLocalSpecifier(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ImmutableList list) {
        return list.map(x -> () -> reduceExportLocalSpecifier(reducer, x));
      }


    @Nonnull
    public static  ImmutableList> reduceListExpressionTemplateElement(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ImmutableList list) {
        return list.map(x -> () -> reduceExpressionTemplateElement(reducer, x));
      }


    @Nonnull
    public static  ImmutableList> reduceListImportDeclarationExportDeclarationStatement(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ImmutableList list) {
        return list.map(x -> () -> reduceImportDeclarationExportDeclarationStatement(reducer, x));
      }


    @Nonnull
    public static  ImmutableList> reduceListImportSpecifier(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ImmutableList list) {
        return list.map(x -> () -> reduceImportSpecifier(reducer, x));
      }


    @Nonnull
    public static  ImmutableList>> reduceListMaybeAssignmentTargetAssignmentTargetWithDefault(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ImmutableList> list) {
        return list.map(x -> reduceMaybeAssignmentTargetAssignmentTargetWithDefault(reducer, x));
      }


    @Nonnull
    public static  ImmutableList>> reduceListMaybeBindingBindingWithDefault(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ImmutableList> list) {
        return list.map(x -> reduceMaybeBindingBindingWithDefault(reducer, x));
      }


    @Nonnull
    public static  ImmutableList>> reduceListMaybeSpreadElementExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ImmutableList> list) {
        return list.map(x -> reduceMaybeSpreadElementExpression(reducer, x));
      }


    @Nonnull
    public static  ImmutableList> reduceListObjectProperty(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ImmutableList list) {
        return list.map(x -> () -> reduceObjectProperty(reducer, x));
      }


    @Nonnull
    public static  ImmutableList> reduceListParameter(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ImmutableList list) {
        return list.map(x -> () -> reduceParameter(reducer, x));
      }


    @Nonnull
    public static  ImmutableList> reduceListSpreadElementExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ImmutableList list) {
        return list.map(x -> () -> reduceSpreadElementExpression(reducer, x));
      }


    @Nonnull
    public static  ImmutableList> reduceListStatement(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ImmutableList list) {
        return list.map(x -> () -> reduceStatement(reducer, x));
      }


    @Nonnull
    public static  ImmutableList> reduceListSwitchCase(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ImmutableList list) {
        return list.map(x -> () -> reduceSwitchCase(reducer, x));
      }


    @Nonnull
    public static  ImmutableList> reduceListVariableDeclarator(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ImmutableList list) {
        return list.map(x -> () -> reduceVariableDeclarator(reducer, x));
      }


    @Nonnull
    public static  State reduceLiteralBooleanExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull LiteralBooleanExpression node) {
        return reducer.reduceLiteralBooleanExpression(node);
    }

    @Nonnull
    public static  State reduceLiteralInfinityExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull LiteralInfinityExpression node) {
        return reducer.reduceLiteralInfinityExpression(node);
    }

    @Nonnull
    public static  State reduceLiteralNullExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull LiteralNullExpression node) {
        return reducer.reduceLiteralNullExpression(node);
    }

    @Nonnull
    public static  State reduceLiteralNumericExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull LiteralNumericExpression node) {
        return reducer.reduceLiteralNumericExpression(node);
    }

    @Nonnull
    public static  State reduceLiteralRegExpExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull LiteralRegExpExpression node) {
        return reducer.reduceLiteralRegExpExpression(node);
    }

    @Nonnull
    public static  State reduceLiteralStringExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull LiteralStringExpression node) {
        return reducer.reduceLiteralStringExpression(node);
    }

    @Nonnull
    public static  Maybe> reduceMaybeAssignmentTarget(
      @Nonnull ThunkedReducer reducer,
      @Nonnull Maybe maybe) {
        return maybe.map(x -> () -> reduceAssignmentTarget(reducer, x));
      }


    @Nonnull
    public static  Maybe> reduceMaybeAssignmentTargetAssignmentTargetWithDefault(
      @Nonnull ThunkedReducer reducer,
      @Nonnull Maybe maybe) {
        return maybe.map(x -> () -> reduceAssignmentTargetAssignmentTargetWithDefault(reducer, x));
      }


    @Nonnull
    public static  Maybe> reduceMaybeBinding(
      @Nonnull ThunkedReducer reducer,
      @Nonnull Maybe maybe) {
        return maybe.map(x -> () -> reduceBinding(reducer, x));
      }


    @Nonnull
    public static  Maybe> reduceMaybeBindingBindingWithDefault(
      @Nonnull ThunkedReducer reducer,
      @Nonnull Maybe maybe) {
        return maybe.map(x -> () -> reduceBindingBindingWithDefault(reducer, x));
      }


    @Nonnull
    public static  Maybe> reduceMaybeBindingIdentifier(
      @Nonnull ThunkedReducer reducer,
      @Nonnull Maybe maybe) {
        return maybe.map(x -> () -> reduceBindingIdentifier(reducer, x));
      }


    @Nonnull
    public static  Maybe> reduceMaybeCatchClause(
      @Nonnull ThunkedReducer reducer,
      @Nonnull Maybe maybe) {
        return maybe.map(x -> () -> reduceCatchClause(reducer, x));
      }


    @Nonnull
    public static  Maybe> reduceMaybeExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull Maybe maybe) {
        return maybe.map(x -> () -> reduceExpression(reducer, x));
      }


    @Nonnull
    public static  Maybe> reduceMaybeSpreadElementExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull Maybe maybe) {
        return maybe.map(x -> () -> reduceSpreadElementExpression(reducer, x));
      }


    @Nonnull
    public static  Maybe> reduceMaybeStatement(
      @Nonnull ThunkedReducer reducer,
      @Nonnull Maybe maybe) {
        return maybe.map(x -> () -> reduceStatement(reducer, x));
      }


    @Nonnull
    public static  Maybe> reduceMaybeVariableDeclarationExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull Maybe maybe) {
        return maybe.map(x -> () -> reduceVariableDeclarationExpression(reducer, x));
      }


    @Nonnull
    public static  State reduceMemberAssignmentTarget(
      @Nonnull ThunkedReducer reducer,
      @Nonnull MemberAssignmentTarget node) {
        if (node instanceof ComputedMemberAssignmentTarget) {
            return reduceComputedMemberAssignmentTarget(reducer, (ComputedMemberAssignmentTarget) node);
        } else if (node instanceof StaticMemberAssignmentTarget) {
            return reduceStaticMemberAssignmentTarget(reducer, (StaticMemberAssignmentTarget) node);
        } else {
            throw new RuntimeException("Not reached");
        }
    }

    @Nonnull
    public static  State reduceMemberExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull MemberExpression node) {
        if (node instanceof ComputedMemberExpression) {
            return reduceComputedMemberExpression(reducer, (ComputedMemberExpression) node);
        } else if (node instanceof StaticMemberExpression) {
            return reduceStaticMemberExpression(reducer, (StaticMemberExpression) node);
        } else {
            throw new RuntimeException("Not reached");
        }
    }

    @Nonnull
    public static  State reduceMethod(
      @Nonnull ThunkedReducer reducer,
      @Nonnull Method node) {
        return reducer.reduceMethod(node, () -> reducePropertyName(reducer, node.name), () -> reduceFormalParameters(reducer, node.params), () -> reduceFunctionBody(reducer, node.body));
    }

    @Nonnull
    public static  State reduceMethodDefinition(
      @Nonnull ThunkedReducer reducer,
      @Nonnull MethodDefinition node) {
        if (node instanceof Method) {
            return reduceMethod(reducer, (Method) node);
        } else if (node instanceof Getter) {
            return reduceGetter(reducer, (Getter) node);
        } else if (node instanceof Setter) {
            return reduceSetter(reducer, (Setter) node);
        } else {
            throw new RuntimeException("Not reached");
        }
    }

    @Nonnull
    public static  State reduceModule(
      @Nonnull ThunkedReducer reducer,
      @Nonnull Module node) {
        return reducer.reduceModule(node, reduceListDirective(reducer, node.directives), reduceListImportDeclarationExportDeclarationStatement(reducer, node.items));
    }

    @Nonnull
    public static  State reduceNamedObjectProperty(
      @Nonnull ThunkedReducer reducer,
      @Nonnull NamedObjectProperty node) {
        if (node instanceof MethodDefinition) {
            return reduceMethodDefinition(reducer, (MethodDefinition) node);
        } else if (node instanceof DataProperty) {
            return reduceDataProperty(reducer, (DataProperty) node);
        } else {
            throw new RuntimeException("Not reached");
        }
    }

    @Nonnull
    public static  State reduceNewExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull NewExpression node) {
        return reducer.reduceNewExpression(node, () -> reduceExpression(reducer, node.callee), reduceListSpreadElementExpression(reducer, node.arguments));
    }

    @Nonnull
    public static  State reduceNewTargetExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull NewTargetExpression node) {
        return reducer.reduceNewTargetExpression(node);
    }

    @Nonnull
    public static  State reduceObjectAssignmentTarget(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ObjectAssignmentTarget node) {
        return reducer.reduceObjectAssignmentTarget(node, reduceListAssignmentTargetProperty(reducer, node.properties));
    }

    @Nonnull
    public static  State reduceObjectBinding(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ObjectBinding node) {
        return reducer.reduceObjectBinding(node, reduceListBindingProperty(reducer, node.properties));
    }

    @Nonnull
    public static  State reduceObjectExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ObjectExpression node) {
        return reducer.reduceObjectExpression(node, reduceListObjectProperty(reducer, node.properties));
    }

    @Nonnull
    public static  State reduceObjectProperty(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ObjectProperty node) {
        if (node instanceof NamedObjectProperty) {
            return reduceNamedObjectProperty(reducer, (NamedObjectProperty) node);
        } else if (node instanceof ShorthandProperty) {
            return reduceShorthandProperty(reducer, (ShorthandProperty) node);
        } else {
            throw new RuntimeException("Not reached");
        }
    }

    @Nonnull
    public static  State reduceParameter(
      @Nonnull ThunkedReducer reducer,
      @Nonnull Parameter node) {
        if (node instanceof Binding) {
            return reduceBinding(reducer, (Binding) node);
        } else if (node instanceof BindingWithDefault) {
            return reduceBindingWithDefault(reducer, (BindingWithDefault) node);
        } else {
            throw new RuntimeException("Not reached");
        }
    }

    @Nonnull
    public static  State reduceProgram(
      @Nonnull ThunkedReducer reducer,
      @Nonnull Program node) {
        if (node instanceof Module) {
            return reduceModule(reducer, (Module) node);
        } else if (node instanceof Script) {
            return reduceScript(reducer, (Script) node);
        } else {
            throw new RuntimeException("Not reached");
        }
    }

    @Nonnull
    public static  State reducePropertyName(
      @Nonnull ThunkedReducer reducer,
      @Nonnull PropertyName node) {
        if (node instanceof ComputedPropertyName) {
            return reduceComputedPropertyName(reducer, (ComputedPropertyName) node);
        } else if (node instanceof StaticPropertyName) {
            return reduceStaticPropertyName(reducer, (StaticPropertyName) node);
        } else {
            throw new RuntimeException("Not reached");
        }
    }

    @Nonnull
    public static  State reduceReturnStatement(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ReturnStatement node) {
        return reducer.reduceReturnStatement(node, reduceMaybeExpression(reducer, node.expression));
    }

    @Nonnull
    public static  State reduceScript(
      @Nonnull ThunkedReducer reducer,
      @Nonnull Script node) {
        return reducer.reduceScript(node, reduceListDirective(reducer, node.directives), reduceListStatement(reducer, node.statements));
    }

    @Nonnull
    public static  State reduceSetter(
      @Nonnull ThunkedReducer reducer,
      @Nonnull Setter node) {
        return reducer.reduceSetter(node, () -> reducePropertyName(reducer, node.name), () -> reduceParameter(reducer, node.param), () -> reduceFunctionBody(reducer, node.body));
    }

    @Nonnull
    public static  State reduceShorthandProperty(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ShorthandProperty node) {
        return reducer.reduceShorthandProperty(node, () -> reduceIdentifierExpression(reducer, node.name));
    }

    @Nonnull
    public static  State reduceSimpleAssignmentTarget(
      @Nonnull ThunkedReducer reducer,
      @Nonnull SimpleAssignmentTarget node) {
        if (node instanceof AssignmentTargetIdentifier) {
            return reduceAssignmentTargetIdentifier(reducer, (AssignmentTargetIdentifier) node);
        } else if (node instanceof MemberAssignmentTarget) {
            return reduceMemberAssignmentTarget(reducer, (MemberAssignmentTarget) node);
        } else {
            throw new RuntimeException("Not reached");
        }
    }

    @Nonnull
    public static  State reduceSpreadElement(
      @Nonnull ThunkedReducer reducer,
      @Nonnull SpreadElement node) {
        return reducer.reduceSpreadElement(node, () -> reduceExpression(reducer, node.expression));
    }

    @Nonnull
    public static  State reduceSpreadElementExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull SpreadElementExpression node) {
        if (node instanceof SpreadElement) {
            return reduceSpreadElement(reducer, (SpreadElement) node);
        } else if (node instanceof Expression) {
            return reduceExpression(reducer, (Expression) node);
        } else {
            throw new RuntimeException("Not reached");
        }
    }

    @Nonnull
    public static  State reduceStatement(
      @Nonnull ThunkedReducer reducer,
      @Nonnull Statement node) {
        if (node instanceof IterationStatement) {
            return reduceIterationStatement(reducer, (IterationStatement) node);
        } else if (node instanceof ClassDeclaration) {
            return reduceClassDeclaration(reducer, (ClassDeclaration) node);
        } else if (node instanceof BlockStatement) {
            return reduceBlockStatement(reducer, (BlockStatement) node);
        } else if (node instanceof BreakStatement) {
            return reduceBreakStatement(reducer, (BreakStatement) node);
        } else if (node instanceof ContinueStatement) {
            return reduceContinueStatement(reducer, (ContinueStatement) node);
        } else if (node instanceof DebuggerStatement) {
            return reduceDebuggerStatement(reducer, (DebuggerStatement) node);
        } else if (node instanceof EmptyStatement) {
            return reduceEmptyStatement(reducer, (EmptyStatement) node);
        } else if (node instanceof ExpressionStatement) {
            return reduceExpressionStatement(reducer, (ExpressionStatement) node);
        } else if (node instanceof IfStatement) {
            return reduceIfStatement(reducer, (IfStatement) node);
        } else if (node instanceof LabeledStatement) {
            return reduceLabeledStatement(reducer, (LabeledStatement) node);
        } else if (node instanceof ReturnStatement) {
            return reduceReturnStatement(reducer, (ReturnStatement) node);
        } else if (node instanceof SwitchStatement) {
            return reduceSwitchStatement(reducer, (SwitchStatement) node);
        } else if (node instanceof SwitchStatementWithDefault) {
            return reduceSwitchStatementWithDefault(reducer, (SwitchStatementWithDefault) node);
        } else if (node instanceof ThrowStatement) {
            return reduceThrowStatement(reducer, (ThrowStatement) node);
        } else if (node instanceof TryCatchStatement) {
            return reduceTryCatchStatement(reducer, (TryCatchStatement) node);
        } else if (node instanceof TryFinallyStatement) {
            return reduceTryFinallyStatement(reducer, (TryFinallyStatement) node);
        } else if (node instanceof VariableDeclarationStatement) {
            return reduceVariableDeclarationStatement(reducer, (VariableDeclarationStatement) node);
        } else if (node instanceof WithStatement) {
            return reduceWithStatement(reducer, (WithStatement) node);
        } else if (node instanceof FunctionDeclaration) {
            return reduceFunctionDeclaration(reducer, (FunctionDeclaration) node);
        } else {
            throw new RuntimeException("Not reached");
        }
    }

    @Nonnull
    public static  State reduceStaticMemberAssignmentTarget(
      @Nonnull ThunkedReducer reducer,
      @Nonnull StaticMemberAssignmentTarget node) {
        return reducer.reduceStaticMemberAssignmentTarget(node, () -> reduceExpressionSuper(reducer, node.object));
    }

    @Nonnull
    public static  State reduceStaticMemberExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull StaticMemberExpression node) {
        return reducer.reduceStaticMemberExpression(node, () -> reduceExpressionSuper(reducer, node.object));
    }

    @Nonnull
    public static  State reduceStaticPropertyName(
      @Nonnull ThunkedReducer reducer,
      @Nonnull StaticPropertyName node) {
        return reducer.reduceStaticPropertyName(node);
    }

    @Nonnull
    public static  State reduceSuper(
      @Nonnull ThunkedReducer reducer,
      @Nonnull Super node) {
        return reducer.reduceSuper(node);
    }

    @Nonnull
    public static  State reduceSwitchCase(
      @Nonnull ThunkedReducer reducer,
      @Nonnull SwitchCase node) {
        return reducer.reduceSwitchCase(node, () -> reduceExpression(reducer, node.test), reduceListStatement(reducer, node.consequent));
    }

    @Nonnull
    public static  State reduceSwitchDefault(
      @Nonnull ThunkedReducer reducer,
      @Nonnull SwitchDefault node) {
        return reducer.reduceSwitchDefault(node, reduceListStatement(reducer, node.consequent));
    }

    @Nonnull
    public static  State reduceSwitchStatement(
      @Nonnull ThunkedReducer reducer,
      @Nonnull SwitchStatement node) {
        return reducer.reduceSwitchStatement(node, () -> reduceExpression(reducer, node.discriminant), reduceListSwitchCase(reducer, node.cases));
    }

    @Nonnull
    public static  State reduceSwitchStatementWithDefault(
      @Nonnull ThunkedReducer reducer,
      @Nonnull SwitchStatementWithDefault node) {
        return reducer.reduceSwitchStatementWithDefault(node, () -> reduceExpression(reducer, node.discriminant), reduceListSwitchCase(reducer, node.preDefaultCases), () -> reduceSwitchDefault(reducer, node.defaultCase), reduceListSwitchCase(reducer, node.postDefaultCases));
    }

    @Nonnull
    public static  State reduceTemplateElement(
      @Nonnull ThunkedReducer reducer,
      @Nonnull TemplateElement node) {
        return reducer.reduceTemplateElement(node);
    }

    @Nonnull
    public static  State reduceTemplateExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull TemplateExpression node) {
        return reducer.reduceTemplateExpression(node, reduceMaybeExpression(reducer, node.tag), reduceListExpressionTemplateElement(reducer, node.elements));
    }

    @Nonnull
    public static  State reduceThisExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ThisExpression node) {
        return reducer.reduceThisExpression(node);
    }

    @Nonnull
    public static  State reduceThrowStatement(
      @Nonnull ThunkedReducer reducer,
      @Nonnull ThrowStatement node) {
        return reducer.reduceThrowStatement(node, () -> reduceExpression(reducer, node.expression));
    }

    @Nonnull
    public static  State reduceTryCatchStatement(
      @Nonnull ThunkedReducer reducer,
      @Nonnull TryCatchStatement node) {
        return reducer.reduceTryCatchStatement(node, () -> reduceBlock(reducer, node.body), () -> reduceCatchClause(reducer, node.catchClause));
    }

    @Nonnull
    public static  State reduceTryFinallyStatement(
      @Nonnull ThunkedReducer reducer,
      @Nonnull TryFinallyStatement node) {
        return reducer.reduceTryFinallyStatement(node, () -> reduceBlock(reducer, node.body), reduceMaybeCatchClause(reducer, node.catchClause), () -> reduceBlock(reducer, node.finalizer));
    }

    @Nonnull
    public static  State reduceUnaryExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull UnaryExpression node) {
        return reducer.reduceUnaryExpression(node, () -> reduceExpression(reducer, node.operand));
    }

    @Nonnull
    public static  State reduceUpdateExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull UpdateExpression node) {
        return reducer.reduceUpdateExpression(node, () -> reduceSimpleAssignmentTarget(reducer, node.operand));
    }

    @Nonnull
    public static  State reduceVariableDeclaration(
      @Nonnull ThunkedReducer reducer,
      @Nonnull VariableDeclaration node) {
        return reducer.reduceVariableDeclaration(node, reduceListVariableDeclarator(reducer, node.declarators));
    }

    @Nonnull
    public static  State reduceVariableDeclarationAssignmentTarget(
      @Nonnull ThunkedReducer reducer,
      @Nonnull VariableDeclarationAssignmentTarget node) {
        if (node instanceof VariableDeclaration) {
            return reduceVariableDeclaration(reducer, (VariableDeclaration) node);
        } else if (node instanceof AssignmentTarget) {
            return reduceAssignmentTarget(reducer, (AssignmentTarget) node);
        } else {
            throw new RuntimeException("Not reached");
        }
    }

    @Nonnull
    public static  State reduceVariableDeclarationExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull VariableDeclarationExpression node) {
        if (node instanceof VariableDeclaration) {
            return reduceVariableDeclaration(reducer, (VariableDeclaration) node);
        } else if (node instanceof Expression) {
            return reduceExpression(reducer, (Expression) node);
        } else {
            throw new RuntimeException("Not reached");
        }
    }

    @Nonnull
    public static  State reduceVariableDeclarationStatement(
      @Nonnull ThunkedReducer reducer,
      @Nonnull VariableDeclarationStatement node) {
        return reducer.reduceVariableDeclarationStatement(node, () -> reduceVariableDeclaration(reducer, node.declaration));
    }

    @Nonnull
    public static  State reduceVariableDeclarator(
      @Nonnull ThunkedReducer reducer,
      @Nonnull VariableDeclarator node) {
        return reducer.reduceVariableDeclarator(node, () -> reduceBinding(reducer, node.binding), reduceMaybeExpression(reducer, node.init));
    }

    @Nonnull
    public static  State reduceWhileStatement(
      @Nonnull ThunkedReducer reducer,
      @Nonnull WhileStatement node) {
        return reducer.reduceWhileStatement(node, () -> reduceExpression(reducer, node.test), () -> reduceStatement(reducer, node.body));
    }

    @Nonnull
    public static  State reduceWithStatement(
      @Nonnull ThunkedReducer reducer,
      @Nonnull WithStatement node) {
        return reducer.reduceWithStatement(node, () -> reduceExpression(reducer, node.object), () -> reduceStatement(reducer, node.body));
    }

    @Nonnull
    public static  State reduceYieldExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull YieldExpression node) {
        return reducer.reduceYieldExpression(node, reduceMaybeExpression(reducer, node.expression));
    }

    @Nonnull
    public static  State reduceYieldGeneratorExpression(
      @Nonnull ThunkedReducer reducer,
      @Nonnull YieldGeneratorExpression node) {
        return reducer.reduceYieldGeneratorExpression(node, () -> reduceExpression(reducer, node.expression));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy