blob: 9e8ae3fc6bbc1bd0819ed343b967399a43533d9f [file] [log] [blame]
// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// NOTE: THIS FILE IS GENERATED. DO NOT EDIT.
//
// Run 'dart pkg/front_end/tool/generate_ast_equivalence.dart' to update.
import 'package:kernel/ast.dart';
import 'package:kernel/src/printer.dart';
import 'union_find.dart';
part 'equivalence_helpers.dart';
/// Visitor that uses a EquivalenceStrategy to compute AST node equivalence.
///
/// The visitor hold a current state that collects found inequivalences and
/// current assumptions. The current state has two modes. In the asserting mode,
/// the default, inequivalences are registered when found. In the non-asserting
/// mode, inequivalences are _not_ registered. The latter is used to compute
/// equivalences in sandboxed state, for instance to determine which elements
/// to pair when checking equivalence of two sets.
class EquivalenceVisitor implements Visitor1<bool, Node> {
final EquivalenceStrategy strategy;
EquivalenceVisitor({this.strategy: const EquivalenceStrategy()});
@override
bool defaultNode(Node node, Node other) {
return false;
}
@override
bool defaultTreeNode(TreeNode node, Node other) {
return false;
}
@override
bool visitLibrary(Library node, Node other) {
return strategy.checkLibrary(this, node, other);
}
@override
bool visitTypedef(Typedef node, Node other) {
return strategy.checkTypedef(this, node, other);
}
@override
bool visitClass(Class node, Node other) {
return strategy.checkClass(this, node, other);
}
@override
bool visitExtension(Extension node, Node other) {
return strategy.checkExtension(this, node, other);
}
@override
bool defaultMember(Member node, Node other) {
return false;
}
@override
bool visitField(Field node, Node other) {
return strategy.checkField(this, node, other);
}
@override
bool visitConstructor(Constructor node, Node other) {
return strategy.checkConstructor(this, node, other);
}
@override
bool visitRedirectingFactory(RedirectingFactory node, Node other) {
return strategy.checkRedirectingFactory(this, node, other);
}
@override
bool visitProcedure(Procedure node, Node other) {
return strategy.checkProcedure(this, node, other);
}
@override
bool visitLibraryDependency(LibraryDependency node, Node other) {
return strategy.checkLibraryDependency(this, node, other);
}
@override
bool visitLibraryPart(LibraryPart node, Node other) {
return strategy.checkLibraryPart(this, node, other);
}
@override
bool visitCombinator(Combinator node, Node other) {
return strategy.checkCombinator(this, node, other);
}
@override
bool defaultInitializer(Initializer node, Node other) {
return false;
}
@override
bool visitInvalidInitializer(InvalidInitializer node, Node other) {
return strategy.checkInvalidInitializer(this, node, other);
}
@override
bool visitFieldInitializer(FieldInitializer node, Node other) {
return strategy.checkFieldInitializer(this, node, other);
}
@override
bool visitSuperInitializer(SuperInitializer node, Node other) {
return strategy.checkSuperInitializer(this, node, other);
}
@override
bool visitRedirectingInitializer(RedirectingInitializer node, Node other) {
return strategy.checkRedirectingInitializer(this, node, other);
}
@override
bool visitLocalInitializer(LocalInitializer node, Node other) {
return strategy.checkLocalInitializer(this, node, other);
}
@override
bool visitAssertInitializer(AssertInitializer node, Node other) {
return strategy.checkAssertInitializer(this, node, other);
}
@override
bool visitFunctionNode(FunctionNode node, Node other) {
return strategy.checkFunctionNode(this, node, other);
}
@override
bool defaultExpression(Expression node, Node other) {
return false;
}
@override
bool visitInvalidExpression(InvalidExpression node, Node other) {
return strategy.checkInvalidExpression(this, node, other);
}
@override
bool visitVariableGet(VariableGet node, Node other) {
return strategy.checkVariableGet(this, node, other);
}
@override
bool visitVariableSet(VariableSet node, Node other) {
return strategy.checkVariableSet(this, node, other);
}
@override
bool visitDynamicGet(DynamicGet node, Node other) {
return strategy.checkDynamicGet(this, node, other);
}
@override
bool visitInstanceGet(InstanceGet node, Node other) {
return strategy.checkInstanceGet(this, node, other);
}
@override
bool visitFunctionTearOff(FunctionTearOff node, Node other) {
return strategy.checkFunctionTearOff(this, node, other);
}
@override
bool visitInstanceTearOff(InstanceTearOff node, Node other) {
return strategy.checkInstanceTearOff(this, node, other);
}
@override
bool visitDynamicSet(DynamicSet node, Node other) {
return strategy.checkDynamicSet(this, node, other);
}
@override
bool visitInstanceSet(InstanceSet node, Node other) {
return strategy.checkInstanceSet(this, node, other);
}
@override
bool visitSuperPropertyGet(SuperPropertyGet node, Node other) {
return strategy.checkSuperPropertyGet(this, node, other);
}
@override
bool visitSuperPropertySet(SuperPropertySet node, Node other) {
return strategy.checkSuperPropertySet(this, node, other);
}
@override
bool visitStaticGet(StaticGet node, Node other) {
return strategy.checkStaticGet(this, node, other);
}
@override
bool visitStaticTearOff(StaticTearOff node, Node other) {
return strategy.checkStaticTearOff(this, node, other);
}
@override
bool visitStaticSet(StaticSet node, Node other) {
return strategy.checkStaticSet(this, node, other);
}
@override
bool visitDynamicInvocation(DynamicInvocation node, Node other) {
return strategy.checkDynamicInvocation(this, node, other);
}
@override
bool visitInstanceInvocation(InstanceInvocation node, Node other) {
return strategy.checkInstanceInvocation(this, node, other);
}
@override
bool visitInstanceGetterInvocation(
InstanceGetterInvocation node, Node other) {
return strategy.checkInstanceGetterInvocation(this, node, other);
}
@override
bool visitFunctionInvocation(FunctionInvocation node, Node other) {
return strategy.checkFunctionInvocation(this, node, other);
}
@override
bool visitLocalFunctionInvocation(LocalFunctionInvocation node, Node other) {
return strategy.checkLocalFunctionInvocation(this, node, other);
}
@override
bool visitSuperMethodInvocation(SuperMethodInvocation node, Node other) {
return strategy.checkSuperMethodInvocation(this, node, other);
}
@override
bool visitStaticInvocation(StaticInvocation node, Node other) {
return strategy.checkStaticInvocation(this, node, other);
}
@override
bool visitConstructorInvocation(ConstructorInvocation node, Node other) {
return strategy.checkConstructorInvocation(this, node, other);
}
@override
bool visitEqualsNull(EqualsNull node, Node other) {
return strategy.checkEqualsNull(this, node, other);
}
@override
bool visitEqualsCall(EqualsCall node, Node other) {
return strategy.checkEqualsCall(this, node, other);
}
@override
bool visitInstantiation(Instantiation node, Node other) {
return strategy.checkInstantiation(this, node, other);
}
@override
bool visitNot(Not node, Node other) {
return strategy.checkNot(this, node, other);
}
@override
bool visitLogicalExpression(LogicalExpression node, Node other) {
return strategy.checkLogicalExpression(this, node, other);
}
@override
bool visitConditionalExpression(ConditionalExpression node, Node other) {
return strategy.checkConditionalExpression(this, node, other);
}
@override
bool visitStringConcatenation(StringConcatenation node, Node other) {
return strategy.checkStringConcatenation(this, node, other);
}
@override
bool visitListConcatenation(ListConcatenation node, Node other) {
return strategy.checkListConcatenation(this, node, other);
}
@override
bool visitSetConcatenation(SetConcatenation node, Node other) {
return strategy.checkSetConcatenation(this, node, other);
}
@override
bool visitMapConcatenation(MapConcatenation node, Node other) {
return strategy.checkMapConcatenation(this, node, other);
}
@override
bool visitInstanceCreation(InstanceCreation node, Node other) {
return strategy.checkInstanceCreation(this, node, other);
}
@override
bool visitFileUriExpression(FileUriExpression node, Node other) {
return strategy.checkFileUriExpression(this, node, other);
}
@override
bool visitIsExpression(IsExpression node, Node other) {
return strategy.checkIsExpression(this, node, other);
}
@override
bool visitAsExpression(AsExpression node, Node other) {
return strategy.checkAsExpression(this, node, other);
}
@override
bool visitNullCheck(NullCheck node, Node other) {
return strategy.checkNullCheck(this, node, other);
}
@override
bool defaultBasicLiteral(BasicLiteral node, Node other) {
return false;
}
@override
bool visitStringLiteral(StringLiteral node, Node other) {
return strategy.checkStringLiteral(this, node, other);
}
@override
bool visitIntLiteral(IntLiteral node, Node other) {
return strategy.checkIntLiteral(this, node, other);
}
@override
bool visitDoubleLiteral(DoubleLiteral node, Node other) {
return strategy.checkDoubleLiteral(this, node, other);
}
@override
bool visitBoolLiteral(BoolLiteral node, Node other) {
return strategy.checkBoolLiteral(this, node, other);
}
@override
bool visitNullLiteral(NullLiteral node, Node other) {
return strategy.checkNullLiteral(this, node, other);
}
@override
bool visitSymbolLiteral(SymbolLiteral node, Node other) {
return strategy.checkSymbolLiteral(this, node, other);
}
@override
bool visitTypeLiteral(TypeLiteral node, Node other) {
return strategy.checkTypeLiteral(this, node, other);
}
@override
bool visitThisExpression(ThisExpression node, Node other) {
return strategy.checkThisExpression(this, node, other);
}
@override
bool visitRethrow(Rethrow node, Node other) {
return strategy.checkRethrow(this, node, other);
}
@override
bool visitThrow(Throw node, Node other) {
return strategy.checkThrow(this, node, other);
}
@override
bool visitListLiteral(ListLiteral node, Node other) {
return strategy.checkListLiteral(this, node, other);
}
@override
bool visitSetLiteral(SetLiteral node, Node other) {
return strategy.checkSetLiteral(this, node, other);
}
@override
bool visitMapLiteral(MapLiteral node, Node other) {
return strategy.checkMapLiteral(this, node, other);
}
@override
bool visitAwaitExpression(AwaitExpression node, Node other) {
return strategy.checkAwaitExpression(this, node, other);
}
@override
bool visitFunctionExpression(FunctionExpression node, Node other) {
return strategy.checkFunctionExpression(this, node, other);
}
@override
bool visitConstantExpression(ConstantExpression node, Node other) {
return strategy.checkConstantExpression(this, node, other);
}
@override
bool visitLet(Let node, Node other) {
return strategy.checkLet(this, node, other);
}
@override
bool visitBlockExpression(BlockExpression node, Node other) {
return strategy.checkBlockExpression(this, node, other);
}
@override
bool visitLoadLibrary(LoadLibrary node, Node other) {
return strategy.checkLoadLibrary(this, node, other);
}
@override
bool visitCheckLibraryIsLoaded(CheckLibraryIsLoaded node, Node other) {
return strategy.checkCheckLibraryIsLoaded(this, node, other);
}
@override
bool visitConstructorTearOff(ConstructorTearOff node, Node other) {
return strategy.checkConstructorTearOff(this, node, other);
}
@override
bool visitRedirectingFactoryTearOff(
RedirectingFactoryTearOff node, Node other) {
return strategy.checkRedirectingFactoryTearOff(this, node, other);
}
@override
bool visitTypedefTearOff(TypedefTearOff node, Node other) {
return strategy.checkTypedefTearOff(this, node, other);
}
@override
bool visitArguments(Arguments node, Node other) {
return strategy.checkArguments(this, node, other);
}
@override
bool visitNamedExpression(NamedExpression node, Node other) {
return strategy.checkNamedExpression(this, node, other);
}
@override
bool visitMapLiteralEntry(MapLiteralEntry node, Node other) {
return strategy.checkMapLiteralEntry(this, node, other);
}
@override
bool defaultStatement(Statement node, Node other) {
return false;
}
@override
bool visitExpressionStatement(ExpressionStatement node, Node other) {
return strategy.checkExpressionStatement(this, node, other);
}
@override
bool visitBlock(Block node, Node other) {
return strategy.checkBlock(this, node, other);
}
@override
bool visitAssertBlock(AssertBlock node, Node other) {
return strategy.checkAssertBlock(this, node, other);
}
@override
bool visitEmptyStatement(EmptyStatement node, Node other) {
return strategy.checkEmptyStatement(this, node, other);
}
@override
bool visitAssertStatement(AssertStatement node, Node other) {
return strategy.checkAssertStatement(this, node, other);
}
@override
bool visitLabeledStatement(LabeledStatement node, Node other) {
return strategy.checkLabeledStatement(this, node, other);
}
@override
bool visitBreakStatement(BreakStatement node, Node other) {
return strategy.checkBreakStatement(this, node, other);
}
@override
bool visitWhileStatement(WhileStatement node, Node other) {
return strategy.checkWhileStatement(this, node, other);
}
@override
bool visitDoStatement(DoStatement node, Node other) {
return strategy.checkDoStatement(this, node, other);
}
@override
bool visitForStatement(ForStatement node, Node other) {
return strategy.checkForStatement(this, node, other);
}
@override
bool visitForInStatement(ForInStatement node, Node other) {
return strategy.checkForInStatement(this, node, other);
}
@override
bool visitSwitchStatement(SwitchStatement node, Node other) {
return strategy.checkSwitchStatement(this, node, other);
}
@override
bool visitContinueSwitchStatement(ContinueSwitchStatement node, Node other) {
return strategy.checkContinueSwitchStatement(this, node, other);
}
@override
bool visitIfStatement(IfStatement node, Node other) {
return strategy.checkIfStatement(this, node, other);
}
@override
bool visitReturnStatement(ReturnStatement node, Node other) {
return strategy.checkReturnStatement(this, node, other);
}
@override
bool visitTryCatch(TryCatch node, Node other) {
return strategy.checkTryCatch(this, node, other);
}
@override
bool visitTryFinally(TryFinally node, Node other) {
return strategy.checkTryFinally(this, node, other);
}
@override
bool visitYieldStatement(YieldStatement node, Node other) {
return strategy.checkYieldStatement(this, node, other);
}
@override
bool visitVariableDeclaration(VariableDeclaration node, Node other) {
return strategy.checkVariableDeclaration(this, node, other);
}
@override
bool visitFunctionDeclaration(FunctionDeclaration node, Node other) {
return strategy.checkFunctionDeclaration(this, node, other);
}
@override
bool visitSwitchCase(SwitchCase node, Node other) {
return strategy.checkSwitchCase(this, node, other);
}
@override
bool visitCatch(Catch node, Node other) {
return strategy.checkCatch(this, node, other);
}
@override
bool visitTypeParameter(TypeParameter node, Node other) {
return strategy.checkTypeParameter(this, node, other);
}
@override
bool visitComponent(Component node, Node other) {
return strategy.checkComponent(this, node, other);
}
@override
bool visitName(Name node, Node other) {
return strategy.checkName(this, node, other);
}
@override
bool defaultDartType(DartType node, Node other) {
return false;
}
@override
bool visitInvalidType(InvalidType node, Node other) {
return strategy.checkInvalidType(this, node, other);
}
@override
bool visitDynamicType(DynamicType node, Node other) {
return strategy.checkDynamicType(this, node, other);
}
@override
bool visitVoidType(VoidType node, Node other) {
return strategy.checkVoidType(this, node, other);
}
@override
bool visitNeverType(NeverType node, Node other) {
return strategy.checkNeverType(this, node, other);
}
@override
bool visitNullType(NullType node, Node other) {
return strategy.checkNullType(this, node, other);
}
@override
bool visitInterfaceType(InterfaceType node, Node other) {
return strategy.checkInterfaceType(this, node, other);
}
@override
bool visitFunctionType(FunctionType node, Node other) {
return strategy.checkFunctionType(this, node, other);
}
@override
bool visitTypedefType(TypedefType node, Node other) {
return strategy.checkTypedefType(this, node, other);
}
@override
bool visitFutureOrType(FutureOrType node, Node other) {
return strategy.checkFutureOrType(this, node, other);
}
@override
bool visitExtensionType(ExtensionType node, Node other) {
return strategy.checkExtensionType(this, node, other);
}
@override
bool visitTypeParameterType(TypeParameterType node, Node other) {
return strategy.checkTypeParameterType(this, node, other);
}
@override
bool visitNamedType(NamedType node, Node other) {
return strategy.checkNamedType(this, node, other);
}
@override
bool visitSupertype(Supertype node, Node other) {
return strategy.checkSupertype(this, node, other);
}
@override
bool defaultConstant(Constant node, Node other) {
return false;
}
@override
bool visitNullConstant(NullConstant node, Node other) {
return strategy.checkNullConstant(this, node, other);
}
@override
bool visitBoolConstant(BoolConstant node, Node other) {
return strategy.checkBoolConstant(this, node, other);
}
@override
bool visitIntConstant(IntConstant node, Node other) {
return strategy.checkIntConstant(this, node, other);
}
@override
bool visitDoubleConstant(DoubleConstant node, Node other) {
return strategy.checkDoubleConstant(this, node, other);
}
@override
bool visitStringConstant(StringConstant node, Node other) {
return strategy.checkStringConstant(this, node, other);
}
@override
bool visitSymbolConstant(SymbolConstant node, Node other) {
return strategy.checkSymbolConstant(this, node, other);
}
@override
bool visitMapConstant(MapConstant node, Node other) {
return strategy.checkMapConstant(this, node, other);
}
@override
bool visitListConstant(ListConstant node, Node other) {
return strategy.checkListConstant(this, node, other);
}
@override
bool visitSetConstant(SetConstant node, Node other) {
return strategy.checkSetConstant(this, node, other);
}
@override
bool visitInstanceConstant(InstanceConstant node, Node other) {
return strategy.checkInstanceConstant(this, node, other);
}
@override
bool visitInstantiationConstant(InstantiationConstant node, Node other) {
return strategy.checkInstantiationConstant(this, node, other);
}
@override
bool visitStaticTearOffConstant(StaticTearOffConstant node, Node other) {
return strategy.checkStaticTearOffConstant(this, node, other);
}
@override
bool visitConstructorTearOffConstant(
ConstructorTearOffConstant node, Node other) {
return strategy.checkConstructorTearOffConstant(this, node, other);
}
@override
bool visitRedirectingFactoryTearOffConstant(
RedirectingFactoryTearOffConstant node, Node other) {
return strategy.checkRedirectingFactoryTearOffConstant(this, node, other);
}
@override
bool visitTypedefTearOffConstant(TypedefTearOffConstant node, Node other) {
return strategy.checkTypedefTearOffConstant(this, node, other);
}
@override
bool visitTypeLiteralConstant(TypeLiteralConstant node, Node other) {
return strategy.checkTypeLiteralConstant(this, node, other);
}
@override
bool visitUnevaluatedConstant(UnevaluatedConstant node, Node other) {
return strategy.checkUnevaluatedConstant(this, node, other);
}
@override
bool visitTypedefReference(Typedef node, Node other) {
return false;
}
@override
bool visitClassReference(Class node, Node other) {
return false;
}
@override
bool visitExtensionReference(Extension node, Node other) {
return false;
}
@override
bool defaultMemberReference(Member node, Node other) {
return false;
}
@override
bool visitFieldReference(Field node, Node other) {
return false;
}
@override
bool visitConstructorReference(Constructor node, Node other) {
return false;
}
@override
bool visitRedirectingFactoryReference(RedirectingFactory node, Node other) {
return false;
}
@override
bool visitProcedureReference(Procedure node, Node other) {
return false;
}
@override
bool defaultConstantReference(Constant node, Node other) {
return false;
}
@override
bool visitNullConstantReference(NullConstant node, Node other) {
return false;
}
@override
bool visitBoolConstantReference(BoolConstant node, Node other) {
return false;
}
@override
bool visitIntConstantReference(IntConstant node, Node other) {
return false;
}
@override
bool visitDoubleConstantReference(DoubleConstant node, Node other) {
return false;
}
@override
bool visitStringConstantReference(StringConstant node, Node other) {
return false;
}
@override
bool visitSymbolConstantReference(SymbolConstant node, Node other) {
return false;
}
@override
bool visitMapConstantReference(MapConstant node, Node other) {
return false;
}
@override
bool visitListConstantReference(ListConstant node, Node other) {
return false;
}
@override
bool visitSetConstantReference(SetConstant node, Node other) {
return false;
}
@override
bool visitInstanceConstantReference(InstanceConstant node, Node other) {
return false;
}
@override
bool visitInstantiationConstantReference(
InstantiationConstant node, Node other) {
return false;
}
@override
bool visitStaticTearOffConstantReference(
StaticTearOffConstant node, Node other) {
return false;
}
@override
bool visitConstructorTearOffConstantReference(
ConstructorTearOffConstant node, Node other) {
return false;
}
@override
bool visitRedirectingFactoryTearOffConstantReference(
RedirectingFactoryTearOffConstant node, Node other) {
return false;
}
@override
bool visitTypedefTearOffConstantReference(
TypedefTearOffConstant node, Node other) {
return false;
}
@override
bool visitTypeLiteralConstantReference(TypeLiteralConstant node, Node other) {
return false;
}
@override
bool visitUnevaluatedConstantReference(UnevaluatedConstant node, Node other) {
return false;
}
/// Returns `true` if [a] and [b] are identical or equal.
bool _checkValues<T>(T? a, T? b) {
return identical(a, b) || a == b;
}
/// Returns `true` if [a] and [b] are identical or equal and registers the
/// inequivalence otherwise.
bool checkValues<T>(T? a, T? b, String propertyName) {
bool result = _checkValues(a, b);
if (!result) {
registerInequivalence(
propertyName, 'Values ${a} and ${b} are not equivalent');
}
return result;
}
/// Returns `true` if [a] and [b] are identical or equal. Inequivalence is
/// _not_ registered.
bool matchValues<T>(T? a, T? b) {
return _checkValues(a, b);
}
/// Returns `true` if [a] and [b] are equivalent.
bool _checkNodes<T extends Node>(T? a, T? b) {
if (identical(a, b)) return true;
if (a == null || b == null) {
return false;
} else {
return a.accept1(this, b);
}
}
/// Returns `true` if [a] and [b] are equivalent, as defined by the current
/// strategy, and registers the inequivalence otherwise.
bool checkNodes<T extends Node>(T? a, T? b, [String propertyName = '']) {
_checkingState.pushPropertyState(propertyName);
bool result = _checkNodes(a, b);
_checkingState.popState();
if (!result) {
registerInequivalence(
propertyName, 'Inequivalent nodes\n1: ${a}\n2: ${b}');
}
return result;
}
/// Returns `true` if [a] and [b] are identical or equal. Inequivalence is
/// _not_ registered.
bool shallowMatchNodes<T extends Node>(T? a, T? b) {
return _checkValues(a, b);
}
/// Returns `true` if [a] and [b] are equivalent, as defined by the current
/// strategy. Inequivalence is _not_ registered.
bool deepMatchNodes<T extends Node>(T? a, T? b) {
CheckingState oldState = _checkingState;
_checkingState = _checkingState.toMatchingState();
bool result = checkNodes(a, b);
_checkingState = oldState;
return result;
}
/// Returns `true` if [a] and [b] are equivalent, either by existing
/// assumption or as defined by their corresponding canonical names.
/// Inequivalence is _not_ registered.
bool matchNamedNodes(NamedNode? a, NamedNode? b) {
return identical(a, b) ||
a == null ||
b == null ||
checkAssumedReferences(a.reference, b.reference) ||
new ReferenceName.fromNamedNode(a) ==
new ReferenceName.fromNamedNode(b);
}
/// Returns `true` if [a] and [b] are currently assumed to be equivalent.
bool checkAssumedReferences(Reference? a, Reference? b) {
return _checkingState.checkAssumedReferences(a, b);
}
/// Assume that [a] and [b] are equivalent, if possible.
///
/// Returns `true` if [a] and [b] could be assumed to be equivalent. This
/// would not be the case if [a] xor [b] is `null`.
bool assumeReferences(Reference? a, Reference? b) {
return _checkingState.assumeReferences(a, b);
}
/// Returns `true` if [a] and [b] are equivalent, either by existing
/// assumption or as defined by their corresponding canonical names.
/// Inequivalence is _not_ registered.
bool matchReferences(Reference? a, Reference? b) {
return identical(a, b) ||
checkAssumedReferences(a, b) ||
ReferenceName.fromReference(a) == ReferenceName.fromReference(b);
}
/// Returns `true` if [a] and [b] are equivalent, either by their
/// corresponding canonical names or by assumption. Inequivalence is _not_
/// registered.
bool _checkReferences(Reference? a, Reference? b) {
if (identical(a, b)) {
return true;
} else if (a == null || b == null) {
return false;
} else if (matchReferences(a, b)) {
return true;
} else if (checkAssumedReferences(a, b)) {
return true;
} else {
return false;
}
}
/// Returns `true` if [a] and [b] are equivalent, either by their
/// corresponding canonical names or by assumption. Inequivalence is _not_
/// registered.
bool deeplyMatchReferences(Reference? a, Reference? b) {
CheckingState oldState = _checkingState;
_checkingState = _checkingState.toMatchingState();
bool result = checkReferences(a, b);
_checkingState = oldState;
return result;
}
/// Returns `true` if [a] and [b] are equivalent, either by their
/// corresponding canonical names or by assumption, and registers the
/// inequivalence otherwise.
bool checkReferences(Reference? a, Reference? b, [String propertyName = '']) {
bool result = _checkReferences(a, b);
if (!result) {
registerInequivalence(
propertyName, 'Inequivalent references:\n1: ${a}\n2: ${b}');
}
return result;
}
/// Returns `true` if declarations [a] and [b] are currently assumed to be
/// equivalent.
bool checkAssumedDeclarations(dynamic a, dynamic b) {
return _checkingState.checkAssumedDeclarations(a, b);
}
/// Assume that [a] and [b] are equivalent, if possible.
///
/// Returns `true` if [a] and [b] could be assumed to be equivalent. This
/// would not be the case if [a] is already assumed to be equivalent to
/// another declaration.
bool assumeDeclarations(dynamic a, dynamic b) {
return _checkingState.assumeDeclarations(a, b);
}
bool matchDeclarations(dynamic a, dynamic b) {
if (a is LabeledStatement) {
return b is LabeledStatement;
}
if (a is VariableDeclaration) {
return b is VariableDeclaration && a.name == b.name;
}
if (a is SwitchCase) {
return b is SwitchCase;
}
if (a is TypeParameter) {
return b is TypeParameter && a.name == b.name;
}
return false;
}
bool _checkDeclarations(dynamic a, dynamic b) {
if (identical(a, b)) {
return true;
} else if (a == null || b == null) {
return false;
} else if (checkAssumedDeclarations(a, b)) {
return true;
} else if (matchDeclarations(a, b)) {
return assumeDeclarations(a, b);
} else {
return false;
}
}
bool deepMatchDeclarations(dynamic a, dynamic b) {
CheckingState oldState = _checkingState;
_checkingState = _checkingState.toMatchingState();
bool result = checkDeclarations(a, b);
_checkingState = oldState;
return result;
}
bool checkDeclarations(dynamic a, dynamic b, [String propertyName = '']) {
bool result = _checkDeclarations(a, b);
if (!result) {
result = assumeDeclarations(a, b);
}
if (!result) {
registerInequivalence(
propertyName, 'Declarations ${a} and ${b} are not equivalent');
}
return result;
}
/// Returns `true` if lists [a] and [b] are equivalent, using
/// [equivalentValues] to determine element-wise equivalence.
///
/// If run in a checking state, the [propertyName] is used for registering
/// inequivalences.
bool checkLists<E>(
List<E>? a, List<E>? b, bool Function(E?, E?, String) equivalentValues,
[String propertyName = '']) {
if (identical(a, b)) return true;
if (a == null || b == null) return false;
if (a.length != b.length) {
registerInequivalence(
'${propertyName}.length', 'Lists ${a} and ${b} are not equivalent');
return false;
}
for (int i = 0; i < a.length; i++) {
if (!equivalentValues(a[i], b[i], '${propertyName}[${i}]')) {
return false;
}
}
return true;
}
/// Returns `true` if lists [a] and [b] are equivalent, using
/// [equivalentValues] to determine element-wise equivalence.
///
/// Inequivalence is _not_ registered.
bool matchLists<E>(
List<E>? a, List<E>? b, bool Function(E?, E?, String) equivalentValues) {
CheckingState oldState = _checkingState;
_checkingState = _checkingState.toMatchingState();
bool result = checkLists(a, b, equivalentValues);
_checkingState = oldState;
return result;
}
/// Returns `true` if sets [a] and [b] are equivalent, using
/// [matchingValues] to determine which elements that should be checked for
/// element-wise equivalence using [equivalentValues].
///
/// If run in a checking state, the [propertyName] is used for registering
/// inequivalences.
bool checkSets<E>(Set<E>? a, Set<E>? b, bool Function(E?, E?) matchingValues,
bool Function(E?, E?, String) equivalentValues,
[String propertyName = '']) {
if (identical(a, b)) return true;
if (a == null || b == null) return false;
if (a.length != b.length) {
registerInequivalence(
'${propertyName}.length', 'Sets ${a} and ${b} are not equivalent');
return false;
}
b = b.toSet();
for (E aValue in a) {
bool hasFoundValue = false;
E? foundValue;
for (E bValue in b) {
if (matchingValues(aValue, bValue)) {
foundValue = bValue;
hasFoundValue = true;
if (!equivalentValues(aValue, bValue, '${propertyName}[${aValue}]')) {
registerInequivalence('${propertyName}[${aValue}]',
'Elements ${aValue} and ${bValue} are not equivalent');
return false;
}
break;
}
}
if (hasFoundValue) {
b.remove(foundValue);
} else {
registerInequivalence(
'${propertyName}[${aValue}]',
'Sets ${a} and ${b} are not equivalent, no equivalent value '
'found for $aValue');
return false;
}
}
return true;
}
/// Returns `true` if sets [a] and [b] are equivalent, using
/// [matchingValues] to determine which elements that should be checked for
/// element-wise equivalence using [equivalentValues].
///
/// Inequivalence is _not_registered.
bool matchSets<E>(Set<E>? a, Set<E>? b, bool Function(E?, E?) matchingValues,
bool Function(E?, E?, String) equivalentValues) {
CheckingState oldState = _checkingState;
_checkingState = _checkingState.toMatchingState();
bool result = checkSets(a, b, matchingValues, equivalentValues);
_checkingState = oldState;
return result;
}
/// Returns `true` if maps [a] and [b] are equivalent, using
/// [matchingKeys] to determine which entries that should be checked for
/// entry-wise equivalence using [equivalentKeys] and [equivalentValues] to
/// determine key and value equivalences, respectively.
///
/// If run in a checking state, the [propertyName] is used for registering
/// inequivalences.
bool checkMaps<K, V>(
Map<K, V>? a,
Map<K, V>? b,
bool Function(K?, K?) matchingKeys,
bool Function(K?, K?, String) equivalentKeys,
bool Function(V?, V?, String) equivalentValues,
[String propertyName = '']) {
if (identical(a, b)) return true;
if (a == null || b == null) return false;
if (a.length != b.length) {
registerInequivalence(
'${propertyName}.length', 'Maps ${a} and ${b} are not equivalent');
return false;
}
Set<K> bKeys = b.keys.toSet();
for (K aKey in a.keys) {
bool hasFoundKey = false;
K? foundKey;
for (K bKey in bKeys) {
if (matchingKeys(aKey, bKey)) {
foundKey = bKey;
hasFoundKey = true;
if (!equivalentKeys(aKey, bKey, '${propertyName}[${aKey}]')) {
registerInequivalence('${propertyName}[${aKey}]',
'Keys ${aKey} and ${bKey} are not equivalent');
return false;
}
break;
}
}
if (hasFoundKey) {
bKeys.remove(foundKey);
if (!equivalentValues(
a[aKey], b[foundKey], '${propertyName}[${aKey}]')) {
return false;
}
} else {
registerInequivalence(
'${propertyName}[${aKey}]',
'Maps ${a} and ${b} are not equivalent, no equivalent key '
'found for $aKey');
return false;
}
}
return true;
}
/// Returns `true` if maps [a] and [b] are equivalent, using
/// [matchingKeys] to determine which entries that should be checked for
/// entry-wise equivalence using [equivalentKeys] and [equivalentValues] to
/// determine key and value equivalences, respectively.
///
/// Inequivalence is _not_ registered.
bool matchMaps<K, V>(
Map<K, V>? a,
Map<K, V>? b,
bool Function(K?, K?) matchingKeys,
bool Function(K?, K?, String) equivalentKeys,
bool Function(V?, V?, String) equivalentValues) {
CheckingState oldState = _checkingState;
_checkingState = _checkingState.toMatchingState();
bool result =
checkMaps(a, b, matchingKeys, equivalentKeys, equivalentValues);
_checkingState = oldState;
return result;
}
/// The current state of the visitor.
///
/// This holds the current assumptions, found inequivalences, and whether
/// inequivalences are currently registered.
CheckingState _checkingState = new CheckingState();
/// Runs [f] in a new state that holds all current assumptions. If
/// [isAsserting] is `true`, inequivalences are registered. Returns the
/// collected inequivalences.
///
/// If [f] returns `false`, the returned result is marked as having
/// inequivalences even when non have being registered.
EquivalenceResult inSubState(bool Function() f, {bool isAsserting: false}) {
CheckingState _oldState = _checkingState;
_checkingState = _checkingState.createSubState(isAsserting: isAsserting);
bool hasInequivalences = f();
EquivalenceResult result =
_checkingState.toResult(hasInequivalences: hasInequivalences);
_checkingState = _oldState;
return result;
}
/// Registers that the visitor enters the property named [propertyName] and
/// the currently visited node.
void pushPropertyState(String propertyName) {
_checkingState.pushPropertyState(propertyName);
}
/// Registers that the visitor enters nodes [a] and [b].
void pushNodeState(Node a, Node b) {
_checkingState.pushNodeState(a, b);
}
/// Register that the visitor leave the current node or property.
void popState() {
_checkingState.popState();
}
/// Returns the value used as the result for property inequivalences.
///
/// When inequivalences are currently registered, this is `true`, so that the
/// visitor will continue find inequivalences that are not directly related.
///
/// An example is finding several child inequivalences on otherwise equivalent
/// nodes, like finding inequivalences deeply in the members of the second
/// library of a component even when inequivalences deeply in the members of
/// the first library. Had the return value been `false`, signaling that the
/// first libraries were inequivalent, which they technically are, given that
/// the contain inequivalent subnodes, the visitor would have stopped short in
/// checking the list of libraries, and the inequivalences in the second
/// library would not have been found.
///
/// When inequivalences are _not_ currently registered, i.e. we are only
/// interested in the true/false value of the equivalence test, `false` is
/// used as the result value to stop the equivalence checking short.
bool get resultOnInequivalence => _checkingState.resultOnInequivalence;
/// Registers an equivalence on the [propertyName] with a detailed description
/// in [message].
void registerInequivalence(String propertyName, String message) {
_checkingState.registerInequivalence(propertyName, message);
}
/// Returns the inequivalences found by the visitor.
EquivalenceResult toResult() => _checkingState.toResult();
}
/// Checks [a] and [b] be for equivalence using [strategy].
///
/// Returns an [EquivalenceResult] containing the found inequivalences.
EquivalenceResult checkEquivalence(Node a, Node b,
{EquivalenceStrategy strategy: const EquivalenceStrategy()}) {
EquivalenceVisitor visitor = new EquivalenceVisitor(strategy: strategy);
visitor.checkNodes(a, b, 'root');
return visitor.toResult();
}
/// Strategy used for determining equivalence of AST nodes.
///
/// The strategy has a method for determining the equivalence of each AST node
/// class, and a method for determining the equivalence of each property on each
/// AST node class.
///
/// The base implementation enforces a full structural equivalence.
///
/// Custom strategies can be made by extending this strategy and override
/// methods where exceptions to the structural equivalence are needed.
class EquivalenceStrategy {
const EquivalenceStrategy();
bool checkLibrary(EquivalenceVisitor visitor, Library? node, Object? other) {
if (identical(node, other)) return true;
if (node is! Library) return false;
if (other is! Library) return false;
if (!visitor.matchNamedNodes(node, other)) {
return false;
}
visitor.pushNodeState(node, other);
bool result = true;
if (!checkLibrary_importUri(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkLibrary_fileUri(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkLibrary_languageVersion(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkLibrary_flags(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkLibrary_name(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkLibrary_problemsAsJson(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkLibrary_annotations(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkLibrary_dependencies(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkLibrary_additionalExports(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkLibrary_parts(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkLibrary_typedefs(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkLibrary_classes(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkLibrary_extensions(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkLibrary_procedures(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkLibrary_fields(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkLibrary_reference(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkLibrary_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkTypedef(EquivalenceVisitor visitor, Typedef? node, Object? other) {
if (identical(node, other)) return true;
if (node is! Typedef) return false;
if (other is! Typedef) return false;
if (!visitor.matchNamedNodes(node, other)) {
return false;
}
visitor.pushNodeState(node, other);
bool result = true;
if (!checkTypedef_fileUri(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkTypedef_annotations(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkTypedef_name(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkTypedef_typeParameters(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkTypedef_type(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkTypedef_typeParametersOfFunctionType(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkTypedef_positionalParameters(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkTypedef_namedParameters(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkTypedef_reference(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkTypedef_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkClass(EquivalenceVisitor visitor, Class? node, Object? other) {
if (identical(node, other)) return true;
if (node is! Class) return false;
if (other is! Class) return false;
if (!visitor.matchNamedNodes(node, other)) {
return false;
}
visitor.pushNodeState(node, other);
bool result = true;
if (!checkClass_startFileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkClass_fileEndOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkClass_annotations(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkClass_name(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkClass_flags(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkClass_fileUri(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkClass_typeParameters(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkClass_supertype(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkClass_mixedInType(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkClass_implementedTypes(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkClass_fields(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkClass_constructors(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkClass_procedures(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkClass_redirectingFactories(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkClass_reference(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkClass_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkExtensionTypeShowHideClause(EquivalenceVisitor visitor,
ExtensionTypeShowHideClause? node, Object? other) {
if (identical(node, other)) return true;
if (node is! ExtensionTypeShowHideClause) return false;
if (other is! ExtensionTypeShowHideClause) return false;
bool result = true;
if (!checkExtensionTypeShowHideClause_shownSupertypes(
visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkExtensionTypeShowHideClause_shownMethods(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkExtensionTypeShowHideClause_shownGetters(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkExtensionTypeShowHideClause_shownSetters(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkExtensionTypeShowHideClause_shownOperators(
visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkExtensionTypeShowHideClause_hiddenSupertypes(
visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkExtensionTypeShowHideClause_hiddenMethods(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkExtensionTypeShowHideClause_hiddenGetters(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkExtensionTypeShowHideClause_hiddenSetters(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkExtensionTypeShowHideClause_hiddenOperators(
visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
return result;
}
bool checkExtensionMemberDescriptor(EquivalenceVisitor visitor,
ExtensionMemberDescriptor? node, Object? other) {
if (identical(node, other)) return true;
if (node is! ExtensionMemberDescriptor) return false;
if (other is! ExtensionMemberDescriptor) return false;
bool result = true;
if (!checkExtensionMemberDescriptor_name(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkExtensionMemberDescriptor_kind(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkExtensionMemberDescriptor_flags(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkExtensionMemberDescriptor_member(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
return result;
}
bool checkExtension(
EquivalenceVisitor visitor, Extension? node, Object? other) {
if (identical(node, other)) return true;
if (node is! Extension) return false;
if (other is! Extension) return false;
if (!visitor.matchNamedNodes(node, other)) {
return false;
}
visitor.pushNodeState(node, other);
bool result = true;
if (!checkExtension_name(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkExtension_fileUri(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkExtension_typeParameters(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkExtension_onType(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkExtension_showHideClause(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkExtension_members(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkExtension_annotations(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkExtension_flags(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkExtension_reference(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkExtension_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkField(EquivalenceVisitor visitor, Field? node, Object? other) {
if (identical(node, other)) return true;
if (node is! Field) return false;
if (other is! Field) return false;
if (!visitor.matchNamedNodes(node, other)) {
return false;
}
visitor.pushNodeState(node, other);
bool result = true;
if (!checkField_type(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkField_flags(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkField_initializer(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkField_getterReference(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkField_setterReference(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkField_fileEndOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkField_annotations(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkField_name(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkField_fileUri(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkField_transformerFlags(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkField_fieldReference(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkField_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkConstructor(
EquivalenceVisitor visitor, Constructor? node, Object? other) {
if (identical(node, other)) return true;
if (node is! Constructor) return false;
if (other is! Constructor) return false;
if (!visitor.matchNamedNodes(node, other)) {
return false;
}
visitor.pushNodeState(node, other);
bool result = true;
if (!checkConstructor_startFileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkConstructor_flags(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkConstructor_function(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkConstructor_initializers(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkConstructor_fileEndOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkConstructor_annotations(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkConstructor_name(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkConstructor_fileUri(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkConstructor_transformerFlags(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkConstructor_reference(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkConstructor_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkRedirectingFactory(
EquivalenceVisitor visitor, RedirectingFactory? node, Object? other) {
if (identical(node, other)) return true;
if (node is! RedirectingFactory) return false;
if (other is! RedirectingFactory) return false;
if (!visitor.matchNamedNodes(node, other)) {
return false;
}
visitor.pushNodeState(node, other);
bool result = true;
if (!checkRedirectingFactory_flags(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkRedirectingFactory_typeArguments(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkRedirectingFactory_targetReference(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkRedirectingFactory_function(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkRedirectingFactory_fileEndOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkRedirectingFactory_annotations(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkRedirectingFactory_name(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkRedirectingFactory_fileUri(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkRedirectingFactory_transformerFlags(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkRedirectingFactory_reference(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkRedirectingFactory_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkProcedure(
EquivalenceVisitor visitor, Procedure? node, Object? other) {
if (identical(node, other)) return true;
if (node is! Procedure) return false;
if (other is! Procedure) return false;
if (!visitor.matchNamedNodes(node, other)) {
return false;
}
visitor.pushNodeState(node, other);
bool result = true;
if (!checkProcedure_startFileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkProcedure_kind(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkProcedure_flags(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkProcedure_function(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkProcedure_stubKind(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkProcedure_stubTargetReference(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkProcedure_signatureType(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkProcedure_fileEndOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkProcedure_annotations(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkProcedure_name(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkProcedure_fileUri(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkProcedure_transformerFlags(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkProcedure_reference(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkProcedure_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkLibraryDependency(
EquivalenceVisitor visitor, LibraryDependency? node, Object? other) {
if (identical(node, other)) return true;
if (node is! LibraryDependency) return false;
if (other is! LibraryDependency) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkLibraryDependency_flags(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkLibraryDependency_annotations(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkLibraryDependency_importedLibraryReference(
visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkLibraryDependency_name(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkLibraryDependency_combinators(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkLibraryDependency_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkLibraryPart(
EquivalenceVisitor visitor, LibraryPart? node, Object? other) {
if (identical(node, other)) return true;
if (node is! LibraryPart) return false;
if (other is! LibraryPart) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkLibraryPart_annotations(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkLibraryPart_partUri(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkLibraryPart_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkCombinator(
EquivalenceVisitor visitor, Combinator? node, Object? other) {
if (identical(node, other)) return true;
if (node is! Combinator) return false;
if (other is! Combinator) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkCombinator_isShow(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkCombinator_names(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkCombinator_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkInvalidInitializer(
EquivalenceVisitor visitor, InvalidInitializer? node, Object? other) {
if (identical(node, other)) return true;
if (node is! InvalidInitializer) return false;
if (other is! InvalidInitializer) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkInvalidInitializer_isSynthetic(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkInvalidInitializer_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkFieldInitializer(
EquivalenceVisitor visitor, FieldInitializer? node, Object? other) {
if (identical(node, other)) return true;
if (node is! FieldInitializer) return false;
if (other is! FieldInitializer) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkFieldInitializer_fieldReference(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkFieldInitializer_value(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkFieldInitializer_isSynthetic(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkFieldInitializer_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkSuperInitializer(
EquivalenceVisitor visitor, SuperInitializer? node, Object? other) {
if (identical(node, other)) return true;
if (node is! SuperInitializer) return false;
if (other is! SuperInitializer) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkSuperInitializer_targetReference(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkSuperInitializer_arguments(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkSuperInitializer_isSynthetic(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkSuperInitializer_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkRedirectingInitializer(
EquivalenceVisitor visitor, RedirectingInitializer? node, Object? other) {
if (identical(node, other)) return true;
if (node is! RedirectingInitializer) return false;
if (other is! RedirectingInitializer) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkRedirectingInitializer_targetReference(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkRedirectingInitializer_arguments(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkRedirectingInitializer_isSynthetic(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkRedirectingInitializer_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkLocalInitializer(
EquivalenceVisitor visitor, LocalInitializer? node, Object? other) {
if (identical(node, other)) return true;
if (node is! LocalInitializer) return false;
if (other is! LocalInitializer) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkLocalInitializer_variable(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkLocalInitializer_isSynthetic(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkLocalInitializer_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkAssertInitializer(
EquivalenceVisitor visitor, AssertInitializer? node, Object? other) {
if (identical(node, other)) return true;
if (node is! AssertInitializer) return false;
if (other is! AssertInitializer) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkAssertInitializer_statement(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkAssertInitializer_isSynthetic(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkAssertInitializer_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkFunctionNode(
EquivalenceVisitor visitor, FunctionNode? node, Object? other) {
if (identical(node, other)) return true;
if (node is! FunctionNode) return false;
if (other is! FunctionNode) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkFunctionNode_fileEndOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkFunctionNode_asyncMarker(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkFunctionNode_dartAsyncMarker(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkFunctionNode_typeParameters(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkFunctionNode_requiredParameterCount(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkFunctionNode_positionalParameters(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkFunctionNode_namedParameters(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkFunctionNode_returnType(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkFunctionNode_body(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkFunctionNode_futureValueType(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkFunctionNode_lazyBuilder(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkFunctionNode_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkInvalidExpression(
EquivalenceVisitor visitor, InvalidExpression? node, Object? other) {
if (identical(node, other)) return true;
if (node is! InvalidExpression) return false;
if (other is! InvalidExpression) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkInvalidExpression_message(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkInvalidExpression_expression(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkInvalidExpression_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkVariableGet(
EquivalenceVisitor visitor, VariableGet? node, Object? other) {
if (identical(node, other)) return true;
if (node is! VariableGet) return false;
if (other is! VariableGet) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkVariableGet_variable(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkVariableGet_promotedType(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkVariableGet_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkVariableSet(
EquivalenceVisitor visitor, VariableSet? node, Object? other) {
if (identical(node, other)) return true;
if (node is! VariableSet) return false;
if (other is! VariableSet) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkVariableSet_variable(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkVariableSet_value(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkVariableSet_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkDynamicGet(
EquivalenceVisitor visitor, DynamicGet? node, Object? other) {
if (identical(node, other)) return true;
if (node is! DynamicGet) return false;
if (other is! DynamicGet) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkDynamicGet_kind(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkDynamicGet_receiver(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkDynamicGet_name(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkDynamicGet_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkInstanceGet(
EquivalenceVisitor visitor, InstanceGet? node, Object? other) {
if (identical(node, other)) return true;
if (node is! InstanceGet) return false;
if (other is! InstanceGet) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkInstanceGet_kind(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkInstanceGet_receiver(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkInstanceGet_name(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkInstanceGet_resultType(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkInstanceGet_interfaceTargetReference(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkInstanceGet_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkFunctionTearOff(
EquivalenceVisitor visitor, FunctionTearOff? node, Object? other) {
if (identical(node, other)) return true;
if (node is! FunctionTearOff) return false;
if (other is! FunctionTearOff) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkFunctionTearOff_receiver(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkFunctionTearOff_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkInstanceTearOff(
EquivalenceVisitor visitor, InstanceTearOff? node, Object? other) {
if (identical(node, other)) return true;
if (node is! InstanceTearOff) return false;
if (other is! InstanceTearOff) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkInstanceTearOff_kind(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkInstanceTearOff_receiver(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkInstanceTearOff_name(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkInstanceTearOff_resultType(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkInstanceTearOff_interfaceTargetReference(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkInstanceTearOff_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkDynamicSet(
EquivalenceVisitor visitor, DynamicSet? node, Object? other) {
if (identical(node, other)) return true;
if (node is! DynamicSet) return false;
if (other is! DynamicSet) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkDynamicSet_kind(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkDynamicSet_receiver(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkDynamicSet_name(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkDynamicSet_value(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkDynamicSet_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkInstanceSet(
EquivalenceVisitor visitor, InstanceSet? node, Object? other) {
if (identical(node, other)) return true;
if (node is! InstanceSet) return false;
if (other is! InstanceSet) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkInstanceSet_kind(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkInstanceSet_receiver(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkInstanceSet_name(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkInstanceSet_value(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkInstanceSet_interfaceTargetReference(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkInstanceSet_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkSuperPropertyGet(
EquivalenceVisitor visitor, SuperPropertyGet? node, Object? other) {
if (identical(node, other)) return true;
if (node is! SuperPropertyGet) return false;
if (other is! SuperPropertyGet) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkSuperPropertyGet_name(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkSuperPropertyGet_interfaceTargetReference(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkSuperPropertyGet_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkSuperPropertySet(
EquivalenceVisitor visitor, SuperPropertySet? node, Object? other) {
if (identical(node, other)) return true;
if (node is! SuperPropertySet) return false;
if (other is! SuperPropertySet) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkSuperPropertySet_name(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkSuperPropertySet_value(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkSuperPropertySet_interfaceTargetReference(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkSuperPropertySet_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkStaticGet(
EquivalenceVisitor visitor, StaticGet? node, Object? other) {
if (identical(node, other)) return true;
if (node is! StaticGet) return false;
if (other is! StaticGet) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkStaticGet_targetReference(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkStaticGet_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkStaticTearOff(
EquivalenceVisitor visitor, StaticTearOff? node, Object? other) {
if (identical(node, other)) return true;
if (node is! StaticTearOff) return false;
if (other is! StaticTearOff) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkStaticTearOff_targetReference(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkStaticTearOff_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkStaticSet(
EquivalenceVisitor visitor, StaticSet? node, Object? other) {
if (identical(node, other)) return true;
if (node is! StaticSet) return false;
if (other is! StaticSet) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkStaticSet_targetReference(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkStaticSet_value(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkStaticSet_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkDynamicInvocation(
EquivalenceVisitor visitor, DynamicInvocation? node, Object? other) {
if (identical(node, other)) return true;
if (node is! DynamicInvocation) return false;
if (other is! DynamicInvocation) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkDynamicInvocation_kind(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkDynamicInvocation_receiver(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkDynamicInvocation_name(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkDynamicInvocation_arguments(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkDynamicInvocation_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkInstanceInvocation(
EquivalenceVisitor visitor, InstanceInvocation? node, Object? other) {
if (identical(node, other)) return true;
if (node is! InstanceInvocation) return false;
if (other is! InstanceInvocation) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkInstanceInvocation_kind(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkInstanceInvocation_receiver(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkInstanceInvocation_name(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkInstanceInvocation_arguments(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkInstanceInvocation_flags(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkInstanceInvocation_functionType(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkInstanceInvocation_interfaceTargetReference(
visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkInstanceInvocation_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkInstanceGetterInvocation(EquivalenceVisitor visitor,
InstanceGetterInvocation? node, Object? other) {
if (identical(node, other)) return true;
if (node is! InstanceGetterInvocation) return false;
if (other is! InstanceGetterInvocation) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkInstanceGetterInvocation_kind(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkInstanceGetterInvocation_receiver(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkInstanceGetterInvocation_name(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkInstanceGetterInvocation_arguments(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkInstanceGetterInvocation_flags(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkInstanceGetterInvocation_functionType(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkInstanceGetterInvocation_interfaceTargetReference(
visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkInstanceGetterInvocation_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkFunctionInvocation(
EquivalenceVisitor visitor, FunctionInvocation? node, Object? other) {
if (identical(node, other)) return true;
if (node is! FunctionInvocation) return false;
if (other is! FunctionInvocation) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkFunctionInvocation_kind(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkFunctionInvocation_receiver(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkFunctionInvocation_arguments(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkFunctionInvocation_functionType(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkFunctionInvocation_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkLocalFunctionInvocation(EquivalenceVisitor visitor,
LocalFunctionInvocation? node, Object? other) {
if (identical(node, other)) return true;
if (node is! LocalFunctionInvocation) return false;
if (other is! LocalFunctionInvocation) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkLocalFunctionInvocation_variable(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkLocalFunctionInvocation_arguments(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkLocalFunctionInvocation_functionType(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkLocalFunctionInvocation_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkSuperMethodInvocation(
EquivalenceVisitor visitor, SuperMethodInvocation? node, Object? other) {
if (identical(node, other)) return true;
if (node is! SuperMethodInvocation) return false;
if (other is! SuperMethodInvocation) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkSuperMethodInvocation_name(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkSuperMethodInvocation_arguments(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkSuperMethodInvocation_interfaceTargetReference(
visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkSuperMethodInvocation_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkStaticInvocation(
EquivalenceVisitor visitor, StaticInvocation? node, Object? other) {
if (identical(node, other)) return true;
if (node is! StaticInvocation) return false;
if (other is! StaticInvocation) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkStaticInvocation_targetReference(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkStaticInvocation_arguments(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkStaticInvocation_isConst(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkStaticInvocation_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkConstructorInvocation(
EquivalenceVisitor visitor, ConstructorInvocation? node, Object? other) {
if (identical(node, other)) return true;
if (node is! ConstructorInvocation) return false;
if (other is! ConstructorInvocation) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkConstructorInvocation_targetReference(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkConstructorInvocation_arguments(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkConstructorInvocation_isConst(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkConstructorInvocation_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkEqualsNull(
EquivalenceVisitor visitor, EqualsNull? node, Object? other) {
if (identical(node, other)) return true;
if (node is! EqualsNull) return false;
if (other is! EqualsNull) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkEqualsNull_expression(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkEqualsNull_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkEqualsCall(
EquivalenceVisitor visitor, EqualsCall? node, Object? other) {
if (identical(node, other)) return true;
if (node is! EqualsCall) return false;
if (other is! EqualsCall) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkEqualsCall_left(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkEqualsCall_right(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkEqualsCall_functionType(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkEqualsCall_interfaceTargetReference(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkEqualsCall_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkInstantiation(
EquivalenceVisitor visitor, Instantiation? node, Object? other) {
if (identical(node, other)) return true;
if (node is! Instantiation) return false;
if (other is! Instantiation) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkInstantiation_expression(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkInstantiation_typeArguments(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkInstantiation_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkNot(EquivalenceVisitor visitor, Not? node, Object? other) {
if (identical(node, other)) return true;
if (node is! Not) return false;
if (other is! Not) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkNot_operand(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkNot_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkLogicalExpression(
EquivalenceVisitor visitor, LogicalExpression? node, Object? other) {
if (identical(node, other)) return true;
if (node is! LogicalExpression) return false;
if (other is! LogicalExpression) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkLogicalExpression_left(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkLogicalExpression_operatorEnum(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkLogicalExpression_right(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkLogicalExpression_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkConditionalExpression(
EquivalenceVisitor visitor, ConditionalExpression? node, Object? other) {
if (identical(node, other)) return true;
if (node is! ConditionalExpression) return false;
if (other is! ConditionalExpression) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkConditionalExpression_condition(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkConditionalExpression_then(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkConditionalExpression_otherwise(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkConditionalExpression_staticType(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkConditionalExpression_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkStringConcatenation(
EquivalenceVisitor visitor, StringConcatenation? node, Object? other) {
if (identical(node, other)) return true;
if (node is! StringConcatenation) return false;
if (other is! StringConcatenation) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkStringConcatenation_expressions(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkStringConcatenation_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkListConcatenation(
EquivalenceVisitor visitor, ListConcatenation? node, Object? other) {
if (identical(node, other)) return true;
if (node is! ListConcatenation) return false;
if (other is! ListConcatenation) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkListConcatenation_typeArgument(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkListConcatenation_lists(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkListConcatenation_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkSetConcatenation(
EquivalenceVisitor visitor, SetConcatenation? node, Object? other) {
if (identical(node, other)) return true;
if (node is! SetConcatenation) return false;
if (other is! SetConcatenation) return false;
visitor.pushNodeState(node, other);
bool result = true;
if (!checkSetConcatenation_typeArgument(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkSetConcatenation_sets(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
if (!checkSetConcatenation_fileOffset(visitor, node, other)) {
result = visitor.resultOnInequivalence;
}
visitor.popState();
return result;
}
bool checkMapConcatenation(
EquivalenceVisitor visitor, MapConcatenation? node, Object? other) {
if (identical(node, other)) return true;
if (node is! MapConcat