blob: d46a6ef8c55c932833b4f22d53b8ff47d250b281 [file] [log] [blame]
// Copyright (c) 2015, 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.
part of dart2js.semantics_visitor;
/// Interface for bulk handling of a [Node] in a semantic visitor.
abstract class BulkHandle<R, A> {
/// Handle [node] either regardless of semantics or to report that [node] is
/// unhandled. [message] contains a message template for the latter case:
/// Replace '#' in [message] by `node.toString()` to create a message for the
/// error.
R bulkHandleNode(Node node, String message, A arg);
}
/// Mixin that implements all `errorX` methods of [SemanticSendVisitor] by
/// delegating to a bulk handler.
///
/// Use this mixin to provide a trivial implementation for all `errorX` methods.
abstract class ErrorBulkMixin<R, A>
implements SemanticSendVisitor<R, A>, BulkHandle<R, A> {
// TODO(johnniwinther): Ensure that all error methods have an
// [ErroneousElement].
R bulkHandleError(Node node, ErroneousElement error, A arg) {
return bulkHandleNode(node, "Error expression `#` unhandled.", arg);
}
@override
R errorNonConstantConstructorInvoke(
NewExpression node,
Element element,
ResolutionDartType type,
NodeList arguments,
CallStructure callStructure,
A arg) {
return bulkHandleError(node, null, arg);
}
@override
R errorUndefinedUnaryExpression(
Send node, Operator operator, Node expression, A arg) {
return bulkHandleError(node, null, arg);
}
@override
R errorUndefinedBinaryExpression(
Send node, Node left, Operator operator, Node right, A arg) {
return bulkHandleError(node, null, arg);
}
@override
R errorInvalidCompound(Send node, ErroneousElement error,
AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleError(node, error, arg);
}
@override
R errorInvalidGet(Send node, ErroneousElement error, A arg) {
return bulkHandleError(node, error, arg);
}
@override
R errorInvalidInvoke(Send node, ErroneousElement error, NodeList arguments,
Selector selector, A arg) {
return bulkHandleError(node, error, arg);
}
@override
R errorInvalidPostfix(
Send node, ErroneousElement error, IncDecOperator operator, A arg) {
return bulkHandleError(node, error, arg);
}
@override
R errorInvalidPrefix(
Send node, ErroneousElement error, IncDecOperator operator, A arg) {
return bulkHandleError(node, error, arg);
}
@override
R errorInvalidSet(Send node, ErroneousElement error, Node rhs, A arg) {
return bulkHandleError(node, error, arg);
}
@override
R errorInvalidUnary(
Send node, UnaryOperator operator, ErroneousElement error, A arg) {
return bulkHandleError(node, error, arg);
}
@override
R errorInvalidEquals(Send node, ErroneousElement error, Node right, A arg) {
return bulkHandleError(node, error, arg);
}
@override
R errorInvalidNotEquals(
Send node, ErroneousElement error, Node right, A arg) {
return bulkHandleError(node, error, arg);
}
@override
R errorInvalidBinary(Send node, ErroneousElement error,
BinaryOperator operator, Node right, A arg) {
return bulkHandleError(node, error, arg);
}
@override
R errorInvalidIndex(Send node, ErroneousElement error, Node index, A arg) {
return bulkHandleError(node, error, arg);
}
@override
R errorInvalidIndexSet(
Send node, ErroneousElement error, Node index, Node rhs, A arg) {
return bulkHandleError(node, error, arg);
}
@override
R errorInvalidCompoundIndexSet(Send node, ErroneousElement error, Node index,
AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleError(node, error, arg);
}
@override
R errorInvalidIndexSetIfNull(
SendSet node, ErroneousElement error, Node index, Node rhs, A arg) {
return bulkHandleError(node, error, arg);
}
@override
R errorInvalidIndexPrefix(Send node, ErroneousElement error, Node index,
IncDecOperator operator, A arg) {
return bulkHandleError(node, error, arg);
}
@override
R errorInvalidIndexPostfix(Send node, ErroneousElement error, Node index,
IncDecOperator operator, A arg) {
return bulkHandleError(node, error, arg);
}
@override
R errorInvalidSetIfNull(Send node, ErroneousElement error, Node rhs, A arg) {
return bulkHandleError(node, error, arg);
}
}
/// Mixin that implements all `visitXPrefix` methods of [SemanticSendVisitor] by
/// delegating to a bulk handler.
///
/// Use this mixin to provide a trivial implementation for all `visitXPrefix`
/// methods.
abstract class PrefixBulkMixin<R, A>
implements SemanticSendVisitor<R, A>, BulkHandle<R, A> {
R bulkHandlePrefix(Send node, A arg) {
return bulkHandleNode(node, "Prefix expression `#` unhandled.", arg);
}
@override
R visitDynamicPropertyPrefix(
Send node, Node receiver, Name name, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
R visitIfNotNullDynamicPropertyPrefix(
Send node, Node receiver, Name name, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitIndexPrefix(
Send node, Node receiver, Node index, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitLocalVariablePrefix(Send node, LocalVariableElement variable,
IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitParameterPrefix(
Send node, ParameterElement parameter, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitStaticFieldPrefix(
Send node, FieldElement field, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitStaticGetterSetterPrefix(Send node, FunctionElement getter,
FunctionElement setter, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitStaticMethodSetterPrefix(Send node, FunctionElement getter,
FunctionElement setter, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitSuperFieldFieldPrefix(Send node, FieldElement readField,
FieldElement writtenField, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitSuperFieldPrefix(
Send node, FieldElement field, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitSuperFieldSetterPrefix(Send node, FieldElement field,
FunctionElement setter, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitSuperGetterFieldPrefix(Send node, FunctionElement getter,
FieldElement field, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitSuperGetterSetterPrefix(Send node, FunctionElement getter,
FunctionElement setter, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitSuperIndexPrefix(
Send node,
FunctionElement indexFunction,
FunctionElement indexSetFunction,
Node index,
IncDecOperator operator,
A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitUnresolvedSuperGetterIndexPrefix(Send node, Element element,
MethodElement setter, Node index, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitUnresolvedSuperSetterIndexPrefix(Send node, MethodElement getter,
Element element, Node index, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitUnresolvedSuperIndexPrefix(
Send node, Element element, Node index, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitSuperMethodSetterPrefix(Send node, FunctionElement method,
FunctionElement setter, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitThisPropertyPrefix(
Send node, Name name, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitTopLevelFieldPrefix(
Send node, FieldElement field, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitTopLevelGetterSetterPrefix(Send node, FunctionElement getter,
FunctionElement setter, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitTopLevelMethodSetterPrefix(Send node, FunctionElement method,
FunctionElement setter, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitClassTypeLiteralPrefix(
Send node, ConstantExpression constant, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitDynamicTypeLiteralPrefix(
Send node, ConstantExpression constant, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitLocalFunctionPrefix(Send node, LocalFunctionElement function,
IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitTypeVariableTypeLiteralPrefix(
Send node, TypeVariableElement element, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitTypedefTypeLiteralPrefix(
Send node, ConstantExpression constant, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitUnresolvedStaticGetterPrefix(Send node, Element element,
MethodElement setter, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitUnresolvedTopLevelGetterPrefix(Send node, Element element,
MethodElement setter, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitUnresolvedStaticSetterPrefix(Send node, MethodElement getter,
Element element, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitUnresolvedTopLevelSetterPrefix(Send node, MethodElement getter,
Element element, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitStaticMethodPrefix(
Send node, MethodElement method, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitTopLevelMethodPrefix(
Send node, MethodElement method, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitUnresolvedPrefix(
Send node, Element element, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitFinalLocalVariablePrefix(Send node, LocalVariableElement variable,
IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitFinalParameterPrefix(
Send node, ParameterElement parameter, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitFinalStaticFieldPrefix(
Send node, FieldElement field, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitFinalSuperFieldPrefix(
Send node, FieldElement field, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitSuperMethodPrefix(
Send node, FunctionElement method, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitFinalTopLevelFieldPrefix(
Send node, FieldElement field, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitUnresolvedSuperPrefix(
Send node, Element element, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitUnresolvedSuperGetterPrefix(Send node, Element element,
MethodElement setter, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
@override
R visitUnresolvedSuperSetterPrefix(Send node, MethodElement getter,
Element element, IncDecOperator operator, A arg) {
return bulkHandlePrefix(node, arg);
}
}
/// Mixin that implements all `visitXPostfix` methods of [SemanticSendVisitor]
/// by delegating to a bulk handler.
///
/// Use this mixin to provide a trivial implementation for all `visitXPostfix`
/// methods.
abstract class PostfixBulkMixin<R, A>
implements SemanticSendVisitor<R, A>, BulkHandle<R, A> {
R bulkHandlePostfix(Send node, A arg) {
return bulkHandleNode(node, "Postfix expression `#` unhandled.", arg);
}
@override
R visitDynamicPropertyPostfix(
Send node, Node receiver, Name name, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitIfNotNullDynamicPropertyPostfix(
Send node, Node receiver, Name name, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
R visitIndexPostfix(
Send node, Node receiver, Node index, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitLocalVariablePostfix(Send node, LocalVariableElement variable,
IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitParameterPostfix(
Send node, ParameterElement parameter, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitStaticFieldPostfix(
Send node, FieldElement field, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitStaticGetterSetterPostfix(Send node, FunctionElement getter,
FunctionElement setter, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitStaticMethodSetterPostfix(Send node, FunctionElement getter,
FunctionElement setter, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitSuperFieldFieldPostfix(Send node, FieldElement readField,
FieldElement writtenField, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitSuperFieldPostfix(
Send node, FieldElement field, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitSuperFieldSetterPostfix(Send node, FieldElement field,
FunctionElement setter, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitSuperGetterFieldPostfix(Send node, FunctionElement getter,
FieldElement field, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitSuperGetterSetterPostfix(Send node, FunctionElement getter,
FunctionElement setter, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitSuperIndexPostfix(
Send node,
FunctionElement indexFunction,
FunctionElement indexSetFunction,
Node index,
IncDecOperator operator,
A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitUnresolvedSuperGetterIndexPostfix(Send node, Element element,
MethodElement setter, Node index, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitUnresolvedSuperSetterIndexPostfix(Send node, MethodElement getter,
Element element, Node index, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitUnresolvedSuperIndexPostfix(
Send node, Element element, Node index, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitSuperMethodSetterPostfix(Send node, FunctionElement method,
FunctionElement setter, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitThisPropertyPostfix(
Send node, Name name, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitTopLevelFieldPostfix(
Send node, FieldElement field, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitTopLevelGetterSetterPostfix(Send node, FunctionElement getter,
FunctionElement setter, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitTopLevelMethodSetterPostfix(Send node, FunctionElement method,
FunctionElement setter, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitClassTypeLiteralPostfix(
Send node, ConstantExpression constant, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitDynamicTypeLiteralPostfix(
Send node, ConstantExpression constant, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitLocalFunctionPostfix(Send node, LocalFunctionElement function,
IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitTypeVariableTypeLiteralPostfix(
Send node, TypeVariableElement element, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitTypedefTypeLiteralPostfix(
Send node, ConstantExpression constant, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitUnresolvedStaticGetterPostfix(Send node, Element element,
MethodElement setter, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitUnresolvedTopLevelGetterPostfix(Send node, Element element,
MethodElement setter, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitUnresolvedStaticSetterPostfix(Send node, MethodElement getter,
Element element, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitUnresolvedTopLevelSetterPostfix(Send node, MethodElement getter,
Element element, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitStaticMethodPostfix(
Send node, MethodElement method, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
R visitToplevelMethodPostfix(
Send node, MethodElement method, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitUnresolvedPostfix(
Send node, Element element, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitFinalLocalVariablePostfix(Send node, LocalVariableElement variable,
IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitFinalParameterPostfix(
Send node, ParameterElement parameter, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitFinalStaticFieldPostfix(
Send node, FieldElement field, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitFinalSuperFieldPostfix(
Send node, FieldElement field, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitSuperMethodPostfix(
Send node, FunctionElement method, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitFinalTopLevelFieldPostfix(
Send node, FieldElement field, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitTopLevelMethodPostfix(
Send node, MethodElement method, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitUnresolvedSuperPostfix(
Send node, Element element, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitUnresolvedSuperGetterPostfix(Send node, Element element,
MethodElement setter, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
@override
R visitUnresolvedSuperSetterPostfix(Send node, MethodElement getter,
Element element, IncDecOperator operator, A arg) {
return bulkHandlePostfix(node, arg);
}
}
/// Mixin that implements all `visitXCompound` methods of [SemanticSendVisitor]
/// by delegating to a bulk handler.
///
/// Use this mixin to provide a trivial implementation for all `xCompound`
/// methods.
abstract class CompoundBulkMixin<R, A>
implements SemanticSendVisitor<R, A>, BulkHandle<R, A> {
R bulkHandleCompound(Send node, A arg) {
return bulkHandleNode(node, "Compound assignment `#` unhandled.", arg);
}
@override
R visitDynamicPropertyCompound(Send node, Node receiver, Name name,
AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitIfNotNullDynamicPropertyCompound(Send node, Node receiver, Name name,
AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitLocalVariableCompound(Send node, LocalVariableElement variable,
AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitParameterCompound(Send node, ParameterElement parameter,
AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitStaticFieldCompound(Send node, FieldElement field,
AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitStaticGetterSetterCompound(Send node, FunctionElement getter,
FunctionElement setter, AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitStaticMethodSetterCompound(Send node, FunctionElement method,
FunctionElement setter, AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitSuperFieldCompound(Send node, FieldElement field,
AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitSuperFieldSetterCompound(Send node, FieldElement field,
FunctionElement setter, AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitSuperGetterFieldCompound(Send node, FunctionElement getter,
FieldElement field, AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitSuperGetterSetterCompound(Send node, FunctionElement getter,
FunctionElement setter, AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitSuperMethodSetterCompound(Send node, FunctionElement method,
FunctionElement setter, AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitThisPropertyCompound(
Send node, Name name, AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitTopLevelFieldCompound(Send node, FieldElement field,
AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitTopLevelGetterSetterCompound(Send node, FunctionElement getter,
FunctionElement setter, AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitTopLevelMethodSetterCompound(Send node, FunctionElement method,
FunctionElement setter, AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitFinalParameterCompound(Send node, ParameterElement parameter,
AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitClassTypeLiteralCompound(Send node, ConstantExpression constant,
AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitDynamicTypeLiteralCompound(Send node, ConstantExpression constant,
AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitFinalLocalVariableCompound(Send node, LocalVariableElement variable,
AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitFinalStaticFieldCompound(Send node, FieldElement field,
AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitFinalSuperFieldCompound(Send node, FieldElement field,
AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitFinalTopLevelFieldCompound(Send node, FieldElement field,
AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitLocalFunctionCompound(Send node, LocalFunctionElement function,
AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitTypeVariableTypeLiteralCompound(Send node, TypeVariableElement element,
AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitTypedefTypeLiteralCompound(Send node, ConstantExpression constant,
AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitUnresolvedStaticGetterCompound(Send node, Element element,
MethodElement setter, AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitUnresolvedTopLevelGetterCompound(Send node, Element element,
MethodElement setter, AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitUnresolvedStaticSetterCompound(Send node, MethodElement getter,
Element element, AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitUnresolvedTopLevelSetterCompound(Send node, MethodElement getter,
Element element, AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitStaticMethodCompound(Send node, MethodElement method,
AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitTopLevelMethodCompound(Send node, MethodElement method,
AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitUnresolvedCompound(Send node, Element element,
AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitSuperFieldFieldCompound(Send node, FieldElement readField,
FieldElement writtenField, AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitSuperMethodCompound(Send node, FunctionElement method,
AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitUnresolvedSuperCompound(Send node, Element element,
AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitUnresolvedSuperGetterCompound(Send node, Element element,
MethodElement setter, AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
@override
R visitUnresolvedSuperSetterCompound(Send node, MethodElement getter,
Element element, AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleCompound(node, arg);
}
}
/// Mixin that implements all `visitXSetIfNull` methods of [SemanticSendVisitor]
/// by delegating to a bulk handler.
///
/// Use this mixin to provide a trivial implementation for all `xSetIfNull`
/// methods.
abstract class SetIfNullBulkMixin<R, A>
implements SemanticSendVisitor<R, A>, BulkHandle<R, A> {
R bulkHandleSetIfNull(Send node, A arg) {
return bulkHandleNode(node, "If null assignment `#` unhandled.", arg);
}
@override
R visitClassTypeLiteralSetIfNull(
Send node, ConstantExpression constant, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitDynamicPropertySetIfNull(
Send node, Node receiver, Name name, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitDynamicTypeLiteralSetIfNull(
Send node, ConstantExpression constant, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitFinalLocalVariableSetIfNull(
Send node, LocalVariableElement variable, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitFinalParameterSetIfNull(
Send node, ParameterElement parameter, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitFinalStaticFieldSetIfNull(
Send node, FieldElement field, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitFinalSuperFieldSetIfNull(
Send node, FieldElement field, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitFinalTopLevelFieldSetIfNull(
Send node, FieldElement field, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitIfNotNullDynamicPropertySetIfNull(
Send node, Node receiver, Name name, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitLocalFunctionSetIfNull(
Send node, LocalFunctionElement function, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitLocalVariableSetIfNull(
Send node, LocalVariableElement variable, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitParameterSetIfNull(
Send node, ParameterElement parameter, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitStaticFieldSetIfNull(Send node, FieldElement field, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitStaticGetterSetterSetIfNull(Send node, FunctionElement getter,
FunctionElement setter, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitStaticMethodSetIfNull(
Send node, FunctionElement method, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitStaticMethodSetterSetIfNull(
Send node, MethodElement method, MethodElement setter, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitSuperFieldFieldSetIfNull(Send node, FieldElement readField,
FieldElement writtenField, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitSuperFieldSetIfNull(Send node, FieldElement field, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitSuperFieldSetterSetIfNull(
Send node, FieldElement field, FunctionElement setter, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitSuperGetterFieldSetIfNull(
Send node, FunctionElement getter, FieldElement field, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitSuperGetterSetterSetIfNull(Send node, FunctionElement getter,
FunctionElement setter, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitSuperMethodSetIfNull(
Send node, FunctionElement method, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitSuperMethodSetterSetIfNull(Send node, FunctionElement method,
FunctionElement setter, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitThisPropertySetIfNull(Send node, Name name, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitTopLevelFieldSetIfNull(
Send node, FieldElement field, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitTopLevelGetterSetterSetIfNull(Send node, FunctionElement getter,
FunctionElement setter, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitTopLevelMethodSetIfNull(
Send node, FunctionElement method, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitTopLevelMethodSetterSetIfNull(Send node, FunctionElement method,
FunctionElement setter, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitTypeVariableTypeLiteralSetIfNull(
Send node, TypeVariableElement element, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitTypedefTypeLiteralSetIfNull(
Send node, ConstantExpression constant, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitUnresolvedSetIfNull(Send node, Element element, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitUnresolvedStaticGetterSetIfNull(
Send node, Element element, MethodElement setter, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitUnresolvedStaticSetterSetIfNull(
Send node, MethodElement getter, Element element, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitUnresolvedSuperGetterSetIfNull(
Send node, Element element, MethodElement setter, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitUnresolvedSuperSetIfNull(Send node, Element element, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitUnresolvedSuperSetterSetIfNull(
Send node, MethodElement getter, Element element, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitUnresolvedTopLevelGetterSetIfNull(
Send node, Element element, MethodElement setter, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitUnresolvedTopLevelSetterSetIfNull(
Send node, MethodElement getter, Element element, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitIndexSetIfNull(
SendSet node, Node receiver, Node index, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitSuperIndexSetIfNull(SendSet node, MethodElement getter,
MethodElement setter, Node index, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitUnresolvedSuperGetterIndexSetIfNull(Send node, Element element,
MethodElement setter, Node index, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitUnresolvedSuperSetterIndexSetIfNull(Send node, MethodElement getter,
Element element, Node index, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
@override
R visitUnresolvedSuperIndexSetIfNull(
Send node, Element element, Node index, Node rhs, A arg) {
return bulkHandleSetIfNull(node, arg);
}
}
/// Mixin that implements all `visitXInvoke` methods of [SemanticSendVisitor] by
/// delegating to a bulk handler.
///
/// Use this mixin to provide a trivial implementation for all `visitXInvoke`
/// methods.
abstract class InvokeBulkMixin<R, A>
implements SemanticSendVisitor<R, A>, BulkHandle<R, A> {
R bulkHandleInvoke(Send node, A arg) {
return bulkHandleNode(node, "Invocation `#` unhandled.", arg);
}
@override
R visitClassTypeLiteralInvoke(Send node, ConstantExpression constant,
NodeList arguments, CallStructure callStructure, A arg) {
return bulkHandleInvoke(node, arg);
}
@override
R visitDynamicPropertyInvoke(
Send node, Node receiver, NodeList arguments, Selector selector, A arg) {
return bulkHandleInvoke(node, arg);
}
@override
R visitIfNotNullDynamicPropertyInvoke(
Send node, Node receiver, NodeList arguments, Selector selector, A arg) {
return bulkHandleInvoke(node, arg);
}
@override
R visitDynamicTypeLiteralInvoke(Send node, ConstantExpression constant,
NodeList arguments, CallStructure callStructure, A arg) {
return bulkHandleInvoke(node, arg);
}
@override
R visitExpressionInvoke(Send node, Node expression, NodeList arguments,
CallStructure callStructure, A arg) {
return bulkHandleInvoke(node, arg);
}
@override
R visitLocalFunctionInvoke(Send node, LocalFunctionElement function,
NodeList arguments, CallStructure callStructure, A arg) {
return bulkHandleInvoke(node, arg);
}
@override
R visitLocalFunctionIncompatibleInvoke(
Send node,
LocalFunctionElement function,
NodeList arguments,
CallStructure callStructure,
A arg) {
return bulkHandleInvoke(node, arg);
}
@override
R visitLocalVariableInvoke(Send node, LocalVariableElement variable,
NodeList arguments, CallStructure callStructure, A arg) {
return bulkHandleInvoke(node, arg);
}
@override
R visitParameterInvoke(Send node, ParameterElement parameter,
NodeList arguments, CallStructure callStructure, A arg) {
return bulkHandleInvoke(node, arg);
}
@override
R visitStaticFieldInvoke(Send node, FieldElement field, NodeList arguments,
CallStructure callStructure, A arg) {
return bulkHandleInvoke(node, arg);
}
@override
R visitStaticFunctionInvoke(Send node, MethodElement function,
NodeList arguments, CallStructure callStructure, A arg) {
return bulkHandleInvoke(node, arg);
}
@override
R visitStaticFunctionIncompatibleInvoke(Send node, MethodElement function,
NodeList arguments, CallStructure callStructure, A arg) {
return bulkHandleInvoke(node, arg);
}
@override
R visitStaticGetterInvoke(Send node, FunctionElement getter,
NodeList arguments, CallStructure callStructure, A arg) {
return bulkHandleInvoke(node, arg);
}
@override
R visitSuperFieldInvoke(Send node, FieldElement field, NodeList arguments,
CallStructure callStructure, A arg) {
return bulkHandleInvoke(node, arg);
}
@override
R visitSuperGetterInvoke(Send node, FunctionElement getter,
NodeList arguments, CallStructure callStructure, A arg) {
return bulkHandleInvoke(node, arg);
}
@override
R visitSuperMethodInvoke(Send node, MethodElement method, NodeList arguments,
CallStructure callStructure, A arg) {
return bulkHandleInvoke(node, arg);
}
@override
R visitSuperMethodIncompatibleInvoke(Send node, MethodElement method,
NodeList arguments, CallStructure callStructure, A arg) {
return bulkHandleInvoke(node, arg);
}
@override
R visitThisInvoke(
Send node, NodeList arguments, CallStructure callStructure, A arg) {
return bulkHandleInvoke(node, arg);
}
@override
R visitThisPropertyInvoke(
Send node, NodeList arguments, Selector selector, A arg) {
return bulkHandleInvoke(node, arg);
}
@override
R visitTopLevelFieldInvoke(Send node, FieldElement field, NodeList arguments,
CallStructure callStructure, A arg) {
return bulkHandleInvoke(node, arg);
}
@override
R visitTopLevelFunctionInvoke(Send node, MethodElement function,
NodeList arguments, CallStructure callStructure, A arg) {
return bulkHandleInvoke(node, arg);
}
@override
R visitTopLevelFunctionIncompatibleInvoke(Send node, MethodElement function,
NodeList arguments, CallStructure callStructure, A arg) {
return bulkHandleInvoke(node, arg);
}
@override
R visitTopLevelGetterInvoke(Send node, FunctionElement getter,
NodeList arguments, CallStructure callStructure, A arg) {
return bulkHandleInvoke(node, arg);
}
@override
R visitTypeVariableTypeLiteralInvoke(Send node, TypeVariableElement element,
NodeList arguments, CallStructure callStructure, A arg) {
return bulkHandleInvoke(node, arg);
}
@override
R visitTypedefTypeLiteralInvoke(Send node, ConstantExpression constant,
NodeList arguments, CallStructure callStructure, A arg) {
return bulkHandleInvoke(node, arg);
}
@override
R visitConstantInvoke(Send node, ConstantExpression constant,
NodeList arguments, CallStructure callStructure, A arg) {
return bulkHandleInvoke(node, arg);
}
@override
R visitUnresolvedInvoke(Send node, Element element, NodeList arguments,
Selector selector, A arg) {
return bulkHandleInvoke(node, arg);
}
@override
R visitUnresolvedSuperInvoke(Send node, Element function, NodeList arguments,
Selector selector, A arg) {
return bulkHandleInvoke(node, arg);
}
@override
R visitStaticSetterInvoke(Send node, FunctionElement setter,
NodeList arguments, CallStructure callStructure, A arg) {
return bulkHandleInvoke(node, arg);
}
@override
R visitSuperSetterInvoke(Send node, FunctionElement setter,
NodeList arguments, CallStructure callStructure, A arg) {
return bulkHandleInvoke(node, arg);
}
@override
R visitTopLevelSetterInvoke(Send node, FunctionElement setter,
NodeList arguments, CallStructure callStructure, A arg) {
return bulkHandleInvoke(node, arg);
}
}
/// Mixin that implements all `visitXGet` methods of [SemanticSendVisitor] by
/// delegating to a bulk handler.
///
/// Use this mixin to provide a trivial implementation for all `visitXGet`
/// methods.
abstract class GetBulkMixin<R, A>
implements SemanticSendVisitor<R, A>, BulkHandle<R, A> {
R bulkHandleGet(Node node, A arg) {
return bulkHandleNode(node, "Read `#` unhandled.", arg);
}
@override
R visitClassTypeLiteralGet(Send node, ConstantExpression constant, A arg) {
return bulkHandleGet(node, arg);
}
@override
R visitDynamicPropertyGet(Send node, Node receiver, Name name, A arg) {
return bulkHandleGet(node, arg);
}
@override
R visitIfNotNullDynamicPropertyGet(
Send node, Node receiver, Name name, A arg) {
return bulkHandleGet(node, arg);
}
@override
R visitDynamicTypeLiteralGet(Send node, ConstantExpression constant, A arg) {
return bulkHandleGet(node, arg);
}
@override
R visitLocalFunctionGet(Send node, LocalFunctionElement function, A arg) {
return bulkHandleGet(node, arg);
}
@override
R visitLocalVariableGet(Send node, LocalVariableElement variable, A arg) {
return bulkHandleGet(node, arg);
}
@override
R visitParameterGet(Send node, ParameterElement parameter, A arg) {
return bulkHandleGet(node, arg);
}
@override
R visitStaticFieldGet(Send node, FieldElement field, A arg) {
return bulkHandleGet(node, arg);
}
@override
R visitStaticFunctionGet(Send node, MethodElement function, A arg) {
return bulkHandleGet(node, arg);
}
@override
R visitStaticGetterGet(Send node, FunctionElement getter, A arg) {
return bulkHandleGet(node, arg);
}
@override
R visitSuperFieldGet(Send node, FieldElement field, A arg) {
return bulkHandleGet(node, arg);
}
@override
R visitSuperGetterGet(Send node, FunctionElement getter, A arg) {
return bulkHandleGet(node, arg);
}
@override
R visitSuperMethodGet(Send node, MethodElement method, A arg) {
return bulkHandleGet(node, arg);
}
@override
R visitThisGet(Identifier node, A arg) {
return bulkHandleGet(node, arg);
}
@override
R visitThisPropertyGet(Send node, Name name, A arg) {
return bulkHandleGet(node, arg);
}
@override
R visitTopLevelFieldGet(Send node, FieldElement field, A arg) {
return bulkHandleGet(node, arg);
}
@override
R visitTopLevelFunctionGet(Send node, MethodElement function, A arg) {
return bulkHandleGet(node, arg);
}
@override
R visitTopLevelGetterGet(Send node, FunctionElement getter, A arg) {
return bulkHandleGet(node, arg);
}
@override
R visitTypeVariableTypeLiteralGet(
Send node, TypeVariableElement element, A arg) {
return bulkHandleGet(node, arg);
}
@override
R visitTypedefTypeLiteralGet(Send node, ConstantExpression constant, A arg) {
return bulkHandleGet(node, arg);
}
@override
R visitConstantGet(Send node, ConstantExpression constant, A arg) {
return bulkHandleGet(node, arg);
}
@override
R visitUnresolvedGet(Send node, Element element, A arg) {
return bulkHandleGet(node, arg);
}
@override
R visitUnresolvedSuperGet(Send node, Element element, A arg) {
return bulkHandleGet(node, arg);
}
@override
R visitStaticSetterGet(Send node, FunctionElement setter, A arg) {
return bulkHandleGet(node, arg);
}
@override
R visitSuperSetterGet(Send node, FunctionElement setter, A arg) {
return bulkHandleGet(node, arg);
}
@override
R visitTopLevelSetterGet(Send node, FunctionElement setter, A arg) {
return bulkHandleGet(node, arg);
}
}
/// Mixin that implements all `visitXSet` methods of [SemanticSendVisitor] by
/// delegating to a bulk handler.
///
/// Use this mixin to provide a trivial implementation for all `visitXSet`
/// methods.
abstract class SetBulkMixin<R, A>
implements SemanticSendVisitor<R, A>, BulkHandle<R, A> {
R bulkHandleSet(Send node, A arg) {
return bulkHandleNode(node, "Assignment `#` unhandled.", arg);
}
@override
R visitDynamicPropertySet(
SendSet node, Node receiver, Name name, Node rhs, A arg) {
return bulkHandleSet(node, arg);
}
@override
R visitIfNotNullDynamicPropertySet(
SendSet node, Node receiver, Name name, Node rhs, A arg) {
return bulkHandleSet(node, arg);
}
@override
R visitLocalVariableSet(
SendSet node, LocalVariableElement variable, Node rhs, A arg) {
return bulkHandleSet(node, arg);
}
@override
R visitParameterSet(
SendSet node, ParameterElement parameter, Node rhs, A arg) {
return bulkHandleSet(node, arg);
}
@override
R visitStaticFieldSet(SendSet node, FieldElement field, Node rhs, A arg) {
return bulkHandleSet(node, arg);
}
@override
R visitStaticSetterSet(
SendSet node, FunctionElement setter, Node rhs, A arg) {
return bulkHandleSet(node, arg);
}
@override
R visitSuperFieldSet(SendSet node, FieldElement field, Node rhs, A arg) {
return bulkHandleSet(node, arg);
}
@override
R visitSuperSetterSet(SendSet node, FunctionElement setter, Node rhs, A arg) {
return bulkHandleSet(node, arg);
}
@override
R visitThisPropertySet(SendSet node, Name name, Node rhs, A arg) {
return bulkHandleSet(node, arg);
}
@override
R visitTopLevelFieldSet(SendSet node, FieldElement field, Node rhs, A arg) {
return bulkHandleSet(node, arg);
}
@override
R visitTopLevelSetterSet(
SendSet node, FunctionElement setter, Node rhs, A arg) {
return bulkHandleSet(node, arg);
}
@override
R visitClassTypeLiteralSet(
SendSet node, ConstantExpression constant, Node rhs, A arg) {
return bulkHandleSet(node, arg);
}
@override
R visitDynamicTypeLiteralSet(
SendSet node, ConstantExpression constant, Node rhs, A arg) {
return bulkHandleSet(node, arg);
}
@override
R visitFinalLocalVariableSet(
SendSet node, LocalVariableElement variable, Node rhs, A arg) {
return bulkHandleSet(node, arg);
}
@override
R visitFinalParameterSet(
SendSet node, ParameterElement parameter, Node rhs, A arg) {
return bulkHandleSet(node, arg);
}
@override
R visitFinalStaticFieldSet(
SendSet node, FieldElement field, Node rhs, A arg) {
return bulkHandleSet(node, arg);
}
@override
R visitFinalSuperFieldSet(SendSet node, FieldElement field, Node rhs, A arg) {
return bulkHandleSet(node, arg);
}
@override
R visitFinalTopLevelFieldSet(
SendSet node, FieldElement field, Node rhs, A arg) {
return bulkHandleSet(node, arg);
}
@override
R visitLocalFunctionSet(
SendSet node, LocalFunctionElement function, Node rhs, A arg) {
return bulkHandleSet(node, arg);
}
@override
R visitStaticFunctionSet(Send node, MethodElement function, Node rhs, A arg) {
return bulkHandleSet(node, arg);
}
@override
R visitStaticGetterSet(
SendSet node, FunctionElement getter, Node rhs, A arg) {
return bulkHandleSet(node, arg);
}
@override
R visitSuperGetterSet(SendSet node, FunctionElement getter, Node rhs, A arg) {
return bulkHandleSet(node, arg);
}
@override
R visitSuperMethodSet(Send node, MethodElement method, Node rhs, A arg) {
return bulkHandleSet(node, arg);
}
@override
R visitTopLevelFunctionSet(
Send node, MethodElement function, Node rhs, A arg) {
return bulkHandleSet(node, arg);
}
@override
R visitTopLevelGetterSet(
SendSet node, FunctionElement getter, Node rhs, A arg) {
return bulkHandleSet(node, arg);
}
@override
R visitTypeVariableTypeLiteralSet(
SendSet node, TypeVariableElement element, Node rhs, A arg) {
return bulkHandleSet(node, arg);
}
@override
R visitTypedefTypeLiteralSet(
SendSet node, ConstantExpression constant, Node rhs, A arg) {
return bulkHandleSet(node, arg);
}
@override
R visitUnresolvedSet(Send node, Element element, Node rhs, A arg) {
return bulkHandleSet(node, arg);
}
@override
R visitUnresolvedSuperSet(Send node, Element element, Node rhs, A arg) {
return bulkHandleSet(node, arg);
}
}
/// Mixin that implements all `visitXIndexSet` methods of [SemanticSendVisitor]
/// by delegating to a bulk handler.
///
/// Use this mixin to provide a trivial implementation for all `visitXIndexSet`
/// methods.
abstract class IndexSetBulkMixin<R, A>
implements SemanticSendVisitor<R, A>, BulkHandle<R, A> {
R bulkHandleIndexSet(Send node, A arg) {
return bulkHandleNode(node, "Index set expression `#` unhandled.", arg);
}
@override
R visitCompoundIndexSet(SendSet node, Node receiver, Node index,
AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleIndexSet(node, arg);
}
@override
R visitIndexSet(SendSet node, Node receiver, Node index, Node rhs, A arg) {
return bulkHandleIndexSet(node, arg);
}
@override
R visitSuperCompoundIndexSet(
SendSet node,
FunctionElement getter,
FunctionElement setter,
Node index,
AssignmentOperator operator,
Node rhs,
A arg) {
return bulkHandleIndexSet(node, arg);
}
@override
R visitUnresolvedSuperGetterCompoundIndexSet(
SendSet node,
Element element,
MethodElement setter,
Node index,
AssignmentOperator operator,
Node rhs,
A arg) {
return bulkHandleIndexSet(node, arg);
}
@override
R visitUnresolvedSuperSetterCompoundIndexSet(
SendSet node,
MethodElement getter,
Element element,
Node index,
AssignmentOperator operator,
Node rhs,
A arg) {
return bulkHandleIndexSet(node, arg);
}
@override
R visitUnresolvedSuperCompoundIndexSet(SendSet node, Element element,
Node index, AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleIndexSet(node, arg);
}
@override
R visitSuperIndexSet(
SendSet node, FunctionElement function, Node index, Node rhs, A arg) {
return bulkHandleIndexSet(node, arg);
}
@override
R visitUnresolvedSuperIndexSet(
SendSet node, Element element, Node index, Node rhs, A arg) {
return bulkHandleIndexSet(node, arg);
}
}
/// Mixin that implements all binary visitor methods in [SemanticSendVisitor] by
/// delegating to a bulk handler.
///
/// Use this mixin to provide a trivial implementation for all binary visitor
/// methods.
abstract class BinaryBulkMixin<R, A>
implements SemanticSendVisitor<R, A>, BulkHandle<R, A> {
R bulkHandleBinary(Send node, A arg) {
return bulkHandleNode(node, "Binary expression `#` unhandled.", arg);
}
@override
R visitBinary(
Send node, Node left, BinaryOperator operator, Node right, A arg) {
return bulkHandleBinary(node, arg);
}
@override
R visitEquals(Send node, Node left, Node right, A arg) {
return bulkHandleBinary(node, arg);
}
@override
R visitNotEquals(Send node, Node left, Node right, A arg) {
return bulkHandleBinary(node, arg);
}
@override
R visitIndex(Send node, Node receiver, Node index, A arg) {
return bulkHandleBinary(node, arg);
}
@override
R visitSuperBinary(Send node, FunctionElement function,
BinaryOperator operator, Node argument, A arg) {
return bulkHandleBinary(node, arg);
}
@override
R visitSuperEquals(
Send node, FunctionElement function, Node argument, A arg) {
return bulkHandleBinary(node, arg);
}
@override
R visitSuperNotEquals(
Send node, FunctionElement function, Node argument, A arg) {
return bulkHandleBinary(node, arg);
}
@override
R visitSuperIndex(Send node, FunctionElement function, Node index, A arg) {
return bulkHandleBinary(node, arg);
}
@override
R visitUnresolvedSuperBinary(Send node, FunctionElement function,
BinaryOperator operator, Node argument, A arg) {
return bulkHandleBinary(node, arg);
}
@override
R visitUnresolvedSuperInvoke(Send node, Element function, NodeList arguments,
Selector selector, A arg) {
return bulkHandleBinary(node, arg);
}
@override
R visitUnresolvedSuperIndex(
Send node, FunctionElement function, Node index, A arg) {
return bulkHandleBinary(node, arg);
}
}
/// Mixin that implements all unary visitor methods in [SemanticSendVisitor] by
/// delegating to a bulk handler.
///
/// Use this mixin to provide a trivial implementation for all unary visitor
/// methods.
abstract class UnaryBulkMixin<R, A>
implements SemanticSendVisitor<R, A>, BulkHandle<R, A> {
R bulkHandleUnary(Send node, A arg) {
return bulkHandleNode(node, "Unary expression `#` unhandled.", arg);
}
@override
R visitNot(Send node, Node expression, A arg) {
return bulkHandleUnary(node, arg);
}
@override
R visitSuperUnary(
Send node, UnaryOperator operator, FunctionElement function, A arg) {
return bulkHandleUnary(node, arg);
}
@override
R visitUnary(Send node, UnaryOperator operator, Node expression, A arg) {
return bulkHandleUnary(node, arg);
}
@override
R visitUnresolvedSuperUnary(
Send node, UnaryOperator operator, FunctionElement function, A arg) {
return bulkHandleUnary(node, arg);
}
}
/// Mixin that implements all purely structural visitor methods in
/// [SemanticSendVisitor] by delegating to a bulk handler.
///
/// Use this mixin to provide a trivial implementation for all purely structural
/// visitor methods.
abstract class BaseBulkMixin<R, A>
implements SemanticSendVisitor<R, A>, BulkHandle<R, A> {
@override
R visitAs(Send node, Node expression, ResolutionDartType type, A arg) {
return bulkHandleNode(node, 'As cast `#` unhandled.', arg);
}
@override
R visitIs(Send node, Node expression, ResolutionDartType type, A arg) {
return bulkHandleNode(node, 'Is test `#` unhandled.', arg);
}
@override
R visitIsNot(Send node, Node expression, ResolutionDartType type, A arg) {
return bulkHandleNode(node, 'Is not test `#` unhandled.', arg);
}
@override
R visitIfNull(Send node, Node left, Node right, A arg) {
return bulkHandleNode(node, 'If-null (Lazy ?? `#`) unhandled.', arg);
}
@override
R visitLogicalAnd(Send node, Node left, Node right, A arg) {
return bulkHandleNode(node, 'Lazy and `#` unhandled.', arg);
}
@override
R visitLogicalOr(Send node, Node left, Node right, A arg) {
return bulkHandleNode(node, 'Lazy or `#` unhandled.', arg);
}
@override
void previsitDeferredAccess(Send node, PrefixElement prefix, A arg) {
bulkHandleNode(node, 'Deferred access `#` unhandled.', arg);
}
}
/// Mixin that implements all visitor methods for `super` calls in
/// [SemanticSendVisitor] by delegating to a bulk handler.
///
/// Use this mixin to provide a trivial implementation for `super` calls
/// visitor methods.
abstract class SuperBulkMixin<R, A>
implements SemanticSendVisitor<R, A>, BulkHandle<R, A> {
R bulkHandleSuper(Send node, A arg) {
return bulkHandleNode(node, "Super call `#` unhandled.", arg);
}
@override
R visitSuperBinary(Send node, FunctionElement function,
BinaryOperator operator, Node argument, A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitSuperCompoundIndexSet(
SendSet node,
FunctionElement getter,
FunctionElement setter,
Node index,
AssignmentOperator operator,
Node rhs,
A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitSuperEquals(
Send node, FunctionElement function, Node argument, A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitSuperFieldCompound(Send node, FieldElement field,
AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitSuperFieldFieldPostfix(Send node, FieldElement readField,
FieldElement writtenField, IncDecOperator operator, A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitSuperFieldFieldPrefix(Send node, FieldElement readField,
FieldElement writtenField, IncDecOperator operator, A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitSuperFieldGet(Send node, FieldElement field, A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitSuperFieldInvoke(Send node, FieldElement field, NodeList arguments,
CallStructure callStructure, A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitSuperFieldPostfix(
Send node, FieldElement field, IncDecOperator operator, A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitSuperFieldPrefix(
Send node, FieldElement field, IncDecOperator operator, A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitSuperFieldSet(SendSet node, FieldElement field, Node rhs, A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitSuperFieldSetterCompound(Send node, FieldElement field,
FunctionElement setter, AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitSuperFieldSetterPostfix(Send node, FieldElement field,
FunctionElement setter, IncDecOperator operator, A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitSuperFieldSetterPrefix(Send node, FieldElement field,
FunctionElement setter, IncDecOperator operator, A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitSuperGetterFieldCompound(Send node, FunctionElement getter,
FieldElement field, AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitSuperGetterFieldPostfix(Send node, FunctionElement getter,
FieldElement field, IncDecOperator operator, A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitSuperGetterFieldPrefix(Send node, FunctionElement getter,
FieldElement field, IncDecOperator operator, A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitSuperGetterGet(Send node, FunctionElement getter, A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitSuperGetterInvoke(Send node, FunctionElement getter,
NodeList arguments, CallStructure callStructure, A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitSuperGetterSetterCompound(Send node, FunctionElement getter,
FunctionElement setter, AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitSuperGetterSetterPostfix(Send node, FunctionElement getter,
FunctionElement setter, IncDecOperator operator, A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitSuperGetterSetterPrefix(Send node, FunctionElement getter,
FunctionElement setter, IncDecOperator operator, A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitSuperIndexSet(
SendSet node, FunctionElement function, Node index, Node rhs, A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitSuperMethodGet(Send node, MethodElement method, A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitSuperMethodInvoke(Send node, MethodElement method, NodeList arguments,
CallStructure callStructure, A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitSuperMethodIncompatibleInvoke(Send node, MethodElement method,
NodeList arguments, CallStructure callStructure, A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitSuperMethodSetterCompound(Send node, FunctionElement method,
FunctionElement setter, AssignmentOperator operator, Node rhs, A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitSuperMethodSetterPostfix(Send node, FunctionElement method,
FunctionElement setter, IncDecOperator operator, A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitSuperMethodSetterPrefix(Send node, FunctionElement method,
FunctionElement setter, IncDecOperator operator, A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitSuperNotEquals(
Send node, FunctionElement function, Node argument, A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitSuperSetterSet(SendSet node, FunctionElement setter, Node rhs, A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitSuperUnary(
Send node, UnaryOperator operator, FunctionElement function, A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitUnresolvedSuperBinary(Send node, Element element,
BinaryOperator operator, Node argument, A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitUnresolvedSuperGet(Send node, Element element, A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitUnresolvedSuperSet(Send node, Element element, Node rhs, A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitUnresolvedSuperInvoke(Send node, Element function, NodeList arguments,
Selector selector, A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitUnresolvedSuperIndex(Send node, Element function, Node index, A arg) {
return bulkHandleSuper(node, arg);
}
@override
R visitUnresolvedSuperUnary(
Send node, UnaryOperator operator, Element element, A arg) {
return bulkHandleSuper(node, arg);
}
}
abstract class NewBulkMixin<R, A>
implements SemanticSendVisitor<R, A>, BulkHandle<R, A> {
R bulkHandleNew(NewExpression node, A arg) {
return bulkHandleNode(node, "Constructor invocation `#` unhandled.", arg);
}
@override
R visitAbstractClassConstructorInvoke(
NewExpression node,
ConstructorElement element,
ResolutionInterfaceType type,
NodeList arguments,
CallStructure callStructure,
A arg) {
return bulkHandleNew(node, arg);
}
@override
R visitConstConstructorInvoke(
NewExpression node, ConstructedConstantExpression constant, A arg) {
return bulkHandleNew(node, arg);
}
@override
R visitBoolFromEnvironmentConstructorInvoke(NewExpression node,
BoolFromEnvironmentConstantExpression constant, A arg) {
return bulkHandleNew(node, arg);
}
@override
R visitIntFromEnvironmentConstructorInvoke(NewExpression node,
IntFromEnvironmentConstantExpression constant, A arg) {
return bulkHandleNew(node, arg);
}
@override
R visitStringFromEnvironmentConstructorInvoke(NewExpression node,
StringFromEnvironmentConstantExpression constant, A arg) {
return bulkHandleNew(node, arg);
}
@override
R visitConstructorIncompatibleInvoke(
NewExpression node,
ConstructorElement constructor,
ResolutionInterfaceType type,
NodeList arguments,
CallStructure callStructure,
A arg) {
return bulkHandleNew(node, arg);
}
@override
R visitGenerativeConstructorInvoke(
NewExpression node,
ConstructorElement constructor,
ResolutionInterfaceType type,
NodeList arguments,
CallStructure callStructure,
A arg) {
return bulkHandleNew(node, arg);
}
@override
R visitRedirectingGenerativeConstructorInvoke(
NewExpression node,
ConstructorElement constructor,
ResolutionInterfaceType type,
NodeList arguments,
CallStructure callStructure,
A arg) {
return bulkHandleNew(node, arg);
}
@override
R visitFactoryConstructorInvoke(
NewExpression node,
ConstructorElement constructor,
ResolutionInterfaceType type,
NodeList arguments,
CallStructure callStructure,
A arg) {
return bulkHandleNew(node, arg);
}
@override
R visitRedirectingFactoryConstructorInvoke(
NewExpression node,
ConstructorElement constructor,
ResolutionInterfaceType type,
ConstructorElement effectiveTarget,
ResolutionInterfaceType effectiveTargetType,
NodeList arguments,
CallStructure callStructure,
A arg) {
return bulkHandleNew(node, arg);
}
@override
R visitUnresolvedClassConstructorInvoke(NewExpression node, Element element,
ResolutionDartType type, NodeList arguments, Selector selector, A arg) {
return bulkHandleNew(node, arg);
}
@override
R visitUnresolvedConstructorInvoke(NewExpression node, Element constructor,
ResolutionDartType type, NodeList arguments, Selector selector, A arg) {
return bulkHandleNew(node, arg);
}
@override
R visitUnresolvedRedirectingFactoryConstructorInvoke(
NewExpression node,
ConstructorElement constructor,
ResolutionInterfaceType type,
NodeList arguments,
CallStructure callStructure,
A arg) {
return bulkHandleNew(node, arg);
}
}
/// Visitor that implements [SemanticSendVisitor] by the use of `BulkX` mixins.
///
/// This class is useful in itself, but shows how to use the `BulkX` mixins and
/// tests that the union of the `BulkX` mixins implement all `visit` and `error`
/// methods of [SemanticSendVisitor].
class BulkSendVisitor<R, A> extends SemanticSendVisitor<R, A>
with
GetBulkMixin<R, A>,
SetBulkMixin<R, A>,
ErrorBulkMixin<R, A>,
InvokeBulkMixin<R, A>,
IndexSetBulkMixin<R, A>,
CompoundBulkMixin<R, A>,
SetIfNullBulkMixin<R, A>,
UnaryBulkMixin<R, A>,
BaseBulkMixin<R, A>,
BinaryBulkMixin<R, A>,
PrefixBulkMixin<R, A>,
PostfixBulkMixin<R, A>,
NewBulkMixin<R, A> {
@override
R apply(Node node, A arg) {
throw new UnimplementedError("BulkSendVisitor.apply unimplemented");
}
@override
R bulkHandleNode(Node node, String message, A arg) {
throw new UnimplementedError(
"BulkSendVisitor.bulkHandleNode unimplemented");
}
}
/// Mixin that implements all `visitXParameterDecl` and
/// `visitXInitializingFormalDecl` methods of [SemanticDeclarationVisitor]
/// by delegating to a bulk handler.
///
/// Use this mixin to provide a trivial implementation for these methods.
abstract class ParameterBulkMixin<R, A>
implements SemanticDeclarationVisitor<R, A>, BulkHandle<R, A> {
R bulkHandleParameterDeclaration(VariableDefinitions node, A arg) {
return bulkHandleNode(node, "Parameter declaration `#` unhandled.", arg);
}
@override
R visitInitializingFormalDeclaration(VariableDefinitions node,
Node definition, InitializingFormalElement parameter, int index, A arg) {
return bulkHandleParameterDeclaration(node, arg);
}
@override
R visitNamedInitializingFormalDeclaration(
VariableDefinitions node,
Node definition,
InitializingFormalElement parameter,
ConstantExpression defaultValue,
A arg) {
return bulkHandleParameterDeclaration(node, arg);
}
@override
R visitNamedParameterDeclaration(VariableDefinitions node, Node definition,
ParameterElement parameter, ConstantExpression defaultValue, A arg) {
return bulkHandleParameterDeclaration(node, arg);
}
@override
R visitOptionalInitializingFormalDeclaration(
VariableDefinitions node,
Node definition,
InitializingFormalElement parameter,
ConstantExpression defaultValue,
int index,
A arg) {
return bulkHandleParameterDeclaration(node, arg);
}
@override
R visitOptionalParameterDeclaration(
VariableDefinitions node,
Node definition,
ParameterElement parameter,
ConstantExpression defaultValue,
int index,
A arg) {
return bulkHandleParameterDeclaration(node, arg);
}
@override
R visitParameterDeclaration(VariableDefinitions node, Node definition,
ParameterElement parameter, int index, A arg) {
return bulkHandleParameterDeclaration(node, arg);
}
}
/// Mixin that implements all `visitXConstructorDecl` methods of
/// [SemanticDeclarationVisitor] by delegating to a bulk handler.
///
/// Use this mixin to provide a trivial implementation for these methods.
abstract class ConstructorBulkMixin<R, A>
implements SemanticDeclarationVisitor<R, A>, BulkHandle<R, A> {
R bulkHandleConstructorDeclaration(FunctionExpression node, A arg) {
return bulkHandleNode(node, "Constructor declaration `#` unhandled.", arg);
}
@override
R visitFactoryConstructorDeclaration(FunctionExpression node,
ConstructorElement constructor, NodeList parameters, Node body, A arg) {
return bulkHandleConstructorDeclaration(node, arg);
}
@override
R visitGenerativeConstructorDeclaration(
FunctionExpression node,
ConstructorElement constructor,
NodeList parameters,
NodeList initializers,
Node body,
A arg) {
return bulkHandleConstructorDeclaration(node, arg);
}
@override
R visitRedirectingFactoryConstructorDeclaration(
FunctionExpression node,
ConstructorElement constructor,
NodeList parameters,
ResolutionInterfaceType redirectionType,
ConstructorElement redirectionTarget,
A arg) {
return bulkHandleConstructorDeclaration(node, arg);
}
@override
R visitRedirectingGenerativeConstructorDeclaration(
FunctionExpression node,
ConstructorElement constructor,
NodeList parameters,
NodeList initializers,
A arg) {
return bulkHandleConstructorDeclaration(node, arg);
}
}
/// Mixin that implements all constructor initializer visitor methods of
/// [SemanticDeclarationVisitor] by delegating to a bulk handler.
///
/// Use this mixin to provide a trivial implementation for these methods.
abstract class InitializerBulkMixin<R, A>
implements SemanticDeclarationVisitor<R, A>, BulkHandle<R, A> {
R bulkHandleInitializer(Node node, A arg) {
return bulkHandleNode(node, "Initializer `#` unhandled.", arg);
}
@override
R errorUnresolvedFieldInitializer(
SendSet node, Element element, Node initializer, A arg) {
return bulkHandleInitializer(node, arg);
}
@override
R errorUnresolvedSuperConstructorInvoke(Send node, Element element,
NodeList arguments, Selector selector, A arg) {
return bulkHandleInitializer(node, arg);
}
@override
R errorUnresolvedThisConstructorInvoke(Send node, Element element,
NodeList arguments, Selector selector, A arg) {
return bulkHandleInitializer(node, arg);
}
@override
R visitFieldInitializer(
SendSet node, FieldElement field, Node initializer, A arg) {
return bulkHandleInitializer(node, arg);
}
@override
R visitSuperConstructorInvoke(
Send node,
ConstructorElement superConstructor,
ResolutionInterfaceType type,
NodeList arguments,
CallStructure callStructure,
A arg) {
return bulkHandleInitializer(node, arg);
}
@override
R visitImplicitSuperConstructorInvoke(
FunctionExpression node,
ConstructorElement superConstructor,
ResolutionInterfaceType type,
A arg) {
return bulkHandleInitializer(node, arg);
}
@override
R visitThisConstructorInvoke(Send node, ConstructorElement thisConstructor,
NodeList arguments, CallStructure callStructure, A arg) {
return bulkHandleInitializer(node, arg);
}
}
/// Mixin that implements all function declaration visitor methods of
/// [SemanticDeclarationVisitor] by delegating to a bulk handler.
///
/// Use this mixin to provide a trivial implementation for these methods.
abstract class FunctionBulkMixin<R, A>
implements SemanticDeclarationVisitor<R, A>, BulkHandle<R, A> {
R bulkHandleFunctionDeclaration(FunctionExpression node, A arg) {
return bulkHandleNode(node, "Function declaration `#` unhandled.", arg);
}
@override
R visitAbstractGetterDeclaration(
FunctionExpression node, MethodElement getter, A arg) {
return bulkHandleFunctionDeclaration(node, arg);
}
@override
R visitAbstractMethodDeclaration(FunctionExpression node,
MethodElement method, NodeList parameters, A arg) {
return bulkHandleFunctionDeclaration(node, arg);
}
@override
R visitAbstractSetterDeclaration(FunctionExpression node,
MethodElement setter, NodeList parameters, A arg) {
return bulkHandleFunctionDeclaration(node, arg);
}
@override
R visitClosureDeclaration(FunctionExpression node,
LocalFunctionElement closure, NodeList parameters, Node body, A arg) {
return bulkHandleFunctionDeclaration(node, arg);
}
@override
R visitInstanceGetterDeclaration(
FunctionExpression node, MethodElement getter, Node body, A arg) {
return bulkHandleFunctionDeclaration(node, arg);
}
@override
R visitInstanceMethodDeclaration(FunctionExpression node,
MethodElement method, NodeList parameters, Node body, A arg) {
return bulkHandleFunctionDeclaration(node, arg);
}
@override
R visitInstanceSetterDeclaration(FunctionExpression node,
MethodElement setter, NodeList parameters, Node body, A arg) {
return bulkHandleFunctionDeclaration(node, arg);
}
@override
R visitLocalFunctionDeclaration(FunctionExpression node,
LocalFunctionElement function, NodeList parameters, Node body, A arg) {
return bulkHandleFunctionDeclaration(node, arg);
}
@override
R visitStaticFunctionDeclaration(FunctionExpression node,
MethodElement function, NodeList parameters, Node body, A arg) {
return bulkHandleFunctionDeclaration(node, arg);
}
@override
R visitStaticGetterDeclaration(
FunctionExpression node, MethodElement getter, Node body, A arg) {
return bulkHandleFunctionDeclaration(node, arg);
}
@override
R visitStaticSetterDeclaration(FunctionExpression node, MethodElement setter,
NodeList parameters, Node body, A arg) {
return bulkHandleFunctionDeclaration(node, arg);
}
@override
R visitTopLevelFunctionDeclaration(FunctionExpression node,
MethodElement function, NodeList parameters, Node body, A arg) {
return bulkHandleFunctionDeclaration(node, arg);
}
@override
R visitTopLevelGetterDeclaration(
FunctionExpression node, MethodElement getter, Node body, A arg) {
return bulkHandleFunctionDeclaration(node, arg);
}
@override
R visitTopLevelSetterDeclaration(FunctionExpression node,
MethodElement setter, NodeList parameters, Node body, A arg) {
return bulkHandleFunctionDeclaration(node, arg);
}
}
/// Mixin that implements all variable/field declaration visitor methods of
/// [SemanticDeclarationVisitor] by delegating to a bulk handler.
///
/// Use this mixin to provide a trivial implementation for these methods.
abstract class VariableBulkMixin<R, A>
implements SemanticDeclarationVisitor<R, A>, BulkHandle<R, A> {
R bulkHandleVariableDeclaration(VariableDefinitions node, A arg) {
return bulkHandleNode(node, "Variable declaration `#` unhandled.", arg);
}
@override
R visitInstanceFieldDeclaration(VariableDefinitions node, Node definition,
FieldElement field, Node initializer, A arg) {
return bulkHandleVariableDeclaration(node, arg);
}
@override
R visitLocalConstantDeclaration(VariableDefinitions node, Node definition,
LocalVariableElement variable, ConstantExpression constant, A arg) {
return bulkHandleVariableDeclaration(node, arg);
}
@override
R visitLocalVariableDeclaration(VariableDefinitions node, Node definition,
LocalVariableElement variable, Node initializer, A arg) {
return bulkHandleVariableDeclaration(node, arg);
}
@override
R visitStaticConstantDeclaration(VariableDefinitions node, Node definition,
FieldElement field, ConstantExpression constant, A arg) {
return bulkHandleVariableDeclaration(node, arg);
}
@override
R visitStaticFieldDeclaration(VariableDefinitions node, Node definition,
FieldElement field, Node initializer, A arg) {
return bulkHandleVariableDeclaration(node, arg);
}
@override
R visitTopLevelConstantDeclaration(VariableDefinitions node, Node definition,
FieldElement field, ConstantExpression constant, A arg) {
return bulkHandleVariableDeclaration(node, arg);
}
@override
R visitTopLevelFieldDeclaration(VariableDefinitions node, Node definition,
FieldElement field, Node initializer, A arg) {
return bulkHandleVariableDeclaration(node, arg);
}
}
/// Visitor that implements [SemanticDeclarationVisitor] by the use of `BulkX`
/// mixins.
///
/// This class is useful in itself, but shows how to use the `BulkX` mixins and
/// tests that the union of the `BulkX` mixins implement all `visit` and `error`
/// methods of [SemanticDeclarationVisitor].
class BulkDeclarationVisitor<R, A> extends SemanticDeclarationVisitor<R, A>
with
ConstructorBulkMixin<R, A>,
FunctionBulkMixin<R, A>,
VariableBulkMixin<R, A>,
ParameterBulkMixin<R, A>,
InitializerBulkMixin<R, A> {
@override
R apply(Node node, A arg) {
throw new UnimplementedError("BulkDeclVisitor.apply unimplemented");
}
@override
R bulkHandleNode(Node node, String message, A arg) {
throw new UnimplementedError(
"BulkDeclVisitor.bulkHandleNode unimplemented");
}
@override
applyInitializers(FunctionExpression constructor, A arg) {
throw new UnimplementedError(
"BulkDeclVisitor.applyInitializers unimplemented");
}
@override
applyParameters(NodeList parameters, A arg) {
throw new UnimplementedError(
"BulkDeclVisitor.applyParameters unimplemented");
}
}
/// [SemanticSendVisitor] that visits subnodes.
class TraversalSendMixin<R, A> implements SemanticSendVisitor<R, A> {
@override
R apply(Node node, A arg) {
throw new UnimplementedError("TraversalMixin.apply unimplemented");
}
@override
void previsitDeferredAccess(Send node, PrefixElement prefix, A arg) {}
@override
R errorInvalidCompound(Send node, ErroneousElement error,
AssignmentOperator operator, Node rhs, A arg) {
apply(rhs, arg);
return null;
}
@override
R errorInvalidGet(Send node, ErroneousElement error, A arg) {
return null;
}
@override
R errorInvalidInvoke(Send node, ErroneousElement error, NodeList arguments,
Selector selector, A arg) {
apply(arguments, arg);
return null;
}
@override
R errorInvalidPostfix(
Send node, ErroneousElement error, IncDecOperator operator, A arg) {
return null;
}
@override
R errorInvalidPrefix(
Send node, ErroneousElement error, IncDecOperator operator, A arg) {
return null;
}
@override
R errorInvalidSet(Send node, ErroneousElement error, Node rhs, A arg) {
apply(rhs, arg);
return null;
}
@override
R errorInvalidUnary(
Send node, UnaryOperator operator, ErroneousElement error, A arg) {
return null;
}
@override
R errorInvalidEquals(Send node, ErroneousElement error, Node right, A arg) {
apply(right, arg);
return null;
}
@override
R errorInvalidNotEquals(
Send node, ErroneousElement error, Node right, A arg) {
apply(right, arg);
return null;
}
@override
R errorInvalidBinary(Send node, ErroneousElement error,
BinaryOperator operator, Node right, A arg) {
apply(right, arg);
return null;
}
@override
R errorInvalidIndex(Send node, ErroneousElement error, Node index, A arg) {
apply(index, arg);
return null;
}
@override
R errorInvalidIndexSet(
Send node, ErroneousElement error, Node index, Node rhs, A arg) {
apply(index, arg);
apply(rhs, arg);
return null;
}
@override
R errorInvalidCompoundIndexSet(Send node, ErroneousElement error, Node index,
AssignmentOperator operator, Node rhs, A arg) {
apply(index, arg);
apply(rhs, arg);
return null;
}
@override
R errorInvalidIndexPrefix(Send node, ErroneousElement error, Node index,
IncDecOperator operator, A arg) {
apply(index, arg);
return null;
}
@override
R errorInvalidIndexPostfix(Send node, ErroneousElement error, Node index,
IncDecOperator operator, A arg) {
apply(index, arg);
return null;
}
@override
R visitClassTypeLiteralSet(
SendSet node, ConstantExpression constant, Node rhs, A arg) {
apply(rhs, arg);
return null;
}
@override
R visitDynamicTypeLiteralSet(
SendSet node, ConstantExpression constant, Node rhs, A arg) {
apply(rhs, arg);
return null;
}
@override
R visitFinalLocalVariableCompound(Send node, LocalVariableElement variable,
AssignmentOperator operator, Node rhs, A arg) {
apply(rhs, arg);
return null;
}
@override
R visitFinalLocalVariableSet(
SendSet node, LocalVariableElement variable, Node rhs, A arg) {
apply(rhs, arg);
return null;
}
@override
R visitFinalParameterCompound(Send node, ParameterElement parameter,
AssignmentOperator operator, Node rhs, A arg) {
apply(rhs, arg);
return null;
}
@override
R visitFinalParameterSet(
SendSet node, ParameterElement parameter, Node rhs, A arg) {
apply(rhs, arg);
return null;
}
@override
R visitFinalStaticFieldCompound(Send node, FieldElement field,
AssignmentOperator operator, Node rhs, A arg) {
apply(rhs, arg);
return null;
}
@override
R visitFinalStaticFieldSet(
SendSet node, FieldElement field, Node rhs, A arg) {
apply(rhs, arg);
return null;
}
@override
R visitFinalSuperFieldSet(SendSet node, FieldElement field, Node rhs, A arg) {
apply(rhs, arg);
return null;
}
@override
R visitFinalTopLevelFieldCompound(Send node, FieldElement field,
AssignmentOperator operator, Node rhs, A arg) {
apply(rhs, arg);
return null;
}
@override
R visitFinalTopLevelFieldSet(
SendSet node, FieldElement field, Node rhs, A arg) {
apply(rhs, arg);
return null;
}
@override
R visitLocalFunctionCompound(Send node, LocalFunctionElement function,
AssignmentOperator operator, Node rhs, A arg) {
apply(rhs, arg);
return null;
}
@override
R visitLocalFunctionPostfix(Send node, LocalFunctionElement function,
IncDecOperator operator, A arg) {
return null;
}
@override
R visitLocalFunctionPrefix(Send node, LocalFunctionElement function,
IncDecOperator operator, A arg) {
return null;
}
@override
R visitLocalFunctionSet(
SendSet node, LocalFunctionElement function, Node rhs, A arg) {
apply(rhs, arg);
return null;
}
@override
R visitStaticFunctionSet(Send node, MethodElement function, Node rhs, A arg) {
apply(rhs, arg);
return null;
}
@override
R visitStaticGetterSet(
SendSet node, FunctionElement getter, Node rhs, A arg) {
apply(rhs, arg);
return null;
}
@override
R visitStaticSetterGet(Send node, FunctionElement setter, A arg) {
return null;
}
@override
R visitStaticSetterInvoke(Send node, FunctionElement setter,
NodeList arguments, CallStructure callStructure, A arg) {
apply(arguments, arg);
return null;
}
@override
R visitSuperGetterSet(SendSet node, FunctionElement getter, Node rhs, A arg) {
apply(rhs, arg);
return null;
}
@override
R visitSuperMethodSet(Send node, MethodElement method, Node rhs, A arg) {
apply(rhs, arg);
return null;
}
@override
R visitSuperSetterGet(Send node, FunctionElement setter, A arg) {
return null;
}
@override
R visitSuperSetterInvoke(Send node, FunctionElement setter,
NodeList arguments, CallStructure callStructure, A arg) {
apply(arguments, arg);
return null;
}
@override
R visitTopLevelFunctionSet(
Send node, MethodElement function, Node rhs, A arg) {
apply(rhs, arg);
return null;
}
@override
R visitTopLevelGetterSet(
SendSet node, FunctionElement getter, Node rhs, A arg) {
apply(rhs, arg);
return null;
}
@override
R visitTopLevelSetterGet(Send node, FunctionElement setter, A arg) {
return null;
}
@override
R visitTopLevelSetterInvoke(Send node, FunctionElement setter,
NodeList arguments, CallStructure callStructure, A arg) {
apply(arguments, arg);
return null;
}
@override
R visitTypeVariableTypeLiteralSet(
SendSet node, TypeVariableElement element, Node rhs, A arg) {
apply(rhs, arg);
return null;
}
@override
R visitTypedefTypeLiteralSet(
SendSet node, ConstantExpression constant, Node rhs, A arg) {
apply(rhs, arg);
return null;
}
@override
R visitUnresolvedSuperIndex(Send node, Element function, Node index, A arg) {
apply(index, arg);
return null;
}
@override
R visitUnresolvedSuperGet(Send node, Element element, A arg) {
return null;
}
@override
R visitUnresolvedSuperSet(Send node, Element element, Node rhs, A arg) {
apply(rhs, arg);
return null;
}
@override
R visitUnresolvedSuperInvoke(Send node, Element function, NodeList arguments,
Selector selector, A arg) {
apply(arguments, arg);
return null;
}
@override
R visitAs(Send node, Node expression, ResolutionDartType type, A arg) {
apply(expression, arg);
return null;
}
@override
R visitBinary(
Send node, Node left, BinaryOperator operator, Node right, A arg) {
apply(left, arg);
apply(right, arg);
return null;
}
@override
R visitClassTypeLiteralCompound(Send node, ConstantExpression constant,
AssignmentOperator operator, Node rhs, A arg) {
apply(rhs, arg);
return null;
}
@override
R visitClassTypeLiteralGet(Send node, ConstantExpression constant, A arg) {
return null;
}
@override
R visitClassTypeLiteralInvoke(Send node, ConstantExpression constant,
NodeList arguments, CallStructure callStructure, A arg) {
apply(arguments, arg);
return null;
}
@override
R visitClassTypeLiteralPostfix(
Send node, ConstantExpression constant, IncDecOperator operator, A arg) {
return null;
}
@override
R visitClassTypeLiteralPrefix(
Send node, ConstantExpression constant, IncDecOperator operator, A arg) {
return null;
}
@override
R visitCompoundIndexSet(SendSet node, Node receiver, Node index,
AssignmentOperator operator, Node rhs, A arg) {
apply(receiver, arg);
apply(index, arg);
apply(rhs, arg);
return null;
}
@override
R visitConstantGet(Send node, ConstantExpression constant, A arg) {
return null;
}
@override
R visitConstantInvoke(Send node, ConstantExpression constant,
NodeList arguments, CallStructure callStructure, A arg) {
apply(arguments, arg);
return null;
}
@override
R visitDynamicPropertyCompound(Send node, Node receiver, Name name,
AssignmentOperator operator, Node rhs, A arg) {
apply(receiver, arg);
apply(rhs, arg);
return null;
}
@override
R visitIfNotNullDynamicPropertyCompound(Send node, Node receiver, Name name,
AssignmentOperator operator, Node rhs, A arg) {
apply(receiver, arg);
apply(rhs, arg);
return null;
}
@override
R visitDynamicPropertyGet(Send node, Node receiver, Name name, A arg) {
apply(receiver, arg);
return null;
}
@override
R visitIfNotNullDynamicPropertyGet(
Send node, Node receiver, Name name, A arg) {
apply(receiver, arg);
return null;
}
@override
R visitDynamicPropertyInvoke(
Send node, Node receiver, NodeList arguments, Selector selector, A arg) {
apply(receiver, arg);
apply(arguments, arg);
return null;
}
@override
R visitIfNotNullDynamicPropertyInvoke(
Send node, Node receiver, NodeList arguments, Selector selector, A arg) {
apply(receiver, arg);
apply(arguments, arg);
return null;
}
@override
R visitDynamicPropertyPostfix(
Send node, Node receiver, Name name, IncDecOperator operator, A arg) {
apply(receiver, arg);
return null;
}
@override
R visitIfNotNullDynamicPropertyPostfix(
Send node, Node receiver, Name name, IncDecOperator operator, A arg) {
apply(receiver, arg);
return null;
}
@override
R visitDynamicPropertyPrefix(
Send node, Node receiver, Name name, IncDecOperator operator, A arg) {
apply(receiver, arg);
return null;
}
@override
R visitIfNotNullDynamicPropertyPrefix(
Send node, Node receiver, Name name, IncDecOperator operator, A arg) {
apply(receiver, arg);
return null;
}
@override
R visitDynamicPropertySet(
SendSet node, Node receiver, Name name, Node rhs, A arg) {
apply(receiver, arg);
apply(rhs, arg);
return null;
}
@override
R visitIfNotNullDynamicPropertySet(
SendSet node, Node receiver, Name name, Node rhs, A arg) {
apply(receiver, arg);
apply(rhs, arg);
return null;
}
@override
R visitDynamicTypeLiteralCompound(Send node, ConstantExpression constant,
AssignmentOperator operator, Node rhs, A arg) {
apply(rhs, arg);
return null;
}
@override
R visitDynamicTypeLiteralGet(Send node, ConstantExpression constant, A arg) {
return null;
}
@override
R visitDynamicTypeLiteralInvoke(Send node, ConstantExpression constant,
NodeList arguments, CallStructure callStructure, A arg) {
apply(arguments, arg);
return null;
}
@override
R visitDynamicTypeLiteralPostfix(
Send node, ConstantExpression constant, IncDecOperator operator, A arg) {
return null;
}
@override
R visitDynamicTypeLiteralPrefix(
Send node, ConstantExpression constant, IncDecOperator operator, A arg) {
return null;
}
@override
R visitEquals(Send node, Node left, Node right, A arg) {
apply(left, arg);
apply(right, arg);
return null;
}
@override
R visitExpressionInvoke(Send node, Node expression, NodeList arguments,
CallStructure callStructure, A arg) {
apply(expression, arg);
apply(arguments, arg);
return null;
}
@override
R visitIndex(Send node, Node receiver, Node index, A arg) {
apply(receiver, arg);
apply(index, arg);
return null;
}
@override
R visitIndexSet(SendSet node, Node receiver, Node index, Node rhs, A arg) {
apply(receiver, arg);
apply(index, arg);
apply(rhs, arg);
return null;
}
@override
R visitIs(Send node, Node expression, ResolutionDartType type, A arg) {
apply(expression, arg);
return null;
}
@override
R visitIsNot(Send node, Node expression, ResolutionDartType type, A arg) {
apply(expression, arg);
return null;
}
@override
R visitLocalFunctionGet(Send node, LocalFunctionElement function, A arg) {
return null;
}
@override
R visitLocalFunctionInvoke(Send node, LocalFunctionElement function,
NodeList arguments, CallStructure callStructure, A arg) {
apply(arguments, arg);
return null;
}
@override
R visitLocalFunctionIncompatibleInvoke(
Send node,
LocalFunctionElement function,
NodeList arguments,
CallStructure callStructure,
A arg) {
apply(arguments, arg);
return null;
}
@override
R visitLocalVariableCompound(Send node, LocalVariableElement variable,
AssignmentOperator operator, Node rhs, A arg) {
apply(rhs, arg);
return null;
}
@override
R visitLocalVariableGet(Send node, LocalVariableElement variable, A arg) {
return null;
}