Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: pkg/compiler/lib/src/resolution/semantic_visitor_mixins.dart

Issue 1126173002: Refactor handling of compounds. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/resolution/semantic_visitor_mixins.dart
diff --git a/pkg/compiler/lib/src/resolution/semantic_visitor_mixins.dart b/pkg/compiler/lib/src/resolution/semantic_visitor_mixins.dart
index 0a4a9e48d455a2f5a621d6b843753945e66bc5bd..c58142f53b00364f2a676c0eae1547d2420368b2 100644
--- a/pkg/compiler/lib/src/resolution/semantic_visitor_mixins.dart
+++ b/pkg/compiler/lib/src/resolution/semantic_visitor_mixins.dart
@@ -33,34 +33,6 @@ abstract class ErrorBulkMixin<R, A>
}
@override
- R errorClassTypeLiteralCompound(
- Send node,
- ConstantExpression constant,
- AssignmentOperator operator,
- Node rhs,
- A arg) {
- return bulkHandleError(node, arg);
- }
-
- @override
- R errorClassTypeLiteralPostfix(
- Send node,
- ConstantExpression constant,
- IncDecOperator operator,
- A arg) {
- return bulkHandleError(node, arg);
- }
-
- @override
- R errorClassTypeLiteralPrefix(
- Send node,
- ConstantExpression constant,
- IncDecOperator operator,
- A arg) {
- return bulkHandleError(node, arg);
- }
-
- @override
R errorClassTypeLiteralSet(
SendSet node,
ConstantExpression constant,
@@ -70,34 +42,6 @@ abstract class ErrorBulkMixin<R, A>
}
@override
- R errorDynamicTypeLiteralCompound(
- Send node,
- ConstantExpression constant,
- AssignmentOperator operator,
- Node rhs,
- A arg) {
- return bulkHandleError(node, arg);
- }
-
- @override
- R errorDynamicTypeLiteralPostfix(
- Send node,
- ConstantExpression constant,
- IncDecOperator operator,
- A arg) {
- return bulkHandleError(node, arg);
- }
-
- @override
- R errorDynamicTypeLiteralPrefix(
- Send node,
- ConstantExpression constant,
- IncDecOperator operator,
- A arg) {
- return bulkHandleError(node, arg);
- }
-
- @override
R errorDynamicTypeLiteralSet(
SendSet node,
ConstantExpression constant,
@@ -107,17 +51,6 @@ abstract class ErrorBulkMixin<R, A>
}
@override
- R errorFinalLocalVariableCompound(
- Send node,
- LocalVariableElement
- variable,
- AssignmentOperator operator,
- Node rhs,
- A arg) {
- return bulkHandleError(node, arg);
- }
-
- @override
R errorFinalLocalVariableSet(
SendSet node,
LocalVariableElement variable,
@@ -127,16 +60,6 @@ abstract class ErrorBulkMixin<R, A>
}
@override
- R errorFinalParameterCompound(
- Send node,
- ParameterElement parameter,
- AssignmentOperator operator,
- Node rhs,
- A arg) {
- return bulkHandleError(node, arg);
- }
-
- @override
R errorFinalParameterSet(
SendSet node,
ParameterElement parameter,
@@ -146,16 +69,6 @@ abstract class ErrorBulkMixin<R, A>
}
@override
- R errorFinalStaticFieldCompound(
- Send node,
- FieldElement field,
- AssignmentOperator operator,
- Node rhs,
- A arg) {
- return bulkHandleError(node, arg);
- }
-
- @override
R errorFinalStaticFieldSet(
SendSet node,
FieldElement field,
@@ -165,16 +78,6 @@ abstract class ErrorBulkMixin<R, A>
}
@override
- R errorFinalSuperFieldCompound(
- Send node,
- FieldElement field,
- AssignmentOperator operator,
- Node rhs,
- A arg) {
- return bulkHandleError(node, arg);
- }
-
- @override
R errorFinalSuperFieldSet(
SendSet node,
FieldElement field,
@@ -184,16 +87,6 @@ abstract class ErrorBulkMixin<R, A>
}
@override
- R errorFinalTopLevelFieldCompound(
- Send node,
- FieldElement field,
- AssignmentOperator operator,
- Node rhs,
- A arg) {
- return bulkHandleError(node, arg);
- }
-
- @override
R errorFinalTopLevelFieldSet(
SendSet node,
FieldElement field,
@@ -203,34 +96,6 @@ abstract class ErrorBulkMixin<R, A>
}
@override
- R errorLocalFunctionCompound(
- Send node,
- LocalFunctionElement function,
- AssignmentOperator operator,
- Node rhs,
- A arg) {
- return bulkHandleError(node, arg);
- }
-
- @override
- R errorLocalFunctionPostfix(
- Send node,
- LocalFunctionElement function,
- IncDecOperator operator,
- A arg) {
- return bulkHandleError(node, arg);
- }
-
- @override
- R errorLocalFunctionPrefix(
- Send node,
- LocalFunctionElement function,
- IncDecOperator operator,
- A arg) {
- return bulkHandleError(node, arg);
- }
-
- @override
R errorLocalFunctionSet(
SendSet node,
LocalFunctionElement function,
@@ -359,34 +224,6 @@ abstract class ErrorBulkMixin<R, A>
}
@override
- R errorTypeVariableTypeLiteralCompound(
- Send node,
- TypeVariableElement element,
- AssignmentOperator operator,
- Node rhs,
- A arg) {
- return bulkHandleError(node, arg);
- }
-
- @override
- R errorTypeVariableTypeLiteralPostfix(
- Send node,
- TypeVariableElement element,
- IncDecOperator operator,
- A arg) {
- return bulkHandleError(node, arg);
- }
-
- @override
- R errorTypeVariableTypeLiteralPrefix(
- Send node,
- TypeVariableElement element,
- IncDecOperator operator,
- A arg) {
- return bulkHandleError(node, arg);
- }
-
- @override
R errorTypeVariableTypeLiteralSet(
SendSet node,
TypeVariableElement element,
@@ -396,34 +233,6 @@ abstract class ErrorBulkMixin<R, A>
}
@override
- R errorTypedefTypeLiteralCompound(
- Send node,
- ConstantExpression constant,
- AssignmentOperator operator,
- Node rhs,
- A arg) {
- return bulkHandleError(node, arg);
- }
-
- @override
- R errorTypedefTypeLiteralPostfix(
- Send node,
- ConstantExpression constant,
- IncDecOperator operator,
- A arg) {
- return bulkHandleError(node, arg);
- }
-
- @override
- R errorTypedefTypeLiteralPrefix(
- Send node,
- ConstantExpression constant,
- IncDecOperator operator,
- A arg) {
- return bulkHandleError(node, arg);
- }
-
- @override
R errorTypedefTypeLiteralSet(
SendSet node,
ConstantExpression constant,
@@ -433,34 +242,6 @@ abstract class ErrorBulkMixin<R, A>
}
@override
- R errorUnresolvedCompound(
- Send node,
- Element element,
- AssignmentOperator operator,
- Node rhs,
- A arg) {
- return bulkHandleError(node, arg);
- }
-
- @override
- R errorUnresolvedPostfix(
- Send node,
- Element element,
- IncDecOperator operator,
- A arg) {
- return bulkHandleError(node, arg);
- }
-
- @override
- R errorUnresolvedPrefix(
- Send node,
- Element element,
- IncDecOperator operator,
- A arg) {
- return bulkHandleError(node, arg);
- }
-
- @override
R errorUnresolvedSet(
Send node,
Element element,
@@ -633,6 +414,7 @@ abstract class PrefixBulkMixin<R, A>
R visitUnresolvedSuperGetterIndexPrefix(
Send node,
Element element,
+ MethodElement setter,
Node index,
IncDecOperator operator,
A arg) {
@@ -651,6 +433,16 @@ abstract class PrefixBulkMixin<R, A>
}
@override
+ R visitUnresolvedSuperIndexPrefix(
+ Send node,
+ Element element,
+ Node index,
+ IncDecOperator operator,
+ A arg) {
+ return bulkHandlePrefix(node, arg);
+ }
+
+ @override
R visitSuperMethodSetterPrefix(
Send node,
FunctionElement method,
@@ -698,3012 +490,2924 @@ abstract class PrefixBulkMixin<R, A>
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(
+ R visitClassTypeLiteralPrefix(
Send node,
- Node receiver,
+ ConstantExpression constant,
IncDecOperator operator,
- Selector getterSelector,
- Selector setterSelector,
A arg) {
- return bulkHandlePostfix(node, arg);
+ return bulkHandlePrefix(node, arg);
}
@override
- R visitIndexPostfix(
+ R visitDynamicTypeLiteralPrefix(
Send node,
- Node receiver,
- Node index,
+ ConstantExpression constant,
IncDecOperator operator,
A arg) {
- return bulkHandlePostfix(node, arg);
+ return bulkHandlePrefix(node, arg);
}
@override
- R visitLocalVariablePostfix(
+ R visitLocalFunctionPrefix(
Send node,
- LocalVariableElement variable,
+ LocalFunctionElement function,
IncDecOperator operator,
A arg) {
- return bulkHandlePostfix(node, arg);
+ return bulkHandlePrefix(node, arg);
}
@override
- R visitParameterPostfix(
+ R visitTypeVariableTypeLiteralPrefix(
Send node,
- ParameterElement parameter,
+ TypeVariableElement element,
IncDecOperator operator,
A arg) {
- return bulkHandlePostfix(node, arg);
+ return bulkHandlePrefix(node, arg);
}
@override
- R visitStaticFieldPostfix(
+ R visitTypedefTypeLiteralPrefix(
Send node,
- FieldElement field,
+ ConstantExpression constant,
IncDecOperator operator,
A arg) {
- return bulkHandlePostfix(node, arg);
+ return bulkHandlePrefix(node, arg);
}
@override
- R visitStaticGetterSetterPostfix(
+ R visitUnresolvedStaticGetterPrefix(
Send node,
- FunctionElement getter,
- FunctionElement setter,
+ Element element,
+ MethodElement setter,
IncDecOperator operator,
A arg) {
- return bulkHandlePostfix(node, arg);
+ return bulkHandlePrefix(node, arg);
}
@override
- R visitStaticMethodSetterPostfix(
+ R visitUnresolvedTopLevelGetterPrefix(
Send node,
- FunctionElement getter,
- FunctionElement setter,
+ Element element,
+ MethodElement setter,
IncDecOperator operator,
A arg) {
- return bulkHandlePostfix(node, arg);
+ return bulkHandlePrefix(node, arg);
}
@override
- R visitSuperFieldFieldPostfix(
+ R visitUnresolvedStaticSetterPrefix(
Send node,
- FieldElement readField,
- FieldElement writtenField,
+ MethodElement getter,
+ Element element,
IncDecOperator operator,
A arg) {
- return bulkHandlePostfix(node, arg);
+ return bulkHandlePrefix(node, arg);
}
@override
- R visitSuperFieldPostfix(
+ R visitUnresolvedTopLevelSetterPrefix(
Send node,
- FieldElement field,
+ MethodElement getter,
+ Element element,
IncDecOperator operator,
A arg) {
- return bulkHandlePostfix(node, arg);
+ return bulkHandlePrefix(node, arg);
}
@override
- R visitSuperFieldSetterPostfix(
+ R visitStaticMethodPrefix(
Send node,
- FieldElement field,
- FunctionElement setter,
+ MethodElement method,
IncDecOperator operator,
A arg) {
- return bulkHandlePostfix(node, arg);
+ return bulkHandlePrefix(node, arg);
}
@override
- R visitSuperGetterFieldPostfix(
+ R visitTopLevelMethodPrefix(
Send node,
- FunctionElement getter,
- FieldElement field,
+ MethodElement method,
IncDecOperator operator,
A arg) {
- return bulkHandlePostfix(node, arg);
+ return bulkHandlePrefix(node, arg);
}
@override
- R visitSuperGetterSetterPostfix(
+ R visitUnresolvedPrefix(
Send node,
- FunctionElement getter,
- FunctionElement setter,
+ Element element,
IncDecOperator operator,
A arg) {
- return bulkHandlePostfix(node, arg);
+ return bulkHandlePrefix(node, arg);
}
@override
- R visitSuperIndexPostfix(
+ R visitFinalLocalVariablePrefix(
Send node,
- FunctionElement indexFunction,
- FunctionElement indexSetFunction,
- Node index,
+ LocalVariableElement variable,
IncDecOperator operator,
A arg) {
- return bulkHandlePostfix(node, arg);
+ return bulkHandlePrefix(node, arg);
}
@override
- R visitUnresolvedSuperGetterIndexPostfix(
+ R visitFinalParameterPrefix(
Send node,
- Element element,
- Node index,
+ ParameterElement parameter,
IncDecOperator operator,
A arg) {
- return bulkHandlePostfix(node, arg);
+ return bulkHandlePrefix(node, arg);
}
@override
- R visitUnresolvedSuperSetterIndexPostfix(
+ R visitFinalStaticFieldPrefix(
Send node,
- MethodElement getter,
- Element element,
- Node index,
+ FieldElement field,
IncDecOperator operator,
A arg) {
- return bulkHandlePostfix(node, arg);
+ return bulkHandlePrefix(node, arg);
}
@override
- R visitSuperMethodSetterPostfix(
+ R visitFinalSuperFieldPrefix(
Send node,
- FunctionElement method,
- FunctionElement setter,
+ FieldElement field,
IncDecOperator operator,
A arg) {
- return bulkHandlePostfix(node, arg);
+ return bulkHandlePrefix(node, arg);
}
@override
- R visitThisPropertyPostfix(
+ R visitSuperMethodPrefix(
Send node,
+ FunctionElement method,
IncDecOperator operator,
- Selector getterSelector,
- Selector setterSelector,
A arg) {
- return bulkHandlePostfix(node, arg);
+ return bulkHandlePrefix(node, arg);
}
@override
- R visitTopLevelFieldPostfix(
+ R visitFinalTopLevelFieldPrefix(
Send node,
FieldElement field,
IncDecOperator operator,
A arg) {
- return bulkHandlePostfix(node, arg);
+ return bulkHandlePrefix(node, arg);
}
@override
- R visitTopLevelGetterSetterPostfix(
+ R visitUnresolvedSuperPrefix(
Send node,
- FunctionElement getter,
- FunctionElement setter,
+ Element element,
IncDecOperator operator,
A arg) {
- return bulkHandlePostfix(node, arg);
+ return bulkHandlePrefix(node, arg);
}
@override
- R visitTopLevelMethodSetterPostfix(
+ R visitUnresolvedSuperGetterPrefix(
Send node,
- FunctionElement method,
- FunctionElement setter,
+ Element element,
+ MethodElement setter,
IncDecOperator operator,
A arg) {
- return bulkHandlePostfix(node, 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 `visitXCompound` methods of [SemanticSendVisitor]
+/// Mixin that implements all `visitXPostfix` methods of [SemanticSendVisitor]
/// by delegating to a bulk handler.
///
-/// Use this mixin to provide a trivial implementation for all `xCompound`
+/// Use this mixin to provide a trivial implementation for all `visitXPostfix`
/// methods.
-abstract class CompoundBulkMixin<R, A>
+abstract class PostfixBulkMixin<R, A>
implements SemanticSendVisitor<R, A>, BulkHandle<R, A> {
- R bulkHandleCompound(Send node, A arg) {
- return bulkHandleNode(node, "Compound assignment `#` unhandled.", arg);
+ R bulkHandlePostfix(Send node, A arg) {
+ return bulkHandleNode(node, "Postfix expression `#` unhandled.", arg);
}
@override
- R visitDynamicPropertyCompound(
+ R visitDynamicPropertyPostfix(
Send node,
Node receiver,
- AssignmentOperator operator,
- Node rhs,
+ IncDecOperator operator,
Selector getterSelector,
Selector setterSelector,
A arg) {
- return bulkHandleCompound(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitLocalVariableCompound(
+ R visitIndexPostfix(
+ Send node,
+ Node receiver,
+ Node index,
+ IncDecOperator operator,
+ A arg) {
+ return bulkHandlePostfix(node, arg);
+ }
+
+ @override
+ R visitLocalVariablePostfix(
Send node,
LocalVariableElement variable,
- AssignmentOperator operator,
- Node rhs,
+ IncDecOperator operator,
A arg) {
- return bulkHandleCompound(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitParameterCompound(
+ R visitParameterPostfix(
Send node,
ParameterElement parameter,
- AssignmentOperator operator,
- Node rhs,
+ IncDecOperator operator,
A arg) {
- return bulkHandleCompound(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitStaticFieldCompound(
+ R visitStaticFieldPostfix(
Send node,
FieldElement field,
- AssignmentOperator operator,
- Node rhs,
+ IncDecOperator operator,
A arg) {
- return bulkHandleCompound(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitStaticGetterSetterCompound(
+ R visitStaticGetterSetterPostfix(
Send node,
FunctionElement getter,
FunctionElement setter,
- AssignmentOperator operator,
- Node rhs,
+ IncDecOperator operator,
A arg) {
- return bulkHandleCompound(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitStaticMethodSetterCompound(
+ R visitStaticMethodSetterPostfix(
Send node,
- FunctionElement method,
+ FunctionElement getter,
FunctionElement setter,
- AssignmentOperator operator,
- Node rhs,
+ IncDecOperator operator,
A arg) {
- return bulkHandleCompound(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitSuperFieldCompound(
+ R visitSuperFieldFieldPostfix(
+ Send node,
+ FieldElement readField,
+ FieldElement writtenField,
+ IncDecOperator operator,
+ A arg) {
+ return bulkHandlePostfix(node, arg);
+ }
+
+ @override
+ R visitSuperFieldPostfix(
Send node,
FieldElement field,
- AssignmentOperator operator,
- Node rhs,
+ IncDecOperator operator,
A arg) {
- return bulkHandleCompound(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitSuperFieldSetterCompound(
+ R visitSuperFieldSetterPostfix(
Send node,
FieldElement field,
FunctionElement setter,
- AssignmentOperator operator,
- Node rhs,
+ IncDecOperator operator,
A arg) {
- return bulkHandleCompound(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitSuperGetterFieldCompound(
+ R visitSuperGetterFieldPostfix(
Send node,
FunctionElement getter,
FieldElement field,
- AssignmentOperator operator,
- Node rhs,
+ IncDecOperator operator,
A arg) {
- return bulkHandleCompound(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitSuperGetterSetterCompound(
+ R visitSuperGetterSetterPostfix(
Send node,
FunctionElement getter,
FunctionElement setter,
- AssignmentOperator operator,
- Node rhs,
+ IncDecOperator operator,
A arg) {
- return bulkHandleCompound(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitSuperMethodSetterCompound(
+ R visitSuperIndexPostfix(
Send node,
- FunctionElement method,
- FunctionElement setter,
- AssignmentOperator operator,
- Node rhs,
+ FunctionElement indexFunction,
+ FunctionElement indexSetFunction,
+ Node index,
+ IncDecOperator operator,
A arg) {
- return bulkHandleCompound(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitThisPropertyCompound(
+ R visitUnresolvedSuperGetterIndexPostfix(
Send node,
- AssignmentOperator operator,
- Node rhs,
- Selector getterSelector,
- Selector setterSelector,
+ Element element,
+ MethodElement setter,
+ Node index,
+ IncDecOperator operator,
A arg) {
- return bulkHandleCompound(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitTopLevelFieldCompound(
+ R visitUnresolvedSuperSetterIndexPostfix(
Send node,
- FieldElement field,
- AssignmentOperator operator,
- Node rhs,
+ MethodElement getter,
+ Element element,
+ Node index,
+ IncDecOperator operator,
A arg) {
- return bulkHandleCompound(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitTopLevelGetterSetterCompound(
+ R visitUnresolvedSuperIndexPostfix(
Send node,
- FunctionElement getter,
- FunctionElement setter,
- AssignmentOperator operator,
- Node rhs,
+ Element element,
+ Node index,
+ IncDecOperator operator,
A arg) {
- return bulkHandleCompound(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitTopLevelMethodSetterCompound(
+ R visitSuperMethodSetterPostfix(
Send node,
FunctionElement method,
FunctionElement setter,
- AssignmentOperator operator,
- Node rhs,
+ IncDecOperator operator,
A arg) {
- return bulkHandleCompound(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);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitClassTypeLiteralInvoke(
+ R visitThisPropertyPostfix(
Send node,
- ConstantExpression constant,
- NodeList arguments,
- CallStructure callStructure,
+ IncDecOperator operator,
+ Selector getterSelector,
+ Selector setterSelector,
A arg) {
- return bulkHandleInvoke(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitDynamicPropertyInvoke(
+ R visitTopLevelFieldPostfix(
Send node,
- Node receiver,
- NodeList arguments,
- Selector selector,
+ FieldElement field,
+ IncDecOperator operator,
A arg) {
- return bulkHandleInvoke(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitDynamicTypeLiteralInvoke(
+ R visitTopLevelGetterSetterPostfix(
Send node,
- ConstantExpression constant,
- NodeList arguments,
- CallStructure callStructure,
+ FunctionElement getter,
+ FunctionElement setter,
+ IncDecOperator operator,
A arg) {
- return bulkHandleInvoke(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitExpressionInvoke(
+ R visitTopLevelMethodSetterPostfix(
Send node,
- Node expression,
- NodeList arguments,
- Selector selector,
+ FunctionElement method,
+ FunctionElement setter,
+ IncDecOperator operator,
A arg) {
- return bulkHandleInvoke(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitLocalFunctionInvoke(
+ R visitClassTypeLiteralPostfix(
Send node,
- LocalFunctionElement function,
- NodeList arguments,
- CallStructure callStructure,
+ ConstantExpression constant,
+ IncDecOperator operator,
A arg) {
- return bulkHandleInvoke(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitLocalVariableInvoke(
+ R visitDynamicTypeLiteralPostfix(
Send node,
- LocalVariableElement variable,
- NodeList arguments,
- CallStructure callStructure,
+ ConstantExpression constant,
+ IncDecOperator operator,
A arg) {
- return bulkHandleInvoke(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitParameterInvoke(
+ R visitLocalFunctionPostfix(
Send node,
- ParameterElement parameter,
- NodeList arguments,
- CallStructure callStructure,
+ LocalFunctionElement function,
+ IncDecOperator operator,
A arg) {
- return bulkHandleInvoke(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitStaticFieldInvoke(
+ R visitTypeVariableTypeLiteralPostfix(
Send node,
- FieldElement field,
- NodeList arguments,
- CallStructure callStructure,
+ TypeVariableElement element,
+ IncDecOperator operator,
A arg) {
- return bulkHandleInvoke(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitStaticFunctionInvoke(
+ R visitTypedefTypeLiteralPostfix(
Send node,
- MethodElement function,
- NodeList arguments,
- CallStructure callStructure,
+ ConstantExpression constant,
+ IncDecOperator operator,
A arg) {
- return bulkHandleInvoke(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitStaticFunctionIncompatibleInvoke(
+ R visitUnresolvedStaticGetterPostfix(
Send node,
- MethodElement function,
- NodeList arguments,
- CallStructure callStructure,
+ Element element,
+ MethodElement setter,
+ IncDecOperator operator,
A arg) {
- return bulkHandleInvoke(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitStaticGetterInvoke(
+ R visitUnresolvedTopLevelGetterPostfix(
Send node,
- FunctionElement getter,
- NodeList arguments,
- CallStructure callStructure,
+ Element element,
+ MethodElement setter,
+ IncDecOperator operator,
A arg) {
- return bulkHandleInvoke(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitSuperFieldInvoke(
+ R visitUnresolvedStaticSetterPostfix(
Send node,
- FieldElement field,
- NodeList arguments,
- CallStructure callStructure,
+ MethodElement getter,
+ Element element,
+ IncDecOperator operator,
A arg) {
- return bulkHandleInvoke(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitSuperGetterInvoke(
+ R visitUnresolvedTopLevelSetterPostfix(
Send node,
- FunctionElement getter,
- NodeList arguments,
- CallStructure callStructure,
+ MethodElement getter,
+ Element element,
+ IncDecOperator operator,
A arg) {
- return bulkHandleInvoke(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitSuperMethodInvoke(
+ R visitStaticMethodPostfix(
Send node,
MethodElement method,
- NodeList arguments,
- CallStructure callStructure,
+ IncDecOperator operator,
A arg) {
- return bulkHandleInvoke(node, arg);
+ return bulkHandlePostfix(node, arg);
}
- @override
- R visitSuperMethodIncompatibleInvoke(
+ R visitToplevelMethodPostfix(
Send node,
MethodElement method,
- NodeList arguments,
- CallStructure callStructure,
+ IncDecOperator operator,
A arg) {
- return bulkHandleInvoke(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitThisInvoke(
+ R visitUnresolvedPostfix(
Send node,
- NodeList arguments,
- CallStructure callStructure,
+ Element element,
+ IncDecOperator operator,
A arg) {
- return bulkHandleInvoke(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitThisPropertyInvoke(
+ R visitFinalLocalVariablePostfix(
Send node,
- NodeList arguments,
- Selector selector,
+ LocalVariableElement variable,
+ IncDecOperator operator,
A arg) {
- return bulkHandleInvoke(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitTopLevelFieldInvoke(
+ R visitFinalParameterPostfix(
Send node,
- FieldElement field,
- NodeList arguments,
- CallStructure callStructure,
+ ParameterElement parameter,
+ IncDecOperator operator,
A arg) {
- return bulkHandleInvoke(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitTopLevelFunctionInvoke(
+ R visitFinalStaticFieldPostfix(
Send node,
- MethodElement function,
- NodeList arguments,
- CallStructure callStructure,
+ FieldElement field,
+ IncDecOperator operator,
A arg) {
- return bulkHandleInvoke(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitTopLevelFunctionIncompatibleInvoke(
+ R visitFinalSuperFieldPostfix(
Send node,
- MethodElement function,
- NodeList arguments,
- CallStructure callStructure,
+ FieldElement field,
+ IncDecOperator operator,
A arg) {
- return bulkHandleInvoke(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitTopLevelGetterInvoke(
+ R visitSuperMethodPostfix(
Send node,
- FunctionElement getter,
- NodeList arguments,
- CallStructure callStructure,
+ FunctionElement method,
+ IncDecOperator operator,
A arg) {
- return bulkHandleInvoke(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitTypeVariableTypeLiteralInvoke(
+ R visitFinalTopLevelFieldPostfix(
Send node,
- TypeVariableElement element,
- NodeList arguments,
- CallStructure callStructure,
+ FieldElement field,
+ IncDecOperator operator,
A arg) {
- return bulkHandleInvoke(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitTypedefTypeLiteralInvoke(
+ R visitTopLevelMethodPostfix(
Send node,
- ConstantExpression constant,
- NodeList arguments,
- CallStructure callStructure,
+ MethodElement method,
+ IncDecOperator operator,
A arg) {
- return bulkHandleInvoke(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitConstantInvoke(
+ R visitUnresolvedSuperPostfix(
Send node,
- ConstantExpression constant,
- NodeList arguments,
- CallStructure callStructure,
+ Element element,
+ IncDecOperator operator,
A arg) {
- return bulkHandleInvoke(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitUnresolvedInvoke(
+ R visitUnresolvedSuperGetterPostfix(
Send node,
Element element,
- NodeList arguments,
- Selector selector,
+ MethodElement setter,
+ IncDecOperator operator,
A arg) {
- return bulkHandleInvoke(node, arg);
+ return bulkHandlePostfix(node, arg);
}
@override
- R visitUnresolvedSuperInvoke(
+ R visitUnresolvedSuperSetterPostfix(
Send node,
- Element function,
- NodeList arguments,
- Selector selector,
+ MethodElement getter,
+ Element element,
+ IncDecOperator operator,
A arg) {
- return bulkHandleInvoke(node, arg);
+ return bulkHandlePostfix(node, arg);
}
}
-/// Mixin that implements all `visitXGet` methods of [SemanticSendVisitor] by
-/// delegating to a bulk handler.
+/// Mixin that implements all `visitXCompound` methods of [SemanticSendVisitor]
+/// by delegating to a bulk handler.
///
-/// Use this mixin to provide a trivial implementation for all `visitXGet`
+/// Use this mixin to provide a trivial implementation for all `xCompound`
/// methods.
-abstract class GetBulkMixin<R, A>
+abstract class CompoundBulkMixin<R, A>
implements SemanticSendVisitor<R, A>, BulkHandle<R, A> {
- R bulkHandleGet(Node node, A arg) {
- return bulkHandleNode(node, "Read `#` unhandled.", arg);
+ R bulkHandleCompound(Send node, A arg) {
+ return bulkHandleNode(node, "Compound assignment `#` unhandled.", arg);
}
@override
- R visitClassTypeLiteralGet(
+ R visitDynamicPropertyCompound(
Send node,
- ConstantExpression constant,
+ Node receiver,
+ AssignmentOperator operator,
+ Node rhs,
+ Selector getterSelector,
+ Selector setterSelector,
A arg) {
- return bulkHandleGet(node, arg);
+ return bulkHandleCompound(node, arg);
}
@override
- R visitDynamicPropertyGet(
+ R visitLocalVariableCompound(
Send node,
- Node receiver,
- Selector selector,
+ LocalVariableElement variable,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return bulkHandleGet(node, arg);
+ return bulkHandleCompound(node, arg);
}
@override
- R visitDynamicTypeLiteralGet(
+ R visitParameterCompound(
Send node,
- ConstantExpression constant,
+ ParameterElement parameter,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return bulkHandleGet(node, arg);
+ return bulkHandleCompound(node, arg);
}
@override
- R visitLocalFunctionGet(
+ R visitStaticFieldCompound(
Send node,
- LocalFunctionElement function,
+ FieldElement field,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return bulkHandleGet(node, arg);
+ return bulkHandleCompound(node, arg);
}
@override
- R visitLocalVariableGet(
+ R visitStaticGetterSetterCompound(
Send node,
- LocalVariableElement variable,
+ FunctionElement getter,
+ FunctionElement setter,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return bulkHandleGet(node, arg);
+ return bulkHandleCompound(node, arg);
}
@override
- R visitParameterGet(
+ R visitStaticMethodSetterCompound(
Send node,
- ParameterElement parameter,
+ FunctionElement method,
+ FunctionElement setter,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return bulkHandleGet(node, arg);
+ return bulkHandleCompound(node, arg);
}
@override
- R visitStaticFieldGet(
+ R visitSuperFieldCompound(
Send node,
FieldElement field,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return bulkHandleGet(node, arg);
+ return bulkHandleCompound(node, arg);
}
@override
- R visitStaticFunctionGet(
+ R visitSuperFieldSetterCompound(
Send node,
- MethodElement function,
+ FieldElement field,
+ FunctionElement setter,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return bulkHandleGet(node, arg);
+ return bulkHandleCompound(node, arg);
}
@override
- R visitStaticGetterGet(
+ R visitSuperGetterFieldCompound(
Send node,
FunctionElement getter,
+ FieldElement field,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return bulkHandleGet(node, arg);
+ return bulkHandleCompound(node, arg);
}
@override
- R visitSuperFieldGet(
+ R visitSuperGetterSetterCompound(
Send node,
- FieldElement field,
+ FunctionElement getter,
+ FunctionElement setter,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return bulkHandleGet(node, arg);
+ return bulkHandleCompound(node, arg);
}
@override
- R visitSuperGetterGet(
+ R visitSuperMethodSetterCompound(
Send node,
- FunctionElement getter,
+ FunctionElement method,
+ FunctionElement setter,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return bulkHandleGet(node, arg);
+ return bulkHandleCompound(node, arg);
}
@override
- R visitSuperMethodGet(
+ R visitThisPropertyCompound(
Send node,
- MethodElement method,
+ AssignmentOperator operator,
+ Node rhs,
+ Selector getterSelector,
+ Selector setterSelector,
A arg) {
- return bulkHandleGet(node, arg);
+ return bulkHandleCompound(node, arg);
}
@override
- R visitThisGet(Identifier node, A arg) {
- return bulkHandleGet(node, arg);
+ R visitTopLevelFieldCompound(
+ Send node,
+ FieldElement field,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ return bulkHandleCompound(node, arg);
}
@override
- R visitThisPropertyGet(
+ R visitTopLevelGetterSetterCompound(
Send node,
- Selector selector,
+ FunctionElement getter,
+ FunctionElement setter,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return bulkHandleGet(node, arg);
+ return bulkHandleCompound(node, arg);
}
@override
- R visitTopLevelFieldGet(
+ R visitTopLevelMethodSetterCompound(
Send node,
- FieldElement field,
+ FunctionElement method,
+ FunctionElement setter,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return bulkHandleGet(node, arg);
+ return bulkHandleCompound(node, arg);
}
@override
- R visitTopLevelFunctionGet(
+ R visitFinalParameterCompound(
Send node,
- MethodElement function,
+ ParameterElement parameter,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return bulkHandleGet(node, arg);
+ return bulkHandleCompound(node, arg);
}
@override
- R visitTopLevelGetterGet(
+ R visitClassTypeLiteralCompound(
Send node,
- FunctionElement getter,
+ ConstantExpression constant,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return bulkHandleGet(node, arg);
+ return bulkHandleCompound(node, arg);
}
@override
- R visitTypeVariableTypeLiteralGet(
+ R visitDynamicTypeLiteralCompound(
Send node,
- TypeVariableElement element,
+ ConstantExpression constant,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return bulkHandleGet(node, arg);
+ return bulkHandleCompound(node, arg);
}
@override
- R visitTypedefTypeLiteralGet(
+ R visitFinalLocalVariableCompound(
Send node,
- ConstantExpression constant,
+ LocalVariableElement
+ variable,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return bulkHandleGet(node, arg);
+ return bulkHandleCompound(node, arg);
}
@override
- R visitConstantGet(
+ R visitFinalStaticFieldCompound(
Send node,
- ConstantExpression constant,
+ FieldElement field,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return bulkHandleGet(node, arg);
+ return bulkHandleCompound(node, arg);
}
@override
- R visitUnresolvedGet(
+ R visitFinalSuperFieldCompound(
Send node,
- Element element,
+ FieldElement field,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return bulkHandleGet(node, arg);
+ return bulkHandleCompound(node, arg);
}
@override
- R visitUnresolvedSuperGet(
+ R visitFinalTopLevelFieldCompound(
Send node,
- Element element,
+ FieldElement field,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return bulkHandleGet(node, arg);
+ return bulkHandleCompound(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 visitLocalFunctionCompound(
+ Send node,
+ LocalFunctionElement function,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ return bulkHandleCompound(node, arg);
}
@override
- R visitDynamicPropertySet(
- SendSet node,
- Node receiver,
- Selector selector,
+ R visitTypeVariableTypeLiteralCompound(
+ Send node,
+ TypeVariableElement element,
+ AssignmentOperator operator,
Node rhs,
A arg) {
- return bulkHandleSet(node, arg);
+ return bulkHandleCompound(node, arg);
}
@override
- R visitLocalVariableSet(
- SendSet node,
- LocalVariableElement variable,
+ R visitTypedefTypeLiteralCompound(
+ Send node,
+ ConstantExpression constant,
+ AssignmentOperator operator,
Node rhs,
A arg) {
- return bulkHandleSet(node, arg);
+ return bulkHandleCompound(node, arg);
}
@override
- R visitParameterSet(
- SendSet node,
- ParameterElement parameter,
+ R visitUnresolvedStaticGetterCompound(
+ Send node,
+ Element element,
+ MethodElement setter,
+ AssignmentOperator operator,
Node rhs,
A arg) {
- return bulkHandleSet(node, arg);
+ return bulkHandleCompound(node, arg);
}
@override
- R visitStaticFieldSet(
- SendSet node,
- FieldElement field,
+ R visitUnresolvedTopLevelGetterCompound(
+ Send node,
+ Element element,
+ MethodElement setter,
+ AssignmentOperator operator,
Node rhs,
A arg) {
- return bulkHandleSet(node, arg);
+ return bulkHandleCompound(node, arg);
}
@override
- R visitStaticSetterSet(
- SendSet node,
- FunctionElement setter,
+ R visitUnresolvedStaticSetterCompound(
+ Send node,
+ MethodElement getter,
+ Element element,
+ AssignmentOperator operator,
Node rhs,
A arg) {
- return bulkHandleSet(node, arg);
+ return bulkHandleCompound(node, arg);
}
@override
- R visitSuperFieldSet(
- SendSet node,
- FieldElement field,
+ R visitUnresolvedTopLevelSetterCompound(
+ Send node,
+ MethodElement getter,
+ Element element,
+ AssignmentOperator operator,
Node rhs,
A arg) {
- return bulkHandleSet(node, arg);
+ return bulkHandleCompound(node, arg);
}
@override
- R visitSuperSetterSet(
- SendSet node,
- FunctionElement setter,
+ R visitStaticMethodCompound(
+ Send node,
+ MethodElement method,
+ AssignmentOperator operator,
Node rhs,
A arg) {
- return bulkHandleSet(node, arg);
+ return bulkHandleCompound(node, arg);
}
@override
- R visitThisPropertySet(
- SendSet node,
- Selector selector,
+ R visitTopLevelMethodCompound(
+ Send node,
+ MethodElement method,
+ AssignmentOperator operator,
Node rhs,
A arg) {
- return bulkHandleSet(node, arg);
+ return bulkHandleCompound(node, arg);
}
@override
- R visitTopLevelFieldSet(
- SendSet node,
- FieldElement field,
+ R visitUnresolvedCompound(
+ Send node,
+ Element element,
+ AssignmentOperator operator,
Node rhs,
A arg) {
- return bulkHandleSet(node, arg);
+ return bulkHandleCompound(node, arg);
}
@override
- R visitTopLevelSetterSet(
- SendSet node,
- FunctionElement setter,
+ R visitSuperFieldFieldCompound(
+ Send node, FieldElement readField,
+ FieldElement writtenField,
+ AssignmentOperator operator,
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);
+ return bulkHandleCompound(node, arg);
}
@override
- R visitSuperCompoundIndexSet(
- SendSet node,
- FunctionElement getter,
- FunctionElement setter,
- Node index,
+ R visitSuperMethodCompound(
+ Send node,
+ FunctionElement method,
AssignmentOperator operator,
Node rhs,
A arg) {
- return bulkHandleIndexSet(node, arg);
+ return bulkHandleCompound(node, arg);
}
@override
- R visitUnresolvedSuperGetterCompoundIndexSet(
- SendSet node,
+ R visitUnresolvedSuperCompound(
+ Send node,
Element element,
- Node index,
AssignmentOperator operator,
Node rhs,
A arg) {
- return bulkHandleIndexSet(node, arg);
+ return bulkHandleCompound(node, arg);
}
@override
- R visitUnresolvedSuperSetterCompoundIndexSet(
- SendSet node,
- MethodElement getter,
- Element element,
- Node index,
+ R visitUnresolvedSuperGetterCompound(
+ Send node, Element element,
+ MethodElement setter,
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);
+ return bulkHandleCompound(node, arg);
}
@override
- R visitUnresolvedSuperIndexSet(
- SendSet node,
+ R visitUnresolvedSuperSetterCompound(
+ Send node, MethodElement getter,
Element element,
- Node index,
+ AssignmentOperator operator,
Node rhs,
A arg) {
- return bulkHandleIndexSet(node, arg);
+ return bulkHandleCompound(node, arg);
}
}
-/// Mixin that implements all binary visitor methods in [SemanticSendVisitor] by
+/// Mixin that implements all `visitXInvoke` methods of [SemanticSendVisitor] by
/// delegating to a bulk handler.
///
-/// Use this mixin to provide a trivial implementation for all binary visitor
+/// Use this mixin to provide a trivial implementation for all `visitXInvoke`
/// methods.
-abstract class BinaryBulkMixin<R, A>
+abstract class InvokeBulkMixin<R, A>
implements SemanticSendVisitor<R, A>, BulkHandle<R, A> {
- R bulkHandleBinary(Send node, A arg) {
- return bulkHandleNode(node, "Binary expression `#` unhandled.", arg);
+ R bulkHandleInvoke(Send node, A arg) {
+ return bulkHandleNode(node, "Invocation `#` unhandled.", arg);
}
@override
- R visitBinary(
+ R visitClassTypeLiteralInvoke(
Send node,
- Node left,
- BinaryOperator operator,
- Node right,
+ ConstantExpression constant,
+ NodeList arguments,
+ CallStructure callStructure,
A arg) {
- return bulkHandleBinary(node, arg);
+ return bulkHandleInvoke(node, arg);
}
@override
- R visitEquals(
+ R visitDynamicPropertyInvoke(
Send node,
- Node left,
- Node right,
+ Node receiver,
+ NodeList arguments,
+ Selector selector,
A arg) {
- return bulkHandleBinary(node, arg);
+ return bulkHandleInvoke(node, arg);
}
@override
- R visitNotEquals(
+ R visitDynamicTypeLiteralInvoke(
Send node,
- Node left,
- Node right,
+ ConstantExpression constant,
+ NodeList arguments,
+ CallStructure callStructure,
A arg) {
- return bulkHandleBinary(node, arg);
+ return bulkHandleInvoke(node, arg);
}
@override
- R visitIndex(
+ R visitExpressionInvoke(
Send node,
- Node receiver,
- Node index,
+ Node expression,
+ NodeList arguments,
+ Selector selector,
A arg) {
- return bulkHandleBinary(node, arg);
+ return bulkHandleInvoke(node, arg);
}
@override
- R visitSuperBinary(
+ R visitLocalFunctionInvoke(
Send node,
- FunctionElement function,
- BinaryOperator operator,
- Node argument,
+ LocalFunctionElement function,
+ NodeList arguments,
+ CallStructure callStructure,
A arg) {
- return bulkHandleBinary(node, arg);
+ return bulkHandleInvoke(node, arg);
}
@override
- R visitSuperEquals(
+ R visitLocalVariableInvoke(
Send node,
- FunctionElement function,
- Node argument,
+ LocalVariableElement variable,
+ NodeList arguments,
+ CallStructure callStructure,
A arg) {
- return bulkHandleBinary(node, arg);
+ return bulkHandleInvoke(node, arg);
}
@override
- R visitSuperNotEquals(
+ R visitParameterInvoke(
Send node,
- FunctionElement function,
- Node argument,
+ ParameterElement parameter,
+ NodeList arguments,
+ CallStructure callStructure,
A arg) {
- return bulkHandleBinary(node, arg);
+ return bulkHandleInvoke(node, arg);
}
@override
- R visitSuperIndex(
+ R visitStaticFieldInvoke(
Send node,
- FunctionElement function,
- Node index,
+ FieldElement field,
+ NodeList arguments,
+ CallStructure callStructure,
A arg) {
- return bulkHandleBinary(node, arg);
+ return bulkHandleInvoke(node, arg);
}
@override
- R visitUnresolvedSuperBinary(
+ R visitStaticFunctionInvoke(
Send node,
- FunctionElement function,
- BinaryOperator operator,
- Node argument,
+ MethodElement function,
+ NodeList arguments,
+ CallStructure callStructure,
A arg) {
- return bulkHandleBinary(node, arg);
+ return bulkHandleInvoke(node, arg);
}
@override
- R visitUnresolvedSuperInvoke(
+ R visitStaticFunctionIncompatibleInvoke(
Send node,
- Element function,
+ MethodElement function,
NodeList arguments,
- Selector selector,
+ CallStructure callStructure,
A arg) {
- return bulkHandleBinary(node, arg);
+ return bulkHandleInvoke(node, arg);
}
@override
- R visitUnresolvedSuperIndex(
+ R visitStaticGetterInvoke(
Send node,
- FunctionElement function,
- Node index,
+ FunctionElement getter,
+ NodeList arguments,
+ CallStructure callStructure,
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);
+ return bulkHandleInvoke(node, arg);
}
@override
- R visitNot(
+ R visitSuperFieldInvoke(
Send node,
- Node expression,
+ FieldElement field,
+ NodeList arguments,
+ CallStructure callStructure,
A arg) {
- return bulkHandleUnary(node, arg);
+ return bulkHandleInvoke(node, arg);
}
@override
- R visitSuperUnary(
+ R visitSuperGetterInvoke(
Send node,
- UnaryOperator operator,
- FunctionElement function,
+ FunctionElement getter,
+ NodeList arguments,
+ CallStructure callStructure,
A arg) {
- return bulkHandleUnary(node, arg);
+ return bulkHandleInvoke(node, arg);
}
@override
- R visitUnary(
+ R visitSuperMethodInvoke(
Send node,
- UnaryOperator operator,
- Node expression,
+ MethodElement method,
+ NodeList arguments,
+ CallStructure callStructure,
A arg) {
- return bulkHandleUnary(node, arg);
+ return bulkHandleInvoke(node, arg);
}
@override
- R visitUnresolvedSuperUnary(
+ R visitSuperMethodIncompatibleInvoke(
Send node,
- UnaryOperator operator,
- FunctionElement function,
+ MethodElement method,
+ NodeList arguments,
+ CallStructure callStructure,
A arg) {
- return bulkHandleUnary(node, arg);
+ return bulkHandleInvoke(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(
+ R visitThisInvoke(
Send node,
- Node expression,
- DartType type,
+ NodeList arguments,
+ CallStructure callStructure,
A arg) {
- return bulkHandleNode(node, 'As cast `#` unhandled.', arg);
+ return bulkHandleInvoke(node, arg);
}
@override
- R visitAssert(
+ R visitThisPropertyInvoke(
Send node,
- Node expression,
+ NodeList arguments,
+ Selector selector,
A arg) {
- return bulkHandleNode(node, 'Assert `#` unhandled.', arg);
+ return bulkHandleInvoke(node, arg);
}
@override
- R visitIs(
+ R visitTopLevelFieldInvoke(
Send node,
- Node expression,
- DartType type,
+ FieldElement field,
+ NodeList arguments,
+ CallStructure callStructure,
A arg) {
- return bulkHandleNode(node, 'Is test `#` unhandled.', arg);
+ return bulkHandleInvoke(node, arg);
}
@override
- R visitIsNot(
+ R visitTopLevelFunctionInvoke(
Send node,
- Node expression,
- DartType type,
+ MethodElement function,
+ NodeList arguments,
+ CallStructure callStructure,
A arg) {
- return bulkHandleNode(node, 'Is not test `#` unhandled.', arg);
+ return bulkHandleInvoke(node, arg);
}
@override
- R visitLogicalAnd(
+ R visitTopLevelFunctionIncompatibleInvoke(
Send node,
- Node left,
- Node right,
+ MethodElement function,
+ NodeList arguments,
+ CallStructure callStructure,
A arg) {
- return bulkHandleNode(node, 'Lazy and `#` unhandled.', arg);
+ return bulkHandleInvoke(node, arg);
}
@override
- R visitLogicalOr(
+ R visitTopLevelGetterInvoke(
Send node,
- Node left,
- Node right,
+ FunctionElement getter,
+ NodeList arguments,
+ CallStructure callStructure,
A arg) {
- return bulkHandleNode(node, 'Lazy or `#` 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);
+ return bulkHandleInvoke(node, arg);
}
@override
- R visitSuperBinary(
+ R visitTypeVariableTypeLiteralInvoke(
Send node,
- FunctionElement function,
- BinaryOperator operator,
- Node argument,
+ TypeVariableElement element,
+ NodeList arguments,
+ CallStructure callStructure,
A arg) {
- return bulkHandleSuper(node, arg);
+ return bulkHandleInvoke(node, arg);
}
@override
- R visitSuperCompoundIndexSet(
- SendSet node,
- FunctionElement getter,
- FunctionElement setter,
- Node index,
- AssignmentOperator operator,
- Node rhs,
+ R visitTypedefTypeLiteralInvoke(
+ Send node,
+ ConstantExpression constant,
+ NodeList arguments,
+ CallStructure callStructure,
A arg) {
- return bulkHandleSuper(node, arg);
+ return bulkHandleInvoke(node, arg);
}
@override
- R visitSuperEquals(
+ R visitConstantInvoke(
Send node,
- FunctionElement function,
- Node argument,
+ ConstantExpression constant,
+ NodeList arguments,
+ CallStructure callStructure,
A arg) {
- return bulkHandleSuper(node, arg);
+ return bulkHandleInvoke(node, arg);
}
@override
- R visitSuperFieldCompound(
+ R visitUnresolvedInvoke(
Send node,
- FieldElement field,
- AssignmentOperator operator,
- Node rhs,
+ Element element,
+ NodeList arguments,
+ Selector selector,
A arg) {
- return bulkHandleSuper(node, arg);
+ return bulkHandleInvoke(node, arg);
}
@override
- R visitSuperFieldFieldPostfix(
+ R visitUnresolvedSuperInvoke(
Send node,
- FieldElement readField,
- FieldElement writtenField,
- IncDecOperator operator,
+ Element function,
+ NodeList arguments,
+ Selector selector,
A arg) {
- return bulkHandleSuper(node, arg);
+ return bulkHandleInvoke(node, arg);
}
+}
- @override
- R visitSuperFieldFieldPrefix(
- Send node,
- FieldElement readField,
- FieldElement writtenField,
- IncDecOperator operator,
- A arg) {
- return bulkHandleSuper(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 visitSuperFieldGet(
+ R visitClassTypeLiteralGet(
Send node,
- FieldElement field,
+ ConstantExpression constant,
A arg) {
- return bulkHandleSuper(node, arg);
+ return bulkHandleGet(node, arg);
}
@override
- R visitSuperFieldInvoke(
+ R visitDynamicPropertyGet(
Send node,
- FieldElement field,
- NodeList arguments,
- CallStructure callStructure,
+ Node receiver,
+ Selector selector,
A arg) {
- return bulkHandleSuper(node, arg);
+ return bulkHandleGet(node, arg);
}
@override
- R visitSuperFieldPostfix(
+ R visitDynamicTypeLiteralGet(
Send node,
- FieldElement field,
- IncDecOperator operator,
+ ConstantExpression constant,
A arg) {
- return bulkHandleSuper(node, arg);
+ return bulkHandleGet(node, arg);
}
@override
- R visitSuperFieldPrefix(
+ R visitLocalFunctionGet(
Send node,
- FieldElement field,
- IncDecOperator operator,
+ LocalFunctionElement function,
A arg) {
- return bulkHandleSuper(node, arg);
+ return bulkHandleGet(node, arg);
}
@override
- R visitSuperFieldSet(
- SendSet node,
- FieldElement field,
- Node rhs,
+ R visitLocalVariableGet(
+ Send node,
+ LocalVariableElement variable,
A arg) {
- return bulkHandleSuper(node, arg);
+ return bulkHandleGet(node, arg);
}
@override
- R visitSuperFieldSetterCompound(
+ R visitParameterGet(
Send node,
- FieldElement field,
- FunctionElement setter,
- AssignmentOperator operator,
- Node rhs,
+ ParameterElement parameter,
A arg) {
- return bulkHandleSuper(node, arg);
+ return bulkHandleGet(node, arg);
}
@override
- R visitSuperFieldSetterPostfix(
+ R visitStaticFieldGet(
Send node,
FieldElement field,
- FunctionElement setter,
- IncDecOperator operator,
A arg) {
- return bulkHandleSuper(node, arg);
+ return bulkHandleGet(node, arg);
}
@override
- R visitSuperFieldSetterPrefix(
+ R visitStaticFunctionGet(
Send node,
- FieldElement field,
- FunctionElement setter,
- IncDecOperator operator,
+ MethodElement function,
A arg) {
- return bulkHandleSuper(node, arg);
+ return bulkHandleGet(node, arg);
}
@override
- R visitSuperGetterFieldCompound(
+ R visitStaticGetterGet(
Send node,
FunctionElement getter,
- FieldElement field,
- AssignmentOperator operator,
- Node rhs,
A arg) {
- return bulkHandleSuper(node, arg);
+ return bulkHandleGet(node, arg);
}
@override
- R visitSuperGetterFieldPostfix(
+ R visitSuperFieldGet(
Send node,
- FunctionElement getter,
FieldElement field,
- IncDecOperator operator,
A arg) {
- return bulkHandleSuper(node, arg);
+ return bulkHandleGet(node, arg);
}
@override
- R visitSuperGetterFieldPrefix(
+ R visitSuperGetterGet(
Send node,
FunctionElement getter,
- FieldElement field,
- IncDecOperator operator,
A arg) {
- return bulkHandleSuper(node, arg);
+ return bulkHandleGet(node, arg);
}
@override
- R visitSuperGetterGet(
+ R visitSuperMethodGet(
Send node,
- FunctionElement getter,
+ MethodElement method,
A arg) {
- return bulkHandleSuper(node, arg);
+ return bulkHandleGet(node, arg);
}
@override
- R visitSuperGetterInvoke(
- Send node,
- FunctionElement getter,
- NodeList arguments,
- CallStructure callStructure,
- A arg) {
- return bulkHandleSuper(node, arg);
+ R visitThisGet(Identifier node, A arg) {
+ return bulkHandleGet(node, arg);
}
@override
- R visitSuperGetterSetterCompound(
+ R visitThisPropertyGet(
Send node,
- FunctionElement getter,
- FunctionElement setter,
- AssignmentOperator operator,
- Node rhs,
+ Selector selector,
A arg) {
- return bulkHandleSuper(node, arg);
+ return bulkHandleGet(node, arg);
}
@override
- R visitSuperGetterSetterPostfix(
+ R visitTopLevelFieldGet(
Send node,
- FunctionElement getter,
- FunctionElement setter,
- IncDecOperator operator,
+ FieldElement field,
A arg) {
- return bulkHandleSuper(node, arg);
+ return bulkHandleGet(node, arg);
}
@override
- R visitSuperGetterSetterPrefix(
+ R visitTopLevelFunctionGet(
Send node,
- FunctionElement getter,
- FunctionElement setter,
- IncDecOperator operator,
+ MethodElement function,
A arg) {
- return bulkHandleSuper(node, arg);
+ return bulkHandleGet(node, arg);
}
@override
- R visitSuperIndexSet(
- SendSet node,
- FunctionElement function,
- Node index,
- Node rhs,
+ R visitTopLevelGetterGet(
+ Send node,
+ FunctionElement getter,
A arg) {
- return bulkHandleSuper(node, arg);
+ return bulkHandleGet(node, arg);
}
@override
- R visitSuperMethodGet(
+ R visitTypeVariableTypeLiteralGet(
Send node,
- MethodElement method,
+ TypeVariableElement element,
A arg) {
- return bulkHandleSuper(node, arg);
+ return bulkHandleGet(node, arg);
}
@override
- R visitSuperMethodInvoke(
+ R visitTypedefTypeLiteralGet(
Send node,
- MethodElement method,
- NodeList arguments,
- CallStructure callStructure,
+ ConstantExpression constant,
A arg) {
- return bulkHandleSuper(node, arg);
+ return bulkHandleGet(node, arg);
}
@override
- R visitSuperMethodIncompatibleInvoke(
+ R visitConstantGet(
Send node,
- MethodElement method,
- NodeList arguments,
- CallStructure callStructure,
+ ConstantExpression constant,
A arg) {
- return bulkHandleSuper(node, arg);
+ return bulkHandleGet(node, arg);
}
@override
- R visitSuperMethodSetterCompound(
+ R visitUnresolvedGet(
Send node,
- FunctionElement method,
- FunctionElement setter,
- AssignmentOperator operator,
- Node rhs,
+ Element element,
A arg) {
- return bulkHandleSuper(node, arg);
+ return bulkHandleGet(node, arg);
}
@override
- R visitSuperMethodSetterPostfix(
+ R visitUnresolvedSuperGet(
Send node,
- FunctionElement method,
- FunctionElement setter,
- IncDecOperator operator,
+ Element element,
A arg) {
- return bulkHandleSuper(node, 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 visitSuperMethodSetterPrefix(
- Send node,
- FunctionElement method,
- FunctionElement setter,
- IncDecOperator operator,
+ R visitDynamicPropertySet(
+ SendSet node,
+ Node receiver,
+ Selector selector,
+ Node rhs,
A arg) {
- return bulkHandleSuper(node, arg);
+ return bulkHandleSet(node, arg);
}
@override
- R visitSuperNotEquals(
- Send node,
- FunctionElement function,
- Node argument,
+ R visitLocalVariableSet(
+ SendSet node,
+ LocalVariableElement variable,
+ Node rhs,
A arg) {
- return bulkHandleSuper(node, arg);
+ return bulkHandleSet(node, arg);
}
@override
- R visitSuperSetterSet(
+ R visitParameterSet(
SendSet node,
- FunctionElement setter,
+ ParameterElement parameter,
Node rhs,
A arg) {
- return bulkHandleSuper(node, arg);
+ return bulkHandleSet(node, arg);
}
@override
- R visitSuperUnary(
- Send node,
- UnaryOperator operator,
- FunctionElement function,
+ R visitStaticFieldSet(
+ SendSet node,
+ FieldElement field,
+ Node rhs,
A arg) {
- return bulkHandleSuper(node, arg);
+ return bulkHandleSet(node, arg);
}
@override
- R visitUnresolvedSuperBinary(
- Send node,
- Element element,
- BinaryOperator operator,
- Node argument,
+ R visitStaticSetterSet(
+ SendSet node,
+ FunctionElement setter,
+ Node rhs,
A arg) {
- return bulkHandleSuper(node, arg);
+ return bulkHandleSet(node, arg);
}
@override
- R visitUnresolvedSuperGet(
- Send node,
- Element element,
+ R visitSuperFieldSet(
+ SendSet node,
+ FieldElement field,
+ Node rhs,
A arg) {
- return bulkHandleSuper(node, arg);
+ return bulkHandleSet(node, arg);
}
@override
- R visitUnresolvedSuperInvoke(
- Send node,
- Element function,
- NodeList arguments,
+ R visitSuperSetterSet(
+ SendSet node,
+ FunctionElement setter,
+ Node rhs,
+ A arg) {
+ return bulkHandleSet(node, arg);
+ }
+
+ @override
+ R visitThisPropertySet(
+ SendSet node,
Selector selector,
+ Node rhs,
A arg) {
- return bulkHandleSuper(node, arg);
+ return bulkHandleSet(node, arg);
}
@override
- R visitUnresolvedSuperIndex(
- Send node,
- Element function,
- Node index,
+ R visitTopLevelFieldSet(
+ SendSet node,
+ FieldElement field,
+ Node rhs,
A arg) {
- return bulkHandleSuper(node, arg);
+ return bulkHandleSet(node, arg);
}
@override
- R visitUnresolvedSuperUnary(
- Send node,
- UnaryOperator operator,
- Element element,
+ R visitTopLevelSetterSet(
+ SendSet node,
+ FunctionElement setter,
+ Node rhs,
A arg) {
- return bulkHandleSuper(node, arg);
+ return bulkHandleSet(node, arg);
}
}
-abstract class NewBulkMixin<R, A>
+/// 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 bulkHandleNew(NewExpression node, A arg) {
- return bulkHandleNode(
- node, "Constructor invocation `#` unhandled.", arg);
+ R bulkHandleIndexSet(Send node, A arg) {
+ return bulkHandleNode(node, "Index set expression `#` unhandled.", arg);
}
@override
- R visitAbstractClassConstructorInvoke(
- NewExpression node,
- ConstructorElement element,
- InterfaceType type,
- NodeList arguments,
- CallStructure callStructure,
+ R visitCompoundIndexSet(
+ SendSet node,
+ Node receiver,
+ Node index,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return bulkHandleNew(node, arg);
+ return bulkHandleIndexSet(node, arg);
}
@override
- R visitConstConstructorInvoke(
- NewExpression node,
- ConstructedConstantExpression constant,
+ R visitIndexSet(
+ SendSet node,
+ Node receiver,
+ Node index,
+ Node rhs,
A arg) {
- return bulkHandleNew(node, arg);
+ return bulkHandleIndexSet(node, arg);
}
- R visitGenerativeConstructorInvoke(
- NewExpression node,
- ConstructorElement constructor,
- InterfaceType type,
- NodeList arguments,
- CallStructure callStructure,
+ @override
+ R visitSuperCompoundIndexSet(
+ SendSet node,
+ FunctionElement getter,
+ FunctionElement setter,
+ Node index,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return bulkHandleNew(node, arg);
+ return bulkHandleIndexSet(node, arg);
}
- R visitRedirectingGenerativeConstructorInvoke(
- NewExpression node,
- ConstructorElement constructor,
- InterfaceType type,
- NodeList arguments,
- CallStructure callStructure,
+ @override
+ R visitUnresolvedSuperGetterCompoundIndexSet(
+ SendSet node,
+ Element element,
+ MethodElement setter,
+ Node index,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return bulkHandleNew(node, arg);
+ return bulkHandleIndexSet(node, arg);
}
- R visitFactoryConstructorInvoke(
- NewExpression node,
- ConstructorElement constructor,
- InterfaceType type,
- NodeList arguments,
- CallStructure callStructure,
+ @override
+ R visitUnresolvedSuperSetterCompoundIndexSet(
+ SendSet node,
+ MethodElement getter,
+ Element element,
+ Node index,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return bulkHandleNew(node, arg);
+ return bulkHandleIndexSet(node, arg);
}
- R visitRedirectingFactoryConstructorInvoke(
- NewExpression node,
- ConstructorElement constructor,
- InterfaceType type,
- ConstructorElement effectiveTarget,
- InterfaceType effectiveTargetType,
- NodeList arguments,
- CallStructure callStructure,
+ @override
+ R visitUnresolvedSuperCompoundIndexSet(
+ SendSet node,
+ Element element,
+ Node index,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return bulkHandleNew(node, arg);
+ return bulkHandleIndexSet(node, arg);
}
@override
- R visitUnresolvedClassConstructorInvoke(
- NewExpression node,
- Element element,
- DartType type,
- NodeList arguments,
- Selector selector,
+ R visitSuperIndexSet(
+ SendSet node,
+ FunctionElement function,
+ Node index,
+ Node rhs,
A arg) {
- return bulkHandleNew(node, arg);
+ return bulkHandleIndexSet(node, arg);
}
@override
- R visitUnresolvedConstructorInvoke(
- NewExpression node,
- Element constructor,
- DartType type,
- NodeList arguments,
- Selector selector,
+ R visitUnresolvedSuperIndexSet(
+ SendSet node,
+ Element element,
+ Node index,
+ Node rhs,
A arg) {
- return bulkHandleNew(node, arg);
- }
-
- @override
- R visitUnresolvedRedirectingFactoryConstructorInvoke(
- NewExpression node,
- ConstructorElement constructor,
- InterfaceType 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>,
- 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");
+ return bulkHandleIndexSet(node, arg);
}
}
-/// Mixin that implements all `visitXParameterDecl` and
-/// `visitXInitializingFormalDecl` methods of [SemanticDeclarationVisitor]
-/// by delegating to a bulk handler.
+/// Mixin that implements all binary visitor methods in [SemanticSendVisitor] 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> {
+/// 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 bulkHandleParameterDeclaration(VariableDefinitions node, A arg) {
- return bulkHandleNode(
- node, "Parameter declaration `#` unhandled.", arg);
+ R bulkHandleBinary(Send node, A arg) {
+ return bulkHandleNode(node, "Binary expression `#` unhandled.", arg);
}
@override
- R visitInitializingFormalDeclaration(
- VariableDefinitions node,
- Node definition,
- InitializingFormalElement parameter,
- int index,
+ R visitBinary(
+ Send node,
+ Node left,
+ BinaryOperator operator,
+ Node right,
A arg) {
- return bulkHandleParameterDeclaration(node, arg);
+ return bulkHandleBinary(node, arg);
}
@override
- R visitNamedInitializingFormalDeclaration(
- VariableDefinitions node,
- Node definition,
- InitializingFormalElement parameter,
- ConstantExpression defaultValue,
+ R visitEquals(
+ Send node,
+ Node left,
+ Node right,
A arg) {
- return bulkHandleParameterDeclaration(node, arg);
+ return bulkHandleBinary(node, arg);
}
@override
- R visitNamedParameterDeclaration(
- VariableDefinitions node,
- Node definition,
- ParameterElement parameter,
- ConstantExpression defaultValue,
+ R visitNotEquals(
+ Send node,
+ Node left,
+ Node right,
A arg) {
- return bulkHandleParameterDeclaration(node, arg);
+ return bulkHandleBinary(node, arg);
}
@override
- R visitOptionalInitializingFormalDeclaration(
- VariableDefinitions node,
- Node definition,
- InitializingFormalElement parameter,
- ConstantExpression defaultValue,
- int index,
+ R visitIndex(
+ Send node,
+ Node receiver,
+ Node index,
A arg) {
- return bulkHandleParameterDeclaration(node, arg);
+ return bulkHandleBinary(node, arg);
}
@override
- R visitOptionalParameterDeclaration(
- VariableDefinitions node,
- Node definition,
- ParameterElement parameter,
- ConstantExpression defaultValue,
- int index,
+ R visitSuperBinary(
+ Send node,
+ FunctionElement function,
+ BinaryOperator operator,
+ Node argument,
A arg) {
- return bulkHandleParameterDeclaration(node, arg);
+ return bulkHandleBinary(node, arg);
}
@override
- R visitParameterDeclaration(
- VariableDefinitions node,
- Node definition,
- ParameterElement parameter,
- int index,
+ R visitSuperEquals(
+ Send node,
+ FunctionElement function,
+ Node argument,
A arg) {
- return bulkHandleParameterDeclaration(node, arg);
+ return bulkHandleBinary(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 visitSuperNotEquals(
+ Send node,
+ FunctionElement function,
+ Node argument,
+ A arg) {
+ return bulkHandleBinary(node, arg);
}
@override
- R visitFactoryConstructorDeclaration(
- FunctionExpression node,
- ConstructorElement constructor,
- NodeList parameters,
- Node body,
+ R visitSuperIndex(
+ Send node,
+ FunctionElement function,
+ Node index,
A arg) {
- return bulkHandleConstructorDeclaration(node, arg);
+ return bulkHandleBinary(node, arg);
}
@override
- R visitGenerativeConstructorDeclaration(
- FunctionExpression node,
- ConstructorElement constructor,
- NodeList parameters,
- NodeList initializers,
- Node body,
+ R visitUnresolvedSuperBinary(
+ Send node,
+ FunctionElement function,
+ BinaryOperator operator,
+ Node argument,
A arg) {
- return bulkHandleConstructorDeclaration(node, arg);
+ return bulkHandleBinary(node, arg);
}
@override
- R visitRedirectingFactoryConstructorDeclaration(
- FunctionExpression node,
- ConstructorElement constructor,
- NodeList parameters,
- InterfaceType redirectionType,
- ConstructorElement redirectionTarget,
+ R visitUnresolvedSuperInvoke(
+ Send node,
+ Element function,
+ NodeList arguments,
+ Selector selector,
A arg) {
- return bulkHandleConstructorDeclaration(node, arg);
+ return bulkHandleBinary(node, arg);
}
@override
- R visitRedirectingGenerativeConstructorDeclaration(
- FunctionExpression node,
- ConstructorElement constructor,
- NodeList parameters,
- NodeList initializers,
+ R visitUnresolvedSuperIndex(
+ Send node,
+ FunctionElement function,
+ Node index,
A arg) {
- return bulkHandleConstructorDeclaration(node, arg);
+ return bulkHandleBinary(node, arg);
}
}
-/// Mixin that implements all constructor initializer visitor methods of
-/// [SemanticDeclarationVisitor] by delegating to a bulk handler.
+/// Mixin that implements all unary visitor methods in [SemanticSendVisitor] 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> {
+/// 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 bulkHandleInitializer(Send node, A arg) {
- return bulkHandleNode(
- node, "Initializer `#` unhandled.", arg);
+ R bulkHandleUnary(Send node, A arg) {
+ return bulkHandleNode(node, "Unary expression `#` unhandled.", arg);
}
@override
- R errorUnresolvedFieldInitializer(
- SendSet node,
- Element element,
- Node initializer,
+ R visitNot(
+ Send node,
+ Node expression,
A arg) {
- return bulkHandleInitializer(node, arg);
+ return bulkHandleUnary(node, arg);
}
@override
- R errorUnresolvedSuperConstructorInvoke(
+ R visitSuperUnary(
Send node,
- Element element,
- NodeList arguments,
- Selector selector,
+ UnaryOperator operator,
+ FunctionElement function,
A arg) {
- return bulkHandleInitializer(node, arg);
+ return bulkHandleUnary(node, arg);
}
@override
- R errorUnresolvedThisConstructorInvoke(
+ R visitUnary(
Send node,
- Element element,
- NodeList arguments,
- Selector selector,
+ UnaryOperator operator,
+ Node expression,
A arg) {
- return bulkHandleInitializer(node, arg);
+ return bulkHandleUnary(node, arg);
}
@override
- R visitFieldInitializer(
- SendSet node,
- FieldElement field,
- Node initializer,
- A arg) {
- return bulkHandleInitializer(node, arg);
- }
-
- @override
- R visitSuperConstructorInvoke(
- Send node,
- ConstructorElement superConstructor,
- InterfaceType type,
- NodeList arguments,
- Selector selector,
- A arg) {
- return bulkHandleInitializer(node, arg);
- }
-
- @override
- R visitThisConstructorInvoke(
+ R visitUnresolvedSuperUnary(
Send node,
- ConstructorElement thisConstructor,
- NodeList arguments,
- Selector selector,
+ UnaryOperator operator,
+ FunctionElement function,
A arg) {
- return bulkHandleInitializer(node, arg);
+ return bulkHandleUnary(node, arg);
}
}
-/// Mixin that implements all function declaration visitor methods of
-/// [SemanticDeclarationVisitor] by delegating to a bulk handler.
+/// 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 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);
- }
+/// 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 visitAbstractGetterDeclaration(
- FunctionExpression node,
- MethodElement getter,
+ R visitAs(
+ Send node,
+ Node expression,
+ DartType type,
A arg) {
- return bulkHandleFunctionDeclaration(node, arg);
+ return bulkHandleNode(node, 'As cast `#` unhandled.', arg);
}
@override
- R visitAbstractMethodDeclaration(
- FunctionExpression node,
- MethodElement method,
- NodeList parameters,
+ R visitAssert(
+ Send node,
+ Node expression,
A arg) {
- return bulkHandleFunctionDeclaration(node, arg);
+ return bulkHandleNode(node, 'Assert `#` unhandled.', arg);
}
@override
- R visitAbstractSetterDeclaration(
- FunctionExpression node,
- MethodElement setter,
- NodeList parameters,
+ R visitIs(
+ Send node,
+ Node expression,
+ DartType type,
A arg) {
- return bulkHandleFunctionDeclaration(node, arg);
+ return bulkHandleNode(node, 'Is test `#` unhandled.', arg);
}
@override
- R visitClosureDeclaration(
- FunctionExpression node,
- LocalFunctionElement closure,
- NodeList parameters,
- Node body,
+ R visitIsNot(
+ Send node,
+ Node expression,
+ DartType type,
A arg) {
- return bulkHandleFunctionDeclaration(node, arg);
+ return bulkHandleNode(node, 'Is not test `#` unhandled.', arg);
}
@override
- R visitInstanceGetterDeclaration(
- FunctionExpression node,
- MethodElement getter,
- Node body,
+ R visitLogicalAnd(
+ Send node,
+ Node left,
+ Node right,
A arg) {
- return bulkHandleFunctionDeclaration(node, arg);
+ return bulkHandleNode(node, 'Lazy and `#` unhandled.', arg);
}
@override
- R visitInstanceMethodDeclaration(
- FunctionExpression node,
- MethodElement method,
- NodeList parameters,
- Node body,
+ R visitLogicalOr(
+ Send node,
+ Node left,
+ Node right,
A arg) {
- return bulkHandleFunctionDeclaration(node, arg);
+ return bulkHandleNode(node, 'Lazy or `#` unhandled.', arg);
}
+}
- @override
- R visitInstanceSetterDeclaration(
- FunctionExpression node,
- MethodElement setter,
- NodeList parameters,
- Node body,
- A arg) {
- return bulkHandleFunctionDeclaration(node, 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 visitLocalFunctionDeclaration(
- FunctionExpression node,
- LocalFunctionElement function,
- NodeList parameters,
- Node body,
+ R visitSuperBinary(
+ Send node,
+ FunctionElement function,
+ BinaryOperator operator,
+ Node argument,
A arg) {
- return bulkHandleFunctionDeclaration(node, arg);
+ return bulkHandleSuper(node, arg);
}
@override
- R visitStaticFunctionDeclaration(
- FunctionExpression node,
- MethodElement function,
- NodeList parameters,
- Node body,
+ R visitSuperCompoundIndexSet(
+ SendSet node,
+ FunctionElement getter,
+ FunctionElement setter,
+ Node index,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return bulkHandleFunctionDeclaration(node, arg);
+ return bulkHandleSuper(node, arg);
}
@override
- R visitStaticGetterDeclaration(
- FunctionExpression node,
- MethodElement getter,
- Node body,
+ R visitSuperEquals(
+ Send node,
+ FunctionElement function,
+ Node argument,
A arg) {
- return bulkHandleFunctionDeclaration(node, arg);
+ return bulkHandleSuper(node, arg);
}
@override
- R visitStaticSetterDeclaration(
- FunctionExpression node,
- MethodElement setter,
- NodeList parameters,
- Node body,
+ R visitSuperFieldCompound(
+ Send node,
+ FieldElement field,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return bulkHandleFunctionDeclaration(node, arg);
+ return bulkHandleSuper(node, arg);
}
@override
- R visitTopLevelFunctionDeclaration(
- FunctionExpression node,
- MethodElement function,
- NodeList parameters,
- Node body,
+ R visitSuperFieldFieldPostfix(
+ Send node,
+ FieldElement readField,
+ FieldElement writtenField,
+ IncDecOperator operator,
A arg) {
- return bulkHandleFunctionDeclaration(node, arg);
+ return bulkHandleSuper(node, arg);
}
@override
- R visitTopLevelGetterDeclaration(
- FunctionExpression node,
- MethodElement getter,
- Node body,
+ R visitSuperFieldFieldPrefix(
+ Send node,
+ FieldElement readField,
+ FieldElement writtenField,
+ IncDecOperator operator,
A arg) {
- return bulkHandleFunctionDeclaration(node, arg);
+ return bulkHandleSuper(node, arg);
}
@override
- R visitTopLevelSetterDeclaration(
- FunctionExpression node,
- MethodElement setter,
- NodeList parameters,
- Node body,
+ R visitSuperFieldGet(
+ Send node,
+ FieldElement field,
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);
+ return bulkHandleSuper(node, arg);
}
@override
- R visitInstanceFieldDeclaration(
- VariableDefinitions node,
- Node definition,
+ R visitSuperFieldInvoke(
+ Send node,
FieldElement field,
- Node initializer,
+ NodeList arguments,
+ CallStructure callStructure,
A arg) {
- return bulkHandleVariableDeclaration(node, arg);
+ return bulkHandleSuper(node, arg);
}
@override
- R visitLocalConstantDeclaration(
- VariableDefinitions node,
- Node definition,
- LocalVariableElement variable,
- ConstantExpression constant,
+ R visitSuperFieldPostfix(
+ Send node,
+ FieldElement field,
+ IncDecOperator operator,
A arg) {
- return bulkHandleVariableDeclaration(node, arg);
+ return bulkHandleSuper(node, arg);
}
@override
- R visitLocalVariableDeclaration(
- VariableDefinitions node,
- Node definition,
- LocalVariableElement variable,
- Node initializer,
+ R visitSuperFieldPrefix(
+ Send node,
+ FieldElement field,
+ IncDecOperator operator,
A arg) {
- return bulkHandleVariableDeclaration(node, arg);
+ return bulkHandleSuper(node, arg);
}
@override
- R visitStaticConstantDeclaration(
- VariableDefinitions node,
- Node definition,
+ R visitSuperFieldSet(
+ SendSet node,
FieldElement field,
- ConstantExpression constant,
+ Node rhs,
A arg) {
- return bulkHandleVariableDeclaration(node, arg);
+ return bulkHandleSuper(node, arg);
}
@override
- R visitStaticFieldDeclaration(
- VariableDefinitions node,
- Node definition,
- FieldElement field,
- Node initializer,
+ R visitSuperFieldSetterCompound(
+ Send node,
+ FieldElement field,
+ FunctionElement setter,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return bulkHandleVariableDeclaration(node, arg);
+ return bulkHandleSuper(node, arg);
}
@override
- R visitTopLevelConstantDeclaration(
- VariableDefinitions node,
- Node definition,
+ R visitSuperFieldSetterPostfix(
+ Send node,
FieldElement field,
- ConstantExpression constant,
+ FunctionElement setter,
+ IncDecOperator operator,
A arg) {
- return bulkHandleVariableDeclaration(node, arg);
+ return bulkHandleSuper(node, arg);
}
@override
- R visitTopLevelFieldDeclaration(
- VariableDefinitions node,
- Node definition,
+ R visitSuperFieldSetterPrefix(
+ Send node,
FieldElement field,
- Node initializer,
+ FunctionElement setter,
+ IncDecOperator operator,
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");
+ return bulkHandleSuper(node, arg);
}
@override
- R bulkHandleNode(Node node, String message, A arg) {
- throw new UnimplementedError(
- "BulkDeclVisitor.bulkHandleNode unimplemented");
+ R visitSuperGetterFieldCompound(
+ Send node,
+ FunctionElement getter,
+ FieldElement field,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ return bulkHandleSuper(node, arg);
}
@override
- applyInitializers(NodeList initializers, A arg) {
- throw new UnimplementedError(
- "BulkDeclVisitor.applyInitializers unimplemented");
+ R visitSuperGetterFieldPostfix(
+ Send node,
+ FunctionElement getter,
+ FieldElement field,
+ IncDecOperator operator,
+ A arg) {
+ return bulkHandleSuper(node, arg);
}
@override
- applyParameters(NodeList parameters, A arg) {
- throw new UnimplementedError(
- "BulkDeclVisitor.applyParameters unimplemented");
+ R visitSuperGetterFieldPrefix(
+ Send node,
+ FunctionElement getter,
+ FieldElement field,
+ IncDecOperator operator,
+ A arg) {
+ return bulkHandleSuper(node, arg);
}
-}
-
-/// [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");
+ R visitSuperGetterGet(
+ Send node,
+ FunctionElement getter,
+ A arg) {
+ return bulkHandleSuper(node, arg);
}
@override
- R errorInvalidAssert(
+ R visitSuperGetterInvoke(
Send node,
+ FunctionElement getter,
NodeList arguments,
+ CallStructure callStructure,
A arg) {
- apply(arguments, arg);
- return null;
+ return bulkHandleSuper(node, arg);
}
@override
- R errorClassTypeLiteralSet(
- SendSet node,
- ConstantExpression constant,
+ R visitSuperGetterSetterCompound(
+ Send node,
+ FunctionElement getter,
+ FunctionElement setter,
+ AssignmentOperator operator,
Node rhs,
A arg) {
- apply(rhs, arg);
- return null;
+ return bulkHandleSuper(node, arg);
}
@override
- R errorDynamicTypeLiteralSet(
- SendSet node,
- ConstantExpression constant,
- Node rhs,
+ R visitSuperGetterSetterPostfix(
+ Send node,
+ FunctionElement getter,
+ FunctionElement setter,
+ IncDecOperator operator,
A arg) {
- apply(rhs, arg);
- return null;
+ return bulkHandleSuper(node, arg);
}
@override
- R errorFinalLocalVariableCompound(
+ R visitSuperGetterSetterPrefix(
Send node,
- LocalVariableElement variable,
- AssignmentOperator operator,
- Node rhs,
+ FunctionElement getter,
+ FunctionElement setter,
+ IncDecOperator operator,
A arg) {
- apply(rhs, arg);
- return null;
+ return bulkHandleSuper(node, arg);
}
@override
- R errorFinalLocalVariableSet(
+ R visitSuperIndexSet(
SendSet node,
- LocalVariableElement variable,
+ FunctionElement function,
+ Node index,
Node rhs,
A arg) {
- apply(rhs, arg);
- return null;
+ return bulkHandleSuper(node, arg);
}
@override
- R errorFinalParameterCompound(
+ R visitSuperMethodGet(
Send node,
- ParameterElement parameter,
- AssignmentOperator operator,
- Node rhs,
+ MethodElement method,
A arg) {
- apply(rhs, arg);
- return null;
+ return bulkHandleSuper(node, arg);
}
@override
- R errorFinalParameterSet(
- SendSet node,
- ParameterElement parameter,
- Node rhs,
+ R visitSuperMethodInvoke(
+ Send node,
+ MethodElement method,
+ NodeList arguments,
+ CallStructure callStructure,
A arg) {
- apply(rhs, arg);
- return null;
+ return bulkHandleSuper(node, arg);
}
@override
- R errorFinalStaticFieldCompound(
+ R visitSuperMethodIncompatibleInvoke(
Send node,
- FieldElement field,
- AssignmentOperator operator,
- Node rhs,
+ MethodElement method,
+ NodeList arguments,
+ CallStructure callStructure,
A arg) {
- apply(rhs, arg);
- return null;
+ return bulkHandleSuper(node, arg);
}
@override
- R errorFinalStaticFieldSet(
- SendSet node,
- FieldElement field,
+ R visitSuperMethodSetterCompound(
+ Send node,
+ FunctionElement method,
+ FunctionElement setter,
+ AssignmentOperator operator,
Node rhs,
A arg) {
- apply(rhs, arg);
- return null;
+ return bulkHandleSuper(node, arg);
}
@override
- R errorFinalSuperFieldCompound(
+ R visitSuperMethodSetterPostfix(
Send node,
- FieldElement field,
- AssignmentOperator operator,
- Node rhs,
+ FunctionElement method,
+ FunctionElement setter,
+ IncDecOperator operator,
A arg) {
- apply(rhs, arg);
- return null;
+ return bulkHandleSuper(node, arg);
}
@override
- R errorFinalSuperFieldSet(
- SendSet node,
- FieldElement field,
- Node rhs,
+ R visitSuperMethodSetterPrefix(
+ Send node,
+ FunctionElement method,
+ FunctionElement setter,
+ IncDecOperator operator,
A arg) {
- apply(rhs, arg);
- return null;
+ return bulkHandleSuper(node, arg);
}
@override
- R errorFinalTopLevelFieldCompound(
+ R visitSuperNotEquals(
Send node,
- FieldElement field,
- AssignmentOperator operator,
- Node rhs,
+ FunctionElement function,
+ Node argument,
A arg) {
- apply(rhs, arg);
- return null;
+ return bulkHandleSuper(node, arg);
}
@override
- R errorFinalTopLevelFieldSet(
+ R visitSuperSetterSet(
SendSet node,
- FieldElement field,
+ FunctionElement setter,
Node rhs,
A arg) {
- apply(rhs, arg);
- return null;
+ return bulkHandleSuper(node, arg);
}
@override
- R errorLocalFunctionCompound(
+ R visitSuperUnary(
Send node,
- LocalFunctionElement function,
- AssignmentOperator operator,
- Node rhs,
+ UnaryOperator operator,
+ FunctionElement function,
A arg) {
- apply(rhs, arg);
- return null;
+ return bulkHandleSuper(node, arg);
}
@override
- R errorLocalFunctionPostfix(
+ R visitUnresolvedSuperBinary(
Send node,
- LocalFunctionElement function,
- IncDecOperator operator,
+ Element element,
+ BinaryOperator operator,
+ Node argument,
A arg) {
- return null;
+ return bulkHandleSuper(node, arg);
}
@override
- R errorLocalFunctionPrefix(
+ R visitUnresolvedSuperGet(
Send node,
- LocalFunctionElement function,
- IncDecOperator operator,
+ Element element,
A arg) {
- return null;
+ return bulkHandleSuper(node, arg);
}
@override
- R errorLocalFunctionSet(
- SendSet node,
- LocalFunctionElement function,
- Node rhs,
+ R visitUnresolvedSuperInvoke(
+ Send node,
+ Element function,
+ NodeList arguments,
+ Selector selector,
A arg) {
- apply(rhs, arg);
- return null;
+ return bulkHandleSuper(node, arg);
}
@override
- R errorStaticFunctionSet(
+ R visitUnresolvedSuperIndex(
Send node,
- MethodElement function,
- Node rhs,
- A arg) {
- apply(rhs, arg);
- return null;
- }
-
- @override
- R errorStaticGetterSet(
- SendSet node,
- FunctionElement getter,
- Node rhs,
+ Element function,
+ Node index,
A arg) {
- apply(rhs, arg);
- return null;
+ return bulkHandleSuper(node, arg);
}
@override
- R errorStaticSetterGet(
+ R visitUnresolvedSuperUnary(
Send node,
- FunctionElement setter,
+ UnaryOperator operator,
+ Element element,
A arg) {
- return null;
+ 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 errorStaticSetterInvoke(
- Send node,
- FunctionElement setter,
+ R visitAbstractClassConstructorInvoke(
+ NewExpression node,
+ ConstructorElement element,
+ InterfaceType type,
NodeList arguments,
CallStructure callStructure,
A arg) {
- apply(arguments, arg);
- return null;
+ return bulkHandleNew(node, arg);
}
@override
- R errorSuperGetterSet(
- SendSet node,
- FunctionElement getter,
- Node rhs,
+ R visitConstConstructorInvoke(
+ NewExpression node,
+ ConstructedConstantExpression constant,
A arg) {
- apply(rhs, arg);
- return null;
+ return bulkHandleNew(node, arg);
}
@override
- R errorSuperMethodSet(
- Send node,
- MethodElement method,
- Node rhs,
+ R visitGenerativeConstructorInvoke(
+ NewExpression node,
+ ConstructorElement constructor,
+ InterfaceType type,
+ NodeList arguments,
+ CallStructure callStructure,
A arg) {
- apply(rhs, arg);
- return null;
+ return bulkHandleNew(node, arg);
}
@override
- R errorSuperSetterGet(
- Send node,
- FunctionElement setter,
+ R visitRedirectingGenerativeConstructorInvoke(
+ NewExpression node,
+ ConstructorElement constructor,
+ InterfaceType type,
+ NodeList arguments,
+ CallStructure callStructure,
A arg) {
- return null;
+ return bulkHandleNew(node, arg);
}
@override
- R errorSuperSetterInvoke(
- Send node,
- FunctionElement setter,
+ R visitFactoryConstructorInvoke(
+ NewExpression node,
+ ConstructorElement constructor,
+ InterfaceType type,
NodeList arguments,
CallStructure callStructure,
A arg) {
- apply(arguments, arg);
- return null;
+ return bulkHandleNew(node, arg);
}
@override
- R errorTopLevelFunctionSet(
- Send node,
- MethodElement function,
- Node rhs,
+ R visitRedirectingFactoryConstructorInvoke(
+ NewExpression node,
+ ConstructorElement constructor,
+ InterfaceType type,
+ ConstructorElement effectiveTarget,
+ InterfaceType effectiveTargetType,
+ NodeList arguments,
+ CallStructure callStructure,
A arg) {
- apply(rhs, arg);
- return null;
+ return bulkHandleNew(node, arg);
}
@override
- R errorTopLevelGetterSet(
- SendSet node,
- FunctionElement getter,
- Node rhs,
+ R visitUnresolvedClassConstructorInvoke(
+ NewExpression node,
+ Element element,
+ DartType type,
+ NodeList arguments,
+ Selector selector,
A arg) {
- apply(rhs, arg);
- return null;
+ return bulkHandleNew(node, arg);
}
@override
- R errorTopLevelSetterGet(
- Send node,
- FunctionElement setter,
+ R visitUnresolvedConstructorInvoke(
+ NewExpression node,
+ Element constructor,
+ DartType type,
+ NodeList arguments,
+ Selector selector,
A arg) {
- return null;
+ return bulkHandleNew(node, arg);
}
@override
- R errorTopLevelSetterInvoke(
- Send node,
- FunctionElement setter,
- NodeList arguments,
- CallStructure callStructure,
- A arg) {
- apply(arguments, arg);
- return null;
+ R visitUnresolvedRedirectingFactoryConstructorInvoke(
+ NewExpression node,
+ ConstructorElement constructor,
+ InterfaceType 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>,
+ UnaryBulkMixin<R, A>,
+ BaseBulkMixin<R, A>,
+ BinaryBulkMixin<R, A>,
+ PrefixBulkMixin<R, A>,
+ PostfixBulkMixin<R, A>,
+ NewBulkMixin<R, A> {
@override
- R errorTypeVariableTypeLiteralSet(
- SendSet node,
- TypeVariableElement element,
- Node rhs,
- A arg) {
- apply(rhs, arg);
- return null;
+ R apply(Node node, A arg) {
+ throw new UnimplementedError("BulkSendVisitor.apply unimplemented");
}
@override
- R errorTypedefTypeLiteralSet(
- SendSet node,
- ConstantExpression constant,
- Node rhs,
- A arg) {
- apply(rhs, arg);
- return null;
+ 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 visitUnresolvedSuperIndex(
- Send node,
- Element function,
- Node index,
+ R visitInitializingFormalDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ InitializingFormalElement parameter,
+ int index,
A arg) {
- apply(index, arg);
- return null;
+ return bulkHandleParameterDeclaration(node, arg);
}
@override
- R visitUnresolvedSuperGet(
- Send node,
- Element element,
+ R visitNamedInitializingFormalDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ InitializingFormalElement parameter,
+ ConstantExpression defaultValue,
A arg) {
- return null;
+ return bulkHandleParameterDeclaration(node, arg);
}
@override
- R visitUnresolvedSuperInvoke(
- Send node,
- Element function,
- NodeList arguments,
- Selector selector,
+ R visitNamedParameterDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ ParameterElement parameter,
+ ConstantExpression defaultValue,
A arg) {
- apply(arguments, arg);
- return null;
+ return bulkHandleParameterDeclaration(node, arg);
}
@override
- R visitAs(
- Send node,
- Node expression,
- DartType type,
+ R visitOptionalInitializingFormalDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ InitializingFormalElement parameter,
+ ConstantExpression defaultValue,
+ int index,
A arg) {
- apply(expression, arg);
- return null;
+ return bulkHandleParameterDeclaration(node, arg);
}
@override
- R visitAssert(
- Send node,
- Node expression,
+ R visitOptionalParameterDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ ParameterElement parameter,
+ ConstantExpression defaultValue,
+ int index,
A arg) {
- apply(expression, arg);
- return null;
+ return bulkHandleParameterDeclaration(node, arg);
}
@override
- R visitBinary(
- Send node,
- Node left,
- BinaryOperator operator,
- Node right,
+ R visitParameterDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ ParameterElement parameter,
+ int index,
A arg) {
- apply(left, arg);
- apply(right, arg);
- return null;
+ return bulkHandleParameterDeclaration(node, arg);
}
+}
- @override
- R errorClassTypeLiteralCompound(
- Send node,
- ConstantExpression constant,
- AssignmentOperator operator,
- Node rhs,
- A arg) {
- apply(rhs, arg);
- return null;
+/// 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 visitClassTypeLiteralGet(
- Send node,
- ConstantExpression constant,
+ R visitFactoryConstructorDeclaration(
+ FunctionExpression node,
+ ConstructorElement constructor,
+ NodeList parameters,
+ Node body,
A arg) {
- return null;
+ return bulkHandleConstructorDeclaration(node, arg);
}
@override
- R visitClassTypeLiteralInvoke(
- Send node,
- ConstantExpression constant,
- NodeList arguments,
- CallStructure callStructure,
+ R visitGenerativeConstructorDeclaration(
+ FunctionExpression node,
+ ConstructorElement constructor,
+ NodeList parameters,
+ NodeList initializers,
+ Node body,
A arg) {
- apply(arguments, arg);
- return null;
+ return bulkHandleConstructorDeclaration(node, arg);
}
@override
- R errorClassTypeLiteralPostfix(
- Send node,
- ConstantExpression constant,
- IncDecOperator operator,
+ R visitRedirectingFactoryConstructorDeclaration(
+ FunctionExpression node,
+ ConstructorElement constructor,
+ NodeList parameters,
+ InterfaceType redirectionType,
+ ConstructorElement redirectionTarget,
A arg) {
- return null;
+ return bulkHandleConstructorDeclaration(node, arg);
}
@override
- R errorClassTypeLiteralPrefix(
- Send node,
- ConstantExpression constant,
- IncDecOperator operator,
+ R visitRedirectingGenerativeConstructorDeclaration(
+ FunctionExpression node,
+ ConstructorElement constructor,
+ NodeList parameters,
+ NodeList initializers,
A arg) {
- return null;
+ 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(Send node, A arg) {
+ return bulkHandleNode(
+ node, "Initializer `#` unhandled.", arg);
}
@override
- R visitCompoundIndexSet(
+ R errorUnresolvedFieldInitializer(
SendSet node,
- Node receiver,
- Node index,
- AssignmentOperator operator,
- Node rhs,
+ Element element,
+ Node initializer,
A arg) {
- apply(receiver, arg);
- apply(index, arg);
- apply(rhs, arg);
- return null;
+ return bulkHandleInitializer(node, arg);
}
@override
- R visitConstantGet(
+ R errorUnresolvedSuperConstructorInvoke(
Send node,
- ConstantExpression constant,
+ Element element,
+ NodeList arguments,
+ Selector selector,
A arg) {
- return null;
+ return bulkHandleInitializer(node, arg);
}
@override
- R visitConstantInvoke(
+ R errorUnresolvedThisConstructorInvoke(
Send node,
- ConstantExpression constant,
+ Element element,
NodeList arguments,
- CallStructure callStructure,
+ Selector selector,
A arg) {
- apply(arguments, arg);
- return null;
+ return bulkHandleInitializer(node, arg);
}
@override
- R visitDynamicPropertyCompound(
- Send node,
- Node receiver,
- AssignmentOperator operator,
- Node rhs,
- Selector getterSelector,
- Selector setterSelector,
+ R visitFieldInitializer(
+ SendSet node,
+ FieldElement field,
+ Node initializer,
A arg) {
- apply(receiver, arg);
- apply(rhs, arg);
- return null;
+ return bulkHandleInitializer(node, arg);
}
@override
- R visitDynamicPropertyGet(
+ R visitSuperConstructorInvoke(
Send node,
- Node receiver,
+ ConstructorElement superConstructor,
+ InterfaceType type,
+ NodeList arguments,
Selector selector,
A arg) {
- apply(receiver, arg);
- return null;
+ return bulkHandleInitializer(node, arg);
}
@override
- R visitDynamicPropertyInvoke(
+ R visitThisConstructorInvoke(
Send node,
- Node receiver,
+ ConstructorElement thisConstructor,
NodeList arguments,
Selector selector,
A arg) {
- apply(receiver, arg);
- apply(arguments, arg);
- return null;
+ 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 visitDynamicPropertyPostfix(
- Send node,
- Node receiver,
- IncDecOperator operator,
- Selector getterSelector,
- Selector setterSelector,
+ R visitAbstractGetterDeclaration(
+ FunctionExpression node,
+ MethodElement getter,
A arg) {
- apply(receiver, arg);
- return null;
+ return bulkHandleFunctionDeclaration(node, arg);
}
@override
- R visitDynamicPropertyPrefix(
- Send node,
- Node receiver,
- IncDecOperator operator,
- Selector getterSelector,
- Selector setterSelector,
+ R visitAbstractMethodDeclaration(
+ FunctionExpression node,
+ MethodElement method,
+ NodeList parameters,
A arg) {
- apply(receiver, arg);
- return null;
+ return bulkHandleFunctionDeclaration(node, arg);
}
@override
- R visitDynamicPropertySet(
- SendSet node,
- Node receiver,
- Selector selector,
- Node rhs,
+ R visitAbstractSetterDeclaration(
+ FunctionExpression node,
+ MethodElement setter,
+ NodeList parameters,
A arg) {
- apply(rhs, arg);
- return null;
+ return bulkHandleFunctionDeclaration(node, arg);
}
@override
- R errorDynamicTypeLiteralCompound(
- Send node,
- ConstantExpression constant,
- AssignmentOperator operator,
- Node rhs,
+ R visitClosureDeclaration(
+ FunctionExpression node,
+ LocalFunctionElement closure,
+ NodeList parameters,
+ Node body,
A arg) {
- apply(rhs, arg);
- return null;
+ return bulkHandleFunctionDeclaration(node, arg);
}
@override
- R visitDynamicTypeLiteralGet(
- Send node,
- ConstantExpression constant,
+ R visitInstanceGetterDeclaration(
+ FunctionExpression node,
+ MethodElement getter,
+ Node body,
A arg) {
- return null;
+ return bulkHandleFunctionDeclaration(node, arg);
}
@override
- R visitDynamicTypeLiteralInvoke(
- Send node,
- ConstantExpression constant,
- NodeList arguments,
- CallStructure callStructure,
+ R visitInstanceMethodDeclaration(
+ FunctionExpression node,
+ MethodElement method,
+ NodeList parameters,
+ Node body,
A arg) {
- apply(arguments, arg);
- return null;
+ return bulkHandleFunctionDeclaration(node, arg);
}
@override
- R errorDynamicTypeLiteralPostfix(
- Send node,
- ConstantExpression constant,
- IncDecOperator operator,
+ R visitInstanceSetterDeclaration(
+ FunctionExpression node,
+ MethodElement setter,
+ NodeList parameters,
+ Node body,
A arg) {
- return null;
+ return bulkHandleFunctionDeclaration(node, arg);
}
@override
- R errorDynamicTypeLiteralPrefix(
- Send node,
- ConstantExpression constant,
- IncDecOperator operator,
+ R visitLocalFunctionDeclaration(
+ FunctionExpression node,
+ LocalFunctionElement function,
+ NodeList parameters,
+ Node body,
A arg) {
- return null;
+ return bulkHandleFunctionDeclaration(node, arg);
}
@override
- R visitEquals(
- Send node,
- Node left,
- Node right,
+ R visitStaticFunctionDeclaration(
+ FunctionExpression node,
+ MethodElement function,
+ NodeList parameters,
+ Node body,
A arg) {
- apply(left, arg);
- apply(right, arg);
- return null;
+ return bulkHandleFunctionDeclaration(node, arg);
}
@override
- R visitExpressionInvoke(
- Send node,
- Node expression,
- NodeList arguments,
- Selector selector,
+ R visitStaticGetterDeclaration(
+ FunctionExpression node,
+ MethodElement getter,
+ Node body,
A arg) {
- apply(expression, arg);
- apply(arguments, arg);
- return null;
+ return bulkHandleFunctionDeclaration(node, arg);
}
@override
- R visitIndex(
- Send node,
- Node receiver,
- Node index,
+ R visitStaticSetterDeclaration(
+ FunctionExpression node,
+ MethodElement setter,
+ NodeList parameters,
+ Node body,
A arg) {
- apply(receiver, arg);
- apply(index, arg);
- return null;
+ return bulkHandleFunctionDeclaration(node, arg);
}
@override
- R visitIndexSet(
- SendSet node,
- Node receiver,
- Node index,
- Node rhs,
+ R visitTopLevelFunctionDeclaration(
+ FunctionExpression node,
+ MethodElement function,
+ NodeList parameters,
+ Node body,
A arg) {
- apply(receiver, arg);
- apply(index, arg);
- apply(rhs, arg);
- return null;
+ return bulkHandleFunctionDeclaration(node, arg);
}
@override
- R visitIs(
- Send node,
- Node expression,
- DartType type,
+ R visitTopLevelGetterDeclaration(
+ FunctionExpression node,
+ MethodElement getter,
+ Node body,
A arg) {
- apply(expression, arg);
- return null;
+ return bulkHandleFunctionDeclaration(node, arg);
}
@override
- R visitIsNot(
- Send node,
- Node expression,
- DartType type,
+ R visitTopLevelSetterDeclaration(
+ FunctionExpression node,
+ MethodElement setter,
+ NodeList parameters,
+ Node body,
A arg) {
- apply(expression, arg);
- return null;
+ return bulkHandleFunctionDeclaration(node, arg);
}
+}
- @override
- R visitLocalFunctionGet(
- Send node,
- LocalFunctionElement function,
- A arg) {
- return null;
+/// 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 visitLocalFunctionInvoke(
- Send node,
- LocalFunctionElement function,
- NodeList arguments,
- CallStructure callStructure,
+ R visitInstanceFieldDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ FieldElement field,
+ Node initializer,
A arg) {
- apply(arguments, arg);
- return null;
+ return bulkHandleVariableDeclaration(node, arg);
}
@override
- R visitLocalVariableCompound(
- Send node,
+ R visitLocalConstantDeclaration(
+ VariableDefinitions node,
+ Node definition,
LocalVariableElement variable,
- AssignmentOperator operator,
- Node rhs,
+ ConstantExpression constant,
A arg) {
- apply(rhs, arg);
- return null;
+ return bulkHandleVariableDeclaration(node, arg);
}
@override
- R visitLocalVariableGet(
- Send node,
+ R visitLocalVariableDeclaration(
+ VariableDefinitions node,
+ Node definition,
LocalVariableElement variable,
+ Node initializer,
A arg) {
- return null;
+ return bulkHandleVariableDeclaration(node, arg);
}
@override
- R visitLocalVariableInvoke(
- Send node,
- LocalVariableElement variable,
- NodeList arguments,
- CallStructure callStructure,
+ R visitStaticConstantDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ FieldElement field,
+ ConstantExpression constant,
A arg) {
- apply(arguments, arg);
- return null;
+ return bulkHandleVariableDeclaration(node, arg);
}
@override
- R visitLocalVariablePostfix(
- Send node,
- LocalVariableElement variable,
- IncDecOperator operator,
+ R visitStaticFieldDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ FieldElement field,
+ Node initializer,
A arg) {
- return null;
+ return bulkHandleVariableDeclaration(node, arg);
}
@override
- R visitLocalVariablePrefix(
- Send node,
- LocalVariableElement variable,
- IncDecOperator operator,
+ R visitTopLevelConstantDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ FieldElement field,
+ ConstantExpression constant,
A arg) {
- return null;
+ return bulkHandleVariableDeclaration(node, arg);
}
@override
- R visitLocalVariableSet(
- SendSet node,
- LocalVariableElement variable,
- Node rhs,
+ R visitTopLevelFieldDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ FieldElement field,
+ Node initializer,
A arg) {
- apply(rhs, arg);
- return null;
+ 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 visitLogicalAnd(
- Send node,
- Node left,
- Node right,
- A arg) {
- apply(left, arg);
- apply(right, arg);
- return null;
+ R apply(Node node, A arg) {
+ throw new UnimplementedError("BulkDeclVisitor.apply unimplemented");
}
@override
- R visitLogicalOr(
- Send node,
- Node left,
- Node right,
- A arg) {
- apply(left, arg);
- apply(right, arg);
- return null;
+ R bulkHandleNode(Node node, String message, A arg) {
+ throw new UnimplementedError(
+ "BulkDeclVisitor.bulkHandleNode unimplemented");
}
@override
- R visitNot(
+ applyInitializers(NodeList initializers, 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
+ R errorInvalidAssert(
Send node,
- Node expression,
+ NodeList arguments,
A arg) {
- apply(expression, arg);
+ apply(arguments, arg);
return null;
}
@override
- R visitNotEquals(
- Send node,
- Node left,
- Node right,
+ R errorClassTypeLiteralSet(
+ SendSet node,
+ ConstantExpression constant,
+ Node rhs,
A arg) {
- apply(left, arg);
- apply(right, arg);
+ apply(rhs, arg);
return null;
}
@override
- R visitParameterCompound(
- Send node,
- ParameterElement parameter,
- AssignmentOperator operator,
+ R errorDynamicTypeLiteralSet(
+ SendSet node,
+ ConstantExpression constant,
Node rhs,
A arg) {
apply(rhs, arg);
@@ -3711,44 +3415,39 @@ class TraversalSendMixin<R, A> implements SemanticSendVisitor<R, A> {
}
@override
- R visitParameterGet(
+ R visitFinalLocalVariableCompound(
Send node,
- ParameterElement parameter,
+ LocalVariableElement variable,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
+ apply(rhs, arg);
return null;
}
@override
- R visitParameterInvoke(
- Send node,
- ParameterElement parameter,
- NodeList arguments,
- CallStructure callStructure,
- A arg) {
- apply(arguments, arg);
- return null;
- }
-
- @override
- R visitParameterPostfix(
- Send node,
- ParameterElement parameter,
- IncDecOperator operator,
+ R errorFinalLocalVariableSet(
+ SendSet node,
+ LocalVariableElement variable,
+ Node rhs,
A arg) {
+ apply(rhs, arg);
return null;
}
@override
- R visitParameterPrefix(
+ R visitFinalParameterCompound(
Send node,
ParameterElement parameter,
- IncDecOperator operator,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
+ apply(rhs, arg);
return null;
}
@override
- R visitParameterSet(
+ R errorFinalParameterSet(
SendSet node,
ParameterElement parameter,
Node rhs,
@@ -3758,7 +3457,7 @@ class TraversalSendMixin<R, A> implements SemanticSendVisitor<R, A> {
}
@override
- R visitStaticFieldCompound(
+ R visitFinalStaticFieldCompound(
Send node,
FieldElement field,
AssignmentOperator operator,
@@ -3769,44 +3468,38 @@ class TraversalSendMixin<R, A> implements SemanticSendVisitor<R, A> {
}
@override
- R visitStaticFieldGet(
- Send node,
- FieldElement field,
- A arg) {
- return null;
- }
-
- @override
- R visitStaticFieldInvoke(
- Send node,
+ R errorFinalStaticFieldSet(
+ SendSet node,
FieldElement field,
- NodeList arguments,
- CallStructure callStructure,
+ Node rhs,
A arg) {
- apply(arguments, arg);
+ apply(rhs, arg);
return null;
}
@override
- R visitStaticFieldPostfix(
- Send node,
+ R errorFinalSuperFieldSet(
+ SendSet node,
FieldElement field,
- IncDecOperator operator,
+ Node rhs,
A arg) {
+ apply(rhs, arg);
return null;
}
@override
- R visitStaticFieldPrefix(
+ R visitFinalTopLevelFieldCompound(
Send node,
FieldElement field,
- IncDecOperator operator,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
+ apply(rhs, arg);
return null;
}
@override
- R visitStaticFieldSet(
+ R errorFinalTopLevelFieldSet(
SendSet node,
FieldElement field,
Node rhs,
@@ -3816,60 +3509,58 @@ class TraversalSendMixin<R, A> implements SemanticSendVisitor<R, A> {
}
@override
- R visitStaticFunctionGet(
+ R visitLocalFunctionCompound(
Send node,
- MethodElement function,
+ LocalFunctionElement function,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
+ apply(rhs, arg);
return null;
}
@override
- R visitStaticFunctionInvoke(
+ R visitLocalFunctionPostfix(
Send node,
- MethodElement function,
- NodeList arguments,
- CallStructure callStructure,
+ LocalFunctionElement function,
+ IncDecOperator operator,
A arg) {
- apply(arguments, arg);
return null;
}
@override
- R visitStaticFunctionIncompatibleInvoke(
+ R visitLocalFunctionPrefix(
Send node,
- MethodElement function,
- NodeList arguments,
- CallStructure callStructure,
+ LocalFunctionElement function,
+ IncDecOperator operator,
A arg) {
- apply(arguments, arg);
return null;
}
@override
- R visitStaticGetterGet(
- Send node,
- FunctionElement getter,
+ R errorLocalFunctionSet(
+ SendSet node,
+ LocalFunctionElement function,
+ Node rhs,
A arg) {
+ apply(rhs, arg);
return null;
}
@override
- R visitStaticGetterInvoke(
+ R errorStaticFunctionSet(
Send node,
- FunctionElement getter,
- NodeList arguments,
- CallStructure callStructure,
+ MethodElement function,
+ Node rhs,
A arg) {
- apply(arguments, arg);
+ apply(rhs, arg);
return null;
}
@override
- R visitStaticGetterSetterCompound(
- Send node,
+ R errorStaticGetterSet(
+ SendSet node,
FunctionElement getter,
- FunctionElement setter,
- AssignmentOperator operator,
Node rhs,
A arg) {
apply(rhs, arg);
@@ -3877,31 +3568,28 @@ class TraversalSendMixin<R, A> implements SemanticSendVisitor<R, A> {
}
@override
- R visitStaticGetterSetterPostfix(
+ R errorStaticSetterGet(
Send node,
- FunctionElement getter,
FunctionElement setter,
- IncDecOperator operator,
A arg) {
return null;
}
@override
- R visitStaticGetterSetterPrefix(
+ R errorStaticSetterInvoke(
Send node,
- FunctionElement getter,
FunctionElement setter,
- IncDecOperator operator,
+ NodeList arguments,
+ CallStructure callStructure,
A arg) {
+ apply(arguments, arg);
return null;
}
@override
- R visitStaticMethodSetterCompound(
- Send node,
- FunctionElement method,
- FunctionElement setter,
- AssignmentOperator operator,
+ R errorSuperGetterSet(
+ SendSet node,
+ FunctionElement getter,
Node rhs,
A arg) {
apply(rhs, arg);
@@ -3909,53 +3597,48 @@ class TraversalSendMixin<R, A> implements SemanticSendVisitor<R, A> {
}
@override
- R visitStaticMethodSetterPostfix(
+ R errorSuperMethodSet(
Send node,
- FunctionElement getter,
- FunctionElement setter,
- IncDecOperator operator,
+ MethodElement method,
+ Node rhs,
A arg) {
+ apply(rhs, arg);
return null;
}
@override
- R visitStaticMethodSetterPrefix(
+ R errorSuperSetterGet(
Send node,
- FunctionElement getter,
FunctionElement setter,
- IncDecOperator operator,
A arg) {
return null;
}
@override
- R visitStaticSetterSet(
- SendSet node,
+ R errorSuperSetterInvoke(
+ Send node,
FunctionElement setter,
- Node rhs,
+ NodeList arguments,
+ CallStructure callStructure,
A arg) {
- apply(rhs, arg);
+ apply(arguments, arg);
return null;
}
@override
- R visitSuperBinary(
+ R errorTopLevelFunctionSet(
Send node,
- FunctionElement function,
- BinaryOperator operator,
- Node argument,
+ MethodElement function,
+ Node rhs,
A arg) {
- apply(argument, arg);
+ apply(rhs, arg);
return null;
}
@override
- R visitSuperCompoundIndexSet(
+ R errorTopLevelGetterSet(
SendSet node,
FunctionElement getter,
- FunctionElement setter,
- Node index,
- AssignmentOperator operator,
Node rhs,
A arg) {
apply(rhs, arg);
@@ -3963,20 +3646,28 @@ class TraversalSendMixin<R, A> implements SemanticSendVisitor<R, A> {
}
@override
- R visitSuperEquals(
+ R errorTopLevelSetterGet(
Send node,
- FunctionElement function,
- Node argument,
+ FunctionElement setter,
A arg) {
- apply(argument, arg);
return null;
}
@override
- R visitSuperFieldCompound(
+ R errorTopLevelSetterInvoke(
Send node,
- FieldElement field,
- AssignmentOperator operator,
+ FunctionElement setter,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
+ apply(arguments, arg);
+ return null;
+ }
+
+ @override
+ R errorTypeVariableTypeLiteralSet(
+ SendSet node,
+ TypeVariableElement element,
Node rhs,
A arg) {
apply(rhs, arg);
@@ -3984,77 +3675,79 @@ class TraversalSendMixin<R, A> implements SemanticSendVisitor<R, A> {
}
@override
- R visitSuperFieldFieldPostfix(
- Send node,
- FieldElement readField,
- FieldElement writtenField,
- IncDecOperator operator,
+ R errorTypedefTypeLiteralSet(
+ SendSet node,
+ ConstantExpression constant,
+ Node rhs,
A arg) {
+ apply(rhs, arg);
return null;
}
@override
- R visitSuperFieldFieldPrefix(
+ R visitUnresolvedSuperIndex(
Send node,
- FieldElement readField,
- FieldElement writtenField,
- IncDecOperator operator,
+ Element function,
+ Node index,
A arg) {
+ apply(index, arg);
return null;
}
@override
- R visitSuperFieldGet(
+ R visitUnresolvedSuperGet(
Send node,
- FieldElement field,
+ Element element,
A arg) {
return null;
}
@override
- R visitSuperFieldInvoke(
+ R visitUnresolvedSuperInvoke(
Send node,
- FieldElement field,
+ Element function,
NodeList arguments,
- CallStructure callStructure,
+ Selector selector,
A arg) {
apply(arguments, arg);
return null;
}
@override
- R visitSuperFieldPostfix(
+ R visitAs(
Send node,
- FieldElement field,
- IncDecOperator operator,
+ Node expression,
+ DartType type,
A arg) {
+ apply(expression, arg);
return null;
}
@override
- R visitSuperFieldPrefix(
+ R visitAssert(
Send node,
- FieldElement field,
- IncDecOperator operator,
+ Node expression,
A arg) {
+ apply(expression, arg);
return null;
}
@override
- R visitSuperFieldSet(
- SendSet node,
- FieldElement field,
- Node rhs,
+ R visitBinary(
+ Send node,
+ Node left,
+ BinaryOperator operator,
+ Node right,
A arg) {
- apply(rhs, arg);
+ apply(left, arg);
+ apply(right, arg);
return null;
}
@override
- R visitSuperFieldSetterCompound(
+ R visitClassTypeLiteralCompound(
Send node,
- FieldElement field,
- FunctionElement setter,
+ ConstantExpression constant,
AssignmentOperator operator,
Node rhs,
A arg) {
@@ -4063,69 +3756,68 @@ class TraversalSendMixin<R, A> implements SemanticSendVisitor<R, A> {
}
@override
- R visitSuperFieldSetterPostfix(
+ R visitClassTypeLiteralGet(
Send node,
- FieldElement field,
- FunctionElement setter,
- IncDecOperator operator,
+ ConstantExpression constant,
A arg) {
return null;
}
@override
- R visitSuperFieldSetterPrefix(
+ R visitClassTypeLiteralInvoke(
Send node,
- FieldElement field,
- FunctionElement setter,
- IncDecOperator operator,
+ ConstantExpression constant,
+ NodeList arguments,
+ CallStructure callStructure,
A arg) {
+ apply(arguments, arg);
return null;
}
@override
- R visitSuperGetterFieldCompound(
+ R visitClassTypeLiteralPostfix(
Send node,
- FunctionElement getter,
- FieldElement field,
- AssignmentOperator operator,
- Node rhs,
+ ConstantExpression constant,
+ IncDecOperator operator,
A arg) {
- apply(rhs, arg);
return null;
}
@override
- R visitSuperGetterFieldPostfix(
+ R visitClassTypeLiteralPrefix(
Send node,
- FunctionElement getter,
- FieldElement field,
+ ConstantExpression constant,
IncDecOperator operator,
A arg) {
return null;
}
@override
- R visitSuperGetterFieldPrefix(
- Send node,
- FunctionElement getter,
- FieldElement field,
- IncDecOperator operator,
+ 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 visitSuperGetterGet(
+ R visitConstantGet(
Send node,
- FunctionElement getter,
+ ConstantExpression constant,
A arg) {
return null;
}
@override
- R visitSuperGetterInvoke(
+ R visitConstantInvoke(
Send node,
- FunctionElement getter,
+ ConstantExpression constant,
NodeList arguments,
CallStructure callStructure,
A arg) {
@@ -4134,82 +3826,99 @@ class TraversalSendMixin<R, A> implements SemanticSendVisitor<R, A> {
}
@override
- R visitSuperGetterSetterCompound(
+ R visitDynamicPropertyCompound(
Send node,
- FunctionElement getter,
- FunctionElement setter,
+ Node receiver,
AssignmentOperator operator,
Node rhs,
+ Selector getterSelector,
+ Selector setterSelector,
A arg) {
+ apply(receiver, arg);
apply(rhs, arg);
return null;
}
@override
- R visitSuperGetterSetterPostfix(
+ R visitDynamicPropertyGet(
Send node,
- FunctionElement getter,
- FunctionElement setter,
- IncDecOperator operator,
+ Node receiver,
+ Selector selector,
A arg) {
+ apply(receiver, arg);
return null;
}
@override
- R visitSuperGetterSetterPrefix(
+ R visitDynamicPropertyInvoke(
Send node,
- FunctionElement getter,
- FunctionElement setter,
+ Node receiver,
+ NodeList arguments,
+ Selector selector,
+ A arg) {
+ apply(receiver, arg);
+ apply(arguments, arg);
+ return null;
+ }
+
+ @override
+ R visitDynamicPropertyPostfix(
+ Send node,
+ Node receiver,
IncDecOperator operator,
+ Selector getterSelector,
+ Selector setterSelector,
A arg) {
+ apply(receiver, arg);
return null;
}
@override
- R visitSuperIndex(
+ R visitDynamicPropertyPrefix(
Send node,
- FunctionElement function,
- Node index,
+ Node receiver,
+ IncDecOperator operator,
+ Selector getterSelector,
+ Selector setterSelector,
A arg) {
- apply(index, arg);
+ apply(receiver, arg);
return null;
}
@override
- R visitSuperIndexSet(
+ R visitDynamicPropertySet(
SendSet node,
- FunctionElement function,
- Node index,
+ Node receiver,
+ Selector selector,
Node rhs,
A arg) {
- apply(index, arg);
apply(rhs, arg);
return null;
}
@override
- R visitSuperMethodGet(
+ R visitDynamicTypeLiteralCompound(
Send node,
- MethodElement method,
+ ConstantExpression constant,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
+ apply(rhs, arg);
return null;
}
@override
- R visitSuperMethodInvoke(
+ R visitDynamicTypeLiteralGet(
Send node,
- MethodElement method,
- NodeList arguments,
- CallStructure callStructure,
+ ConstantExpression constant,
A arg) {
- apply(arguments, arg);
return null;
}
@override
- R visitSuperMethodIncompatibleInvoke(
+ R visitDynamicTypeLiteralInvoke(
Send node,
- MethodElement method,
+ ConstantExpression constant,
NodeList arguments,
CallStructure callStructure,
A arg) {
@@ -4218,74 +3927,102 @@ class TraversalSendMixin<R, A> implements SemanticSendVisitor<R, A> {
}
@override
- R visitSuperMethodSetterCompound(
+ R visitDynamicTypeLiteralPostfix(
Send node,
- FunctionElement method,
- FunctionElement setter,
- AssignmentOperator operator,
- Node rhs,
+ ConstantExpression constant,
+ IncDecOperator operator,
A arg) {
- apply(rhs, arg);
return null;
}
@override
- R visitSuperMethodSetterPostfix(
+ R visitDynamicTypeLiteralPrefix(
Send node,
- FunctionElement method,
- FunctionElement setter,
+ ConstantExpression constant,
IncDecOperator operator,
A arg) {
return null;
}
@override
- R visitSuperMethodSetterPrefix(
+ R visitEquals(
Send node,
- FunctionElement method,
- FunctionElement setter,
- IncDecOperator operator,
+ Node left,
+ Node right,
A arg) {
+ apply(left, arg);
+ apply(right, arg);
return null;
}
@override
- R visitSuperNotEquals(
+ R visitExpressionInvoke(
Send node,
- FunctionElement function,
- Node argument,
+ Node expression,
+ NodeList arguments,
+ Selector selector,
A arg) {
- apply(argument, arg);
+ apply(expression, arg);
+ apply(arguments, arg);
return null;
}
@override
- R visitSuperSetterSet(
+ R visitIndex(
+ Send node,
+ Node receiver,
+ Node index,
+ A arg) {
+ apply(receiver, arg);
+ apply(index, arg);
+ return null;
+ }
+
+ @override
+ R visitIndexSet(
SendSet node,
- FunctionElement setter,
+ Node receiver,
+ Node index,
Node rhs,
A arg) {
+ apply(receiver, arg);
+ apply(index, arg);
apply(rhs, arg);
return null;
}
@override
- R visitSuperUnary(
+ R visitIs(
Send node,
- UnaryOperator operator,
- FunctionElement function,
+ Node expression,
+ DartType type,
A arg) {
+ apply(expression, arg);
return null;
}
@override
- R visitThisGet(Identifier node, A arg) {
+ R visitIsNot(
+ Send node,
+ Node expression,
+ DartType type,
+ A arg) {
+ apply(expression, arg);
return null;
}
@override
- R visitThisInvoke(
+ R visitLocalFunctionGet(
+ Send node,
+ LocalFunctionElement function,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitLocalFunctionInvoke(
Send node,
+ LocalFunctionElement function,
NodeList arguments,
CallStructure callStructure,
A arg) {
@@ -4294,59 +4031,57 @@ class TraversalSendMixin<R, A> implements SemanticSendVisitor<R, A> {
}
@override
- R visitThisPropertyCompound(
+ R visitLocalVariableCompound(
Send node,
+ LocalVariableElement variable,
AssignmentOperator operator,
Node rhs,
- Selector getterSelector,
- Selector setterSelector,
A arg) {
apply(rhs, arg);
return null;
}
@override
- R visitThisPropertyGet(
+ R visitLocalVariableGet(
Send node,
- Selector selector,
+ LocalVariableElement variable,
A arg) {
return null;
}
@override
- R visitThisPropertyInvoke(
+ R visitLocalVariableInvoke(
Send node,
+ LocalVariableElement variable,
NodeList arguments,
- Selector selector,
+ CallStructure callStructure,
A arg) {
apply(arguments, arg);
return null;
}
@override
- R visitThisPropertyPostfix(
+ R visitLocalVariablePostfix(
Send node,
+ LocalVariableElement variable,
IncDecOperator operator,
- Selector getterSelector,
- Selector setterSelector,
A arg) {
return null;
}
@override
- R visitThisPropertyPrefix(
+ R visitLocalVariablePrefix(
Send node,
+ LocalVariableElement variable,
IncDecOperator operator,
- Selector getterSelector,
- Selector setterSelector,
A arg) {
return null;
}
@override
- R visitThisPropertySet(
+ R visitLocalVariableSet(
SendSet node,
- Selector selector,
+ LocalVariableElement variable,
Node rhs,
A arg) {
apply(rhs, arg);
@@ -4354,57 +4089,52 @@ class TraversalSendMixin<R, A> implements SemanticSendVisitor<R, A> {
}
@override
- R visitTopLevelFieldCompound(
+ R visitLogicalAnd(
Send node,
- FieldElement field,
- AssignmentOperator operator,
- Node rhs,
+ Node left,
+ Node right,
A arg) {
- apply(rhs, arg);
+ apply(left, arg);
+ apply(right, arg);
return null;
}
@override
- R visitTopLevelFieldGet(
+ R visitLogicalOr(
Send node,
- FieldElement field,
+ Node left,
+ Node right,
A arg) {
+ apply(left, arg);
+ apply(right, arg);
return null;
}
@override
- R visitTopLevelFieldInvoke(
+ R visitNot(
Send node,
- FieldElement field,
- NodeList arguments,
- CallStructure callStructure,
+ Node expression,
A arg) {
- apply(arguments, arg);
+ apply(expression, arg);
return null;
}
@override
- R visitTopLevelFieldPostfix(
+ R visitNotEquals(
Send node,
- FieldElement field,
- IncDecOperator operator,
+ Node left,
+ Node right,
A arg) {
+ apply(left, arg);
+ apply(right, arg);
return null;
}
@override
- R visitTopLevelFieldPrefix(
+ R visitParameterCompound(
Send node,
- FieldElement field,
- IncDecOperator operator,
- A arg) {
- return null;
- }
-
- @override
- R visitTopLevelFieldSet(
- SendSet node,
- FieldElement field,
+ ParameterElement parameter,
+ AssignmentOperator operator,
Node rhs,
A arg) {
apply(rhs, arg);
@@ -4412,17 +4142,17 @@ class TraversalSendMixin<R, A> implements SemanticSendVisitor<R, A> {
}
@override
- R visitTopLevelFunctionGet(
+ R visitParameterGet(
Send node,
- MethodElement function,
+ ParameterElement parameter,
A arg) {
return null;
}
@override
- R visitTopLevelFunctionInvoke(
+ R visitParameterInvoke(
Send node,
- MethodElement function,
+ ParameterElement parameter,
NodeList arguments,
CallStructure callStructure,
A arg) {
@@ -4431,40 +4161,37 @@ class TraversalSendMixin<R, A> implements SemanticSendVisitor<R, A> {
}
@override
- R visitTopLevelFunctionIncompatibleInvoke(
+ R visitParameterPostfix(
Send node,
- MethodElement function,
- NodeList arguments,
- CallStructure callStructure,
+ ParameterElement parameter,
+ IncDecOperator operator,
A arg) {
- apply(arguments, arg);
return null;
}
@override
- R visitTopLevelGetterGet(
+ R visitParameterPrefix(
Send node,
- FunctionElement getter,
+ ParameterElement parameter,
+ IncDecOperator operator,
A arg) {
return null;
}
@override
- R visitTopLevelGetterInvoke(
- Send node,
- FunctionElement getter,
- NodeList arguments,
- CallStructure callStructure,
+ R visitParameterSet(
+ SendSet node,
+ ParameterElement parameter,
+ Node rhs,
A arg) {
- apply(arguments, arg);
+ apply(rhs, arg);
return null;
}
@override
- R visitTopLevelGetterSetterCompound(
+ R visitStaticFieldCompound(
Send node,
- FunctionElement getter,
- FunctionElement setter,
+ FieldElement field,
AssignmentOperator operator,
Node rhs,
A arg) {
@@ -4473,61 +4200,46 @@ class TraversalSendMixin<R, A> implements SemanticSendVisitor<R, A> {
}
@override
- R visitTopLevelGetterSetterPostfix(
- Send node,
- FunctionElement getter,
- FunctionElement setter,
- IncDecOperator operator,
- A arg) {
- return null;
- }
-
- @override
- R visitTopLevelGetterSetterPrefix(
+ R visitStaticFieldGet(
Send node,
- FunctionElement getter,
- FunctionElement setter,
- IncDecOperator operator,
+ FieldElement field,
A arg) {
return null;
}
@override
- R visitTopLevelMethodSetterCompound(
+ R visitStaticFieldInvoke(
Send node,
- FunctionElement method,
- FunctionElement setter,
- AssignmentOperator operator,
- Node rhs,
+ FieldElement field,
+ NodeList arguments,
+ CallStructure callStructure,
A arg) {
- apply(rhs, arg);
+ apply(arguments, arg);
return null;
}
@override
- R visitTopLevelMethodSetterPostfix(
+ R visitStaticFieldPostfix(
Send node,
- FunctionElement method,
- FunctionElement setter,
+ FieldElement field,
IncDecOperator operator,
A arg) {
return null;
}
@override
- R visitTopLevelMethodSetterPrefix(
+ R visitStaticFieldPrefix(
Send node,
- FunctionElement method,
- FunctionElement setter,
+ FieldElement field,
IncDecOperator operator,
A arg) {
return null;
}
@override
- R visitTopLevelSetterSet(
+ R visitStaticFieldSet(
SendSet node,
- FunctionElement setter,
+ FieldElement field,
Node rhs,
A arg) {
apply(rhs, arg);
@@ -4535,28 +4247,28 @@ class TraversalSendMixin<R, A> implements SemanticSendVisitor<R, A> {
}
@override
- R errorTypeVariableTypeLiteralCompound(
+ R visitStaticFunctionGet(
Send node,
- TypeVariableElement element,
- AssignmentOperator operator,
- Node rhs,
+ MethodElement function,
A arg) {
- apply(rhs, arg);
return null;
}
@override
- R visitTypeVariableTypeLiteralGet(
+ R visitStaticFunctionInvoke(
Send node,
- TypeVariableElement element,
+ MethodElement function,
+ NodeList arguments,
+ CallStructure callStructure,
A arg) {
+ apply(arguments, arg);
return null;
}
@override
- R visitTypeVariableTypeLiteralInvoke(
+ R visitStaticFunctionIncompatibleInvoke(
Send node,
- TypeVariableElement element,
+ MethodElement function,
NodeList arguments,
CallStructure callStructure,
A arg) {
@@ -4565,27 +4277,29 @@ class TraversalSendMixin<R, A> implements SemanticSendVisitor<R, A> {
}
@override
- R errorTypeVariableTypeLiteralPostfix(
+ R visitStaticGetterGet(
Send node,
- TypeVariableElement element,
- IncDecOperator operator,
+ FunctionElement getter,
A arg) {
return null;
}
@override
- R errorTypeVariableTypeLiteralPrefix(
+ R visitStaticGetterInvoke(
Send node,
- TypeVariableElement element,
- IncDecOperator operator,
+ FunctionElement getter,
+ NodeList arguments,
+ CallStructure callStructure,
A arg) {
+ apply(arguments, arg);
return null;
}
@override
- R errorTypedefTypeLiteralCompound(
+ R visitStaticGetterSetterCompound(
Send node,
- ConstantExpression constant,
+ FunctionElement getter,
+ FunctionElement setter,
AssignmentOperator operator,
Node rhs,
A arg) {
@@ -4594,56 +4308,84 @@ class TraversalSendMixin<R, A> implements SemanticSendVisitor<R, A> {
}
@override
- R visitTypedefTypeLiteralGet(
+ R visitStaticGetterSetterPostfix(
Send node,
- ConstantExpression constant,
+ FunctionElement getter,
+ FunctionElement setter,
+ IncDecOperator operator,
A arg) {
return null;
}
@override
- R visitTypedefTypeLiteralInvoke(
+ R visitStaticGetterSetterPrefix(
Send node,
- ConstantExpression constant,
- NodeList arguments,
- CallStructure callStructure,
+ FunctionElement getter,
+ FunctionElement setter,
+ IncDecOperator operator,
A arg) {
- apply(arguments, arg);
return null;
}
@override
- R errorTypedefTypeLiteralPostfix(
+ R visitStaticMethodSetterCompound(
Send node,
- ConstantExpression constant,
- IncDecOperator operator,
+ FunctionElement method,
+ FunctionElement setter,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
+ apply(rhs, arg);
return null;
}
@override
- R errorTypedefTypeLiteralPrefix(
+ R visitStaticMethodSetterPostfix(
Send node,
- ConstantExpression constant,
+ FunctionElement getter,
+ FunctionElement setter,
IncDecOperator operator,
A arg) {
return null;
}
@override
- R visitUnary(
+ R visitStaticMethodSetterPrefix(
Send node,
- UnaryOperator operator,
- Node expression,
+ FunctionElement getter,
+ FunctionElement setter,
+ IncDecOperator operator,
A arg) {
- apply(expression, arg);
return null;
}
@override
- R errorUnresolvedCompound(
+ R visitStaticSetterSet(
+ SendSet node,
+ FunctionElement setter,
+ Node rhs,
+ A arg) {
+ apply(rhs, arg);
+ return null;
+ }
+
+ @override
+ R visitSuperBinary(
Send node,
- Element element,
+ FunctionElement function,
+ BinaryOperator operator,
+ Node argument,
+ A arg) {
+ apply(argument, arg);
+ return null;
+ }
+
+ @override
+ R visitSuperCompoundIndexSet(
+ SendSet node,
+ FunctionElement getter,
+ FunctionElement setter,
+ Node index,
AssignmentOperator operator,
Node rhs,
A arg) {
@@ -4652,263 +4394,242 @@ class TraversalSendMixin<R, A> implements SemanticSendVisitor<R, A> {
}
@override
- R visitUnresolvedGet(
+ R visitSuperEquals(
Send node,
- Element element,
+ FunctionElement function,
+ Node argument,
A arg) {
+ apply(argument, arg);
return null;
}
@override
- R visitUnresolvedInvoke(
+ R visitSuperFieldCompound(
Send node,
- Element element,
- NodeList arguments,
- Selector selector,
+ FieldElement field,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- apply(arguments, arg);
+ apply(rhs, arg);
return null;
}
@override
- R errorUnresolvedPostfix(
+ R visitSuperFieldFieldPostfix(
Send node,
- Element element,
+ FieldElement readField,
+ FieldElement writtenField,
IncDecOperator operator,
A arg) {
return null;
}
@override
- R errorUnresolvedPrefix(
+ R visitSuperFieldFieldPrefix(
Send node,
- Element element,
+ FieldElement readField,
+ FieldElement writtenField,
IncDecOperator operator,
A arg) {
return null;
}
@override
- R errorUnresolvedSet(
+ R visitSuperFieldGet(
Send node,
- Element element,
- Node rhs,
+ FieldElement field,
A arg) {
- apply(rhs, arg);
return null;
}
@override
- R errorUndefinedBinaryExpression(
+ R visitSuperFieldInvoke(
Send node,
- Node left,
- Operator operator,
- Node right,
+ FieldElement field,
+ NodeList arguments,
+ CallStructure callStructure,
A arg) {
- apply(left, arg);
- apply(right, arg);
+ apply(arguments, arg);
return null;
}
@override
- R errorUndefinedUnaryExpression(
+ R visitSuperFieldPostfix(
Send node,
- Operator operator,
- Node expression,
+ FieldElement field,
+ IncDecOperator operator,
A arg) {
- apply(expression, arg);
return null;
}
@override
- R visitUnresolvedSuperIndexSet(
+ R visitSuperFieldPrefix(
Send node,
- Element element,
- Node index,
- Node rhs,
+ FieldElement field,
+ IncDecOperator operator,
A arg) {
- apply(index, arg);
- apply(rhs, arg);
return null;
}
@override
- R visitUnresolvedSuperGetterCompoundIndexSet(
+ R visitSuperFieldSet(
SendSet node,
- Element element,
- Node index,
- AssignmentOperator operator,
+ FieldElement field,
Node rhs,
A arg) {
- apply(index, arg);
apply(rhs, arg);
return null;
}
@override
- R visitUnresolvedSuperSetterCompoundIndexSet(
- SendSet node,
- MethodElement getter,
- Element element,
- Node index,
+ R visitSuperFieldSetterCompound(
+ Send node,
+ FieldElement field,
+ FunctionElement setter,
AssignmentOperator operator,
Node rhs,
A arg) {
- apply(index, arg);
apply(rhs, arg);
return null;
}
@override
- R visitUnresolvedSuperBinary(
+ R visitSuperFieldSetterPostfix(
Send node,
- Element element,
- BinaryOperator operator,
- Node argument,
+ FieldElement field,
+ FunctionElement setter,
+ IncDecOperator operator,
A arg) {
- apply(argument, arg);
return null;
}
@override
- R visitUnresolvedSuperUnary(
+ R visitSuperFieldSetterPrefix(
Send node,
- UnaryOperator operator,
- Element element,
+ FieldElement field,
+ FunctionElement setter,
+ IncDecOperator operator,
A arg) {
return null;
}
@override
- R visitUnresolvedSuperGetterIndexPostfix(
+ R visitSuperGetterFieldCompound(
Send node,
- Element element,
- Node index,
- IncDecOperator operator,
- A arg) {
- apply(index, arg);
+ FunctionElement getter,
+ FieldElement field,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ apply(rhs, arg);
return null;
}
@override
- R visitUnresolvedSuperSetterIndexPostfix(
+ R visitSuperGetterFieldPostfix(
Send node,
- MethodElement getter,
- Element element,
- Node index,
+ FunctionElement getter,
+ FieldElement field,
IncDecOperator operator,
A arg) {
- apply(index, arg);
return null;
}
@override
- R visitUnresolvedSuperGetterIndexPrefix(
+ R visitSuperGetterFieldPrefix(
Send node,
- Element element,
- Node index,
+ FunctionElement getter,
+ FieldElement field,
IncDecOperator operator,
A arg) {
- apply(index, arg);
return null;
}
@override
- R visitUnresolvedSuperSetterIndexPrefix(
+ R visitSuperGetterGet(
Send node,
- MethodElement getter,
- Element element,
- Node index,
- IncDecOperator operator,
+ FunctionElement getter,
A arg) {
- apply(index, arg);
return null;
}
@override
- R visitIndexPostfix(
+ R visitSuperGetterInvoke(
Send node,
- Node receiver,
- Node index,
- IncDecOperator operator,
+ FunctionElement getter,
+ NodeList arguments,
+ CallStructure callStructure,
A arg) {
- apply(receiver, arg);
- apply(index, arg);
+ apply(arguments, arg);
return null;
}
@override
- R visitIndexPrefix(
+ R visitSuperGetterSetterCompound(
Send node,
- Node receiver,
- Node index,
- IncDecOperator operator,
+ FunctionElement getter,
+ FunctionElement setter,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- apply(receiver, arg);
- apply(index, arg);
+ apply(rhs, arg);
return null;
}
@override
- R visitSuperIndexPostfix(
+ R visitSuperGetterSetterPostfix(
Send node,
- FunctionElement indexFunction,
- FunctionElement indexSetFunction,
- Node index,
+ FunctionElement getter,
+ FunctionElement setter,
IncDecOperator operator,
A arg) {
- apply(index, arg);
return null;
}
@override
- R visitSuperIndexPrefix(
+ R visitSuperGetterSetterPrefix(
Send node,
- FunctionElement indexFunction,
- FunctionElement indexSetFunction,
- Node index,
+ FunctionElement getter,
+ FunctionElement setter,
IncDecOperator operator,
A arg) {
- apply(index, arg);
return null;
}
- R visitConstConstructorInvoke(
- NewExpression node,
- ConstructedConstantExpression constant,
+ @override
+ R visitSuperIndex(
+ Send node,
+ FunctionElement function,
+ Node index,
A arg) {
+ apply(index, arg);
return null;
}
@override
- R visitUnresolvedClassConstructorInvoke(
- NewExpression node,
- Element constructor,
- DartType type,
- NodeList arguments,
- Selector selector,
+ R visitSuperIndexSet(
+ SendSet node,
+ FunctionElement function,
+ Node index,
+ Node rhs,
A arg) {
- apply(arguments, arg);
+ apply(index, arg);
+ apply(rhs, arg);
return null;
}
@override
- R visitUnresolvedConstructorInvoke(
- NewExpression node,
- Element constructor,
- DartType type,
- NodeList arguments,
- Selector selector,
+ R visitSuperMethodGet(
+ Send node,
+ MethodElement method,
A arg) {
- apply(arguments, arg);
return null;
}
@override
- R visitFactoryConstructorInvoke(
- NewExpression node,
- ConstructorElement constructor,
- InterfaceType type,
+ R visitSuperMethodInvoke(
+ Send node,
+ MethodElement method,
NodeList arguments,
CallStructure callStructure,
A arg) {
@@ -4917,10 +4638,9 @@ class TraversalSendMixin<R, A> implements SemanticSendVisitor<R, A> {
}
@override
- R visitGenerativeConstructorInvoke(
- NewExpression node,
- ConstructorElement constructor,
- InterfaceType type,
+ R visitSuperMethodIncompatibleInvoke(
+ Send node,
+ MethodElement method,
NodeList arguments,
CallStructure callStructure,
A arg) {
@@ -4929,1469 +4649,4937 @@ class TraversalSendMixin<R, A> implements SemanticSendVisitor<R, A> {
}
@override
- R visitRedirectingFactoryConstructorInvoke(
- NewExpression node,
- ConstructorElement constructor,
- InterfaceType type,
- ConstructorElement effectiveTarget,
- InterfaceType effectiveTargetType,
- NodeList arguments,
- CallStructure callStructure,
+ R visitSuperMethodSetterCompound(
+ Send node,
+ FunctionElement method,
+ FunctionElement setter,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- apply(arguments, arg);
+ apply(rhs, arg);
return null;
}
@override
- R visitRedirectingGenerativeConstructorInvoke(
- NewExpression node,
- ConstructorElement constructor,
- InterfaceType type,
- NodeList arguments,
- CallStructure callStructure,
+ R visitSuperMethodSetterPostfix(
+ Send node,
+ FunctionElement method,
+ FunctionElement setter,
+ IncDecOperator operator,
A arg) {
- apply(arguments, arg);
return null;
}
@override
- R visitAbstractClassConstructorInvoke(
- NewExpression node,
- ConstructorElement element,
- InterfaceType type,
- NodeList arguments,
- CallStructure callStructure,
+ R visitSuperMethodSetterPrefix(
+ Send node,
+ FunctionElement method,
+ FunctionElement setter,
+ IncDecOperator operator,
A arg) {
- apply(arguments, arg);
return null;
}
@override
- R visitUnresolvedRedirectingFactoryConstructorInvoke(
- NewExpression node,
- ConstructorElement constructor,
- InterfaceType type,
- NodeList arguments,
- CallStructure callStructure,
+ R visitSuperNotEquals(
+ Send node,
+ FunctionElement function,
+ Node argument,
A arg) {
- apply(arguments, arg);
+ apply(argument, arg);
return null;
}
@override
- R errorNonConstantConstructorInvoke(
- NewExpression node,
- Element element,
- DartType type,
- NodeList arguments,
- CallStructure callStructure,
+ R visitSuperSetterSet(
+ SendSet node,
+ FunctionElement setter,
+ Node rhs,
A arg) {
- apply(arguments, arg);
+ apply(rhs, arg);
return null;
}
-}
-/// [SemanticDeclarationVisitor] that visits subnodes.
-class TraversalDeclarationMixin<R, A>
- implements SemanticDeclarationVisitor<R, A> {
@override
- R apply(Node node, A arg) {
- throw new UnimplementedError("TraversalMixin.apply unimplemented");
+ R visitSuperUnary(
+ Send node,
+ UnaryOperator operator,
+ FunctionElement function,
+ A arg) {
+ return null;
}
@override
- applyInitializers(NodeList initializers, A arg) {
- throw new UnimplementedError(
- "TraversalMixin.applyInitializers unimplemented");
+ R visitThisGet(Identifier node, A arg) {
+ return null;
}
@override
- applyParameters(NodeList parameters, A arg) {
- throw new UnimplementedError(
- "TraversalMixin.applyParameters unimplemented");
+ R visitThisInvoke(
+ Send node,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
+ apply(arguments, arg);
+ return null;
}
@override
- R visitAbstractMethodDeclaration(
- FunctionExpression node,
- MethodElement method,
- NodeList parameters,
+ R visitThisPropertyCompound(
+ Send node,
+ AssignmentOperator operator,
+ Node rhs,
+ Selector getterSelector,
+ Selector setterSelector,
A arg) {
- applyParameters(parameters, arg);
+ apply(rhs, arg);
return null;
}
@override
- R visitClosureDeclaration(
- FunctionExpression node,
- LocalFunctionElement function,
- NodeList parameters,
- Node body,
+ R visitThisPropertyGet(
+ Send node,
+ Selector selector,
A arg) {
- applyParameters(parameters, arg);
- apply(body, arg);
return null;
}
@override
- R visitFactoryConstructorDeclaration(
- FunctionExpression node,
- ConstructorElement constructor,
- NodeList parameters,
- Node body,
+ R visitThisPropertyInvoke(
+ Send node,
+ NodeList arguments,
+ Selector selector,
A arg) {
- applyParameters(parameters, arg);
- apply(body, arg);
+ apply(arguments, arg);
return null;
}
@override
- R visitFieldInitializer(
- SendSet node,
- FieldElement field,
- Node initializer,
+ R visitThisPropertyPostfix(
+ Send node,
+ IncDecOperator operator,
+ Selector getterSelector,
+ Selector setterSelector,
A arg) {
- apply(initializer, arg);
return null;
}
@override
- R visitGenerativeConstructorDeclaration(
- FunctionExpression node,
- ConstructorElement constructor,
- NodeList parameters,
- NodeList initializers,
- Node body,
+ R visitThisPropertyPrefix(
+ Send node,
+ IncDecOperator operator,
+ Selector getterSelector,
+ Selector setterSelector,
A arg) {
- applyParameters(parameters, arg);
- applyInitializers(initializers, arg);
- apply(body, arg);
return null;
}
@override
- R visitInstanceMethodDeclaration(
- FunctionExpression node,
- MethodElement method,
- NodeList parameters,
- Node body,
+ R visitThisPropertySet(
+ SendSet node,
+ Selector selector,
+ Node rhs,
A arg) {
- applyParameters(parameters, arg);
- apply(body, arg);
+ apply(rhs, arg);
return null;
}
@override
- R visitLocalFunctionDeclaration(
- FunctionExpression node,
- LocalFunctionElement function,
- NodeList parameters,
- Node body,
+ R visitTopLevelFieldCompound(
+ Send node,
+ FieldElement field,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- applyParameters(parameters, arg);
- apply(body, arg);
+ apply(rhs, arg);
return null;
}
@override
- R visitRedirectingFactoryConstructorDeclaration(
- FunctionExpression node,
- ConstructorElement constructor,
- NodeList parameters,
- InterfaceType redirectionType,
- ConstructorElement redirectionTarget,
+ R visitTopLevelFieldGet(
+ Send node,
+ FieldElement field,
A arg) {
- applyParameters(parameters, arg);
return null;
}
@override
- R visitRedirectingGenerativeConstructorDeclaration(
- FunctionExpression node,
- ConstructorElement constructor,
- NodeList parameters,
- NodeList initializers,
+ R visitTopLevelFieldInvoke(
+ Send node,
+ FieldElement field,
+ NodeList arguments,
+ CallStructure callStructure,
A arg) {
- applyParameters(parameters, arg);
- applyInitializers(initializers, arg);
+ apply(arguments, arg);
return null;
}
@override
- R visitStaticFunctionDeclaration(
- FunctionExpression node,
+ R visitTopLevelFieldPostfix(
+ Send node,
+ FieldElement field,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitTopLevelFieldPrefix(
+ Send node,
+ FieldElement field,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitTopLevelFieldSet(
+ SendSet node,
+ FieldElement field,
+ Node rhs,
+ A arg) {
+ apply(rhs, arg);
+ return null;
+ }
+
+ @override
+ R visitTopLevelFunctionGet(
+ Send node,
MethodElement function,
- NodeList parameters,
- Node body,
A arg) {
- applyParameters(parameters, arg);
- apply(body, arg);
return null;
}
@override
- R visitSuperConstructorInvoke(
+ R visitTopLevelFunctionInvoke(
Send node,
- ConstructorElement superConstructor,
- InterfaceType type,
+ MethodElement function,
NodeList arguments,
- Selector selector,
+ CallStructure callStructure,
A arg) {
apply(arguments, arg);
return null;
}
@override
- R visitThisConstructorInvoke(
+ R visitTopLevelFunctionIncompatibleInvoke(
Send node,
- ConstructorElement thisConstructor,
+ MethodElement function,
NodeList arguments,
- Selector selector,
+ CallStructure callStructure,
A arg) {
apply(arguments, arg);
return null;
}
@override
- R visitTopLevelFunctionDeclaration(
- FunctionExpression node,
- MethodElement function,
- NodeList parameters,
- Node body,
+ R visitTopLevelGetterGet(
+ Send node,
+ FunctionElement getter,
A arg) {
- applyParameters(parameters, arg);
- apply(body, arg);
return null;
}
@override
- R errorUnresolvedFieldInitializer(
+ R visitTopLevelGetterInvoke(
+ Send node,
+ FunctionElement getter,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
+ apply(arguments, arg);
+ return null;
+ }
+
+ @override
+ R visitTopLevelGetterSetterCompound(
+ Send node,
+ FunctionElement getter,
+ FunctionElement setter,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ apply(rhs, arg);
+ return null;
+ }
+
+ @override
+ R visitTopLevelGetterSetterPostfix(
+ Send node,
+ FunctionElement getter,
+ FunctionElement setter,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitTopLevelGetterSetterPrefix(
+ Send node,
+ FunctionElement getter,
+ FunctionElement setter,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitTopLevelMethodSetterCompound(
+ Send node,
+ FunctionElement method,
+ FunctionElement setter,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ apply(rhs, arg);
+ return null;
+ }
+
+ @override
+ R visitTopLevelMethodSetterPostfix(
+ Send node,
+ FunctionElement method,
+ FunctionElement setter,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitTopLevelMethodSetterPrefix(
+ Send node,
+ FunctionElement method,
+ FunctionElement setter,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitTopLevelSetterSet(
SendSet node,
- Element element,
- Node initializer,
+ FunctionElement setter,
+ Node rhs,
A arg) {
- apply(initializer, arg);
+ apply(rhs, arg);
return null;
}
@override
- R errorUnresolvedSuperConstructorInvoke(
+ R visitTypeVariableTypeLiteralCompound(
Send node,
- Element element,
- NodeList arguments,
- Selector selector,
+ TypeVariableElement element,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- apply(arguments, arg);
+ apply(rhs, arg);
return null;
}
@override
- R errorUnresolvedThisConstructorInvoke(
+ R visitTypeVariableTypeLiteralGet(
Send node,
- Element element,
+ TypeVariableElement element,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitTypeVariableTypeLiteralInvoke(
+ Send node,
+ TypeVariableElement element,
NodeList arguments,
- Selector selector,
+ CallStructure callStructure,
A arg) {
apply(arguments, arg);
return null;
}
@override
- R visitLocalVariableDeclaration(
- VariableDefinitions node,
- Node definition,
- LocalVariableElement variable,
- Node initializer,
+ R visitTypeVariableTypeLiteralPostfix(
+ Send node,
+ TypeVariableElement element,
+ IncDecOperator operator,
A arg) {
- if (initializer != null) {
- apply(initializer, arg);
- }
return null;
}
@override
- R visitOptionalParameterDeclaration(
- VariableDefinitions node,
- Node definition,
- ParameterElement parameter,
- ConstantExpression defaultValue,
- int index,
+ R visitTypeVariableTypeLiteralPrefix(
+ Send node,
+ TypeVariableElement element,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitTypedefTypeLiteralCompound(
+ Send node,
+ ConstantExpression constant,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ apply(rhs, arg);
+ return null;
+ }
+
+ @override
+ R visitTypedefTypeLiteralGet(
+ Send node,
+ ConstantExpression constant,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitTypedefTypeLiteralInvoke(
+ Send node,
+ ConstantExpression constant,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
+ apply(arguments, arg);
+ return null;
+ }
+
+ @override
+ R visitTypedefTypeLiteralPostfix(
+ Send node,
+ ConstantExpression constant,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitTypedefTypeLiteralPrefix(
+ Send node,
+ ConstantExpression constant,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitUnary(
+ Send node,
+ UnaryOperator operator,
+ Node expression,
+ A arg) {
+ apply(expression, arg);
+ return null;
+ }
+
+ @override
+ R visitUnresolvedCompound(
+ Send node,
+ Element element,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ apply(rhs, arg);
+ return null;
+ }
+
+ @override
+ R visitUnresolvedGet(
+ Send node,
+ Element element,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitUnresolvedInvoke(
+ Send node,
+ Element element,
+ NodeList arguments,
+ Selector selector,
+ A arg) {
+ apply(arguments, arg);
+ return null;
+ }
+
+ @override
+ R visitUnresolvedPostfix(
+ Send node,
+ Element element,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitUnresolvedPrefix(
+ Send node,
+ Element element,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R errorUnresolvedSet(
+ Send node,
+ Element element,
+ Node rhs,
+ A arg) {
+ apply(rhs, arg);
+ return null;
+ }
+
+ @override
+ R errorUndefinedBinaryExpression(
+ Send node,
+ Node left,
+ Operator operator,
+ Node right,
+ A arg) {
+ apply(left, arg);
+ apply(right, arg);
+ return null;
+ }
+
+ @override
+ R errorUndefinedUnaryExpression(
+ Send node,
+ Operator operator,
+ Node expression,
+ A arg) {
+ apply(expression, arg);
+ return null;
+ }
+
+ @override
+ R visitUnresolvedSuperIndexSet(
+ Send node,
+ Element element,
+ Node index,
+ Node rhs,
+ A arg) {
+ apply(index, arg);
+ apply(rhs, arg);
+ return null;
+ }
+
+ @override
+ R visitUnresolvedSuperGetterCompoundIndexSet(
+ SendSet node,
+ Element element,
+ MethodElement setter,
+ Node index,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ apply(index, arg);
+ apply(rhs, arg);
+ return null;
+ }
+
+ @override
+ R visitUnresolvedSuperSetterCompoundIndexSet(
+ SendSet node,
+ MethodElement getter,
+ Element element,
+ Node index,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ apply(index, arg);
+ apply(rhs, arg);
+ return null;
+ }
+
+ @override
+ R visitUnresolvedSuperCompoundIndexSet(
+ SendSet node,
+ Element element,
+ Node index,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ apply(index, arg);
+ apply(rhs, arg);
+ return null;
+ }
+
+ @override
+ R visitUnresolvedSuperBinary(
+ Send node,
+ Element element,
+ BinaryOperator operator,
+ Node argument,
+ A arg) {
+ apply(argument, arg);
+ return null;
+ }
+
+ @override
+ R visitUnresolvedSuperUnary(
+ Send node,
+ UnaryOperator operator,
+ Element element,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitUnresolvedSuperGetterIndexPostfix(
+ Send node,
+ Element element,
+ MethodElement setter,
+ Node index,
+ IncDecOperator operator,
+ A arg) {
+ apply(index, arg);
+ return null;
+ }
+
+ @override
+ R visitUnresolvedSuperSetterIndexPostfix(
+ Send node,
+ MethodElement getter,
+ Element element,
+ Node index,
+ IncDecOperator operator,
+ A arg) {
+ apply(index, arg);
+ return null;
+ }
+
+ @override
+ R visitUnresolvedSuperIndexPostfix(
+ Send node,
+ Element element,
+ Node index,
+ IncDecOperator operator,
+ A arg) {
+ apply(index, arg);
+ return null;
+ }
+
+ @override
+ R visitUnresolvedSuperGetterIndexPrefix(
+ Send node,
+ Element element,
+ MethodElement setter,
+ Node index,
+ IncDecOperator operator,
+ A arg) {
+ apply(index, arg);
+ return null;
+ }
+
+ @override
+ R visitUnresolvedSuperSetterIndexPrefix(
+ Send node,
+ MethodElement getter,
+ Element element,
+ Node index,
+ IncDecOperator operator,
+ A arg) {
+ apply(index, arg);
+ return null;
+ }
+
+ @override
+ R visitUnresolvedSuperIndexPrefix(
+ Send node,
+ Element element,
+ Node index,
+ IncDecOperator operator,
+ A arg) {
+ apply(index, arg);
+ return null;
+ }
+
+ @override
+ R visitIndexPostfix(
+ Send node,
+ Node receiver,
+ Node index,
+ IncDecOperator operator,
+ A arg) {
+ apply(receiver, arg);
+ apply(index, arg);
+ return null;
+ }
+
+ @override
+ R visitIndexPrefix(
+ Send node,
+ Node receiver,
+ Node index,
+ IncDecOperator operator,
+ A arg) {
+ apply(receiver, arg);
+ apply(index, arg);
+ return null;
+ }
+
+ @override
+ R visitSuperIndexPostfix(
+ Send node,
+ FunctionElement indexFunction,
+ FunctionElement indexSetFunction,
+ Node index,
+ IncDecOperator operator,
+ A arg) {
+ apply(index, arg);
+ return null;
+ }
+
+ @override
+ R visitSuperIndexPrefix(
+ Send node,
+ FunctionElement indexFunction,
+ FunctionElement indexSetFunction,
+ Node index,
+ IncDecOperator operator,
+ A arg) {
+ apply(index, arg);
+ return null;
+ }
+
+ @override
+ R visitConstConstructorInvoke(
+ NewExpression node,
+ ConstructedConstantExpression constant,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitUnresolvedClassConstructorInvoke(
+ NewExpression node,
+ Element constructor,
+ DartType type,
+ NodeList arguments,
+ Selector selector,
+ A arg) {
+ apply(arguments, arg);
+ return null;
+ }
+
+ @override
+ R visitUnresolvedConstructorInvoke(
+ NewExpression node,
+ Element constructor,
+ DartType type,
+ NodeList arguments,
+ Selector selector,
+ A arg) {
+ apply(arguments, arg);
+ return null;
+ }
+
+ @override
+ R visitFactoryConstructorInvoke(
+ NewExpression node,
+ ConstructorElement constructor,
+ InterfaceType type,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
+ apply(arguments, arg);
+ return null;
+ }
+
+ @override
+ R visitGenerativeConstructorInvoke(
+ NewExpression node,
+ ConstructorElement constructor,
+ InterfaceType type,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
+ apply(arguments, arg);
+ return null;
+ }
+
+ @override
+ R visitRedirectingFactoryConstructorInvoke(
+ NewExpression node,
+ ConstructorElement constructor,
+ InterfaceType type,
+ ConstructorElement effectiveTarget,
+ InterfaceType effectiveTargetType,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
+ apply(arguments, arg);
+ return null;
+ }
+
+ @override
+ R visitRedirectingGenerativeConstructorInvoke(
+ NewExpression node,
+ ConstructorElement constructor,
+ InterfaceType type,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
+ apply(arguments, arg);
+ return null;
+ }
+
+ @override
+ R visitAbstractClassConstructorInvoke(
+ NewExpression node,
+ ConstructorElement element,
+ InterfaceType type,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
+ apply(arguments, arg);
+ return null;
+ }
+
+ @override
+ R visitUnresolvedRedirectingFactoryConstructorInvoke(
+ NewExpression node,
+ ConstructorElement constructor,
+ InterfaceType type,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
+ apply(arguments, arg);
+ return null;
+ }
+
+ @override
+ R errorNonConstantConstructorInvoke(
+ NewExpression node,
+ Element element,
+ DartType type,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
+ apply(arguments, arg);
+ return null;
+ }
+
+ @override
+ R visitUnresolvedStaticGetterCompound(
+ Send node,
+ Element element,
+ MethodElement setter,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ apply(rhs, arg);
+ return null;
+ }
+
+ @override
+ R visitUnresolvedTopLevelGetterCompound(
+ Send node,
+ Element element,
+ MethodElement setter,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ apply(rhs, arg);
+ return null;
+ }
+
+ @override
+ R visitUnresolvedStaticSetterCompound(
+ Send node,
+ MethodElement getter,
+ Element element,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ apply(rhs, arg);
+ return null;
+ }
+
+ @override
+ R visitUnresolvedTopLevelSetterCompound(
+ Send node,
+ MethodElement getter,
+ Element element,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ apply(rhs, arg);
+ return null;
+ }
+
+ @override
+ R visitStaticMethodCompound(
+ Send node,
+ MethodElement method,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ apply(rhs, arg);
+ return null;
+ }
+
+ @override
+ R visitUnresolvedStaticGetterPrefix(
+ Send node,
+ Element element,
+ MethodElement setter,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitUnresolvedTopLevelGetterPrefix(
+ Send node,
+ Element element,
+ MethodElement setter,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitUnresolvedStaticSetterPrefix(
+ Send node,
+ MethodElement getter,
+ Element element,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitUnresolvedTopLevelSetterPrefix(
+ Send node,
+ MethodElement getter,
+ Element element,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitStaticMethodPrefix(
+ Send node,
+ MethodElement method,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitTopLevelMethodPrefix(
+ Send node,
+ MethodElement method,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitUnresolvedStaticGetterPostfix(
+ Send node,
+ Element element,
+ MethodElement setter,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitUnresolvedTopLevelGetterPostfix(
+ Send node,
+ Element element,
+ MethodElement setter,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitUnresolvedStaticSetterPostfix(
+ Send node,
+ MethodElement getter,
+ Element element,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitUnresolvedTopLevelSetterPostfix(
+ Send node,
+ MethodElement getter,
+ Element element,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitStaticMethodPostfix(
+ Send node,
+ MethodElement method,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitTopLevelMethodPostfix(
+ Send node,
+ MethodElement method,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitFinalLocalVariablePostfix(
+ Send node,
+ LocalVariableElement variable,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitFinalLocalVariablePrefix(
+ Send node,
+ LocalVariableElement variable,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitFinalParameterPostfix(
+ Send node,
+ ParameterElement parameter,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitFinalParameterPrefix(
+ Send node,
+ ParameterElement parameter,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitFinalStaticFieldPostfix(
+ Send node,
+ FieldElement field,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitFinalStaticFieldPrefix(
+ Send node,
+ FieldElement field,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitSuperFieldFieldCompound(
+ Send node, FieldElement readField,
+ FieldElement writtenField,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ apply(rhs, arg);
+ return null;
+ }
+
+ @override
+ R visitFinalSuperFieldCompound(
+ Send node,
+ FieldElement field,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ apply(rhs, arg);
+ return null;
+ }
+
+ @override
+ R visitFinalSuperFieldPostfix(
+ Send node,
+ FieldElement field,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitFinalSuperFieldPrefix(
+ Send node,
+ FieldElement field,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitSuperMethodCompound(
+ Send node,
+ FunctionElement method,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ apply(rhs, arg);
+ return null;
+ }
+
+ @override
+ R visitSuperMethodPostfix(
+ Send node,
+ FunctionElement method,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitSuperMethodPrefix(
+ Send node,
+ FunctionElement method,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitFinalTopLevelFieldPostfix(
+ Send node,
+ FieldElement field,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitFinalTopLevelFieldPrefix(
+ Send node,
+ FieldElement field,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitTopLevelMethodCompound(
+ Send node,
+ FunctionElement method,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ apply(rhs, arg);
+ return null;
+ }
+
+ @override
+ R visitUnresolvedSuperCompound(
+ Send node,
+ Element element,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ apply(rhs, arg);
+ return null;
+ }
+
+ @override
+ R visitUnresolvedSuperPostfix(
+ Send node,
+ Element element,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitUnresolvedSuperPrefix(
+ Send node,
+ Element element,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitUnresolvedSuperGetterCompound(
+ Send node, Element element,
+ MethodElement setter,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ apply(rhs, arg);
+ return null;
+ }
+
+ @override
+ R visitUnresolvedSuperGetterPostfix(
+ Send node,
+ Element element,
+ MethodElement setter,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitUnresolvedSuperGetterPrefix(
+ Send node,
+ Element element,
+ MethodElement setter,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitUnresolvedSuperSetterCompound(
+ Send node, MethodElement getter,
+ Element element,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ apply(rhs, arg);
+ return null;
+ }
+
+ @override
+ R visitUnresolvedSuperSetterPostfix(
+ Send node,
+ MethodElement getter,
+ Element element,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitUnresolvedSuperSetterPrefix(
+ Send node,
+ MethodElement getter,
+ Element element,
+ IncDecOperator operator,
+ A arg) {
+ return null;
+ }
+}
+
+/// [SemanticDeclarationVisitor] that visits subnodes.
+class TraversalDeclarationMixin<R, A>
+ implements SemanticDeclarationVisitor<R, A> {
+ @override
+ R apply(Node node, A arg) {
+ throw new UnimplementedError("TraversalMixin.apply unimplemented");
+ }
+
+ @override
+ applyInitializers(NodeList initializers, A arg) {
+ throw new UnimplementedError(
+ "TraversalMixin.applyInitializers unimplemented");
+ }
+
+ @override
+ applyParameters(NodeList parameters, A arg) {
+ throw new UnimplementedError(
+ "TraversalMixin.applyParameters unimplemented");
+ }
+
+ @override
+ R visitAbstractMethodDeclaration(
+ FunctionExpression node,
+ MethodElement method,
+ NodeList parameters,
+ A arg) {
+ applyParameters(parameters, arg);
+ return null;
+ }
+
+ @override
+ R visitClosureDeclaration(
+ FunctionExpression node,
+ LocalFunctionElement function,
+ NodeList parameters,
+ Node body,
+ A arg) {
+ applyParameters(parameters, arg);
+ apply(body, arg);
+ return null;
+ }
+
+ @override
+ R visitFactoryConstructorDeclaration(
+ FunctionExpression node,
+ ConstructorElement constructor,
+ NodeList parameters,
+ Node body,
+ A arg) {
+ applyParameters(parameters, arg);
+ apply(body, arg);
+ return null;
+ }
+
+ @override
+ R visitFieldInitializer(
+ SendSet node,
+ FieldElement field,
+ Node initializer,
+ A arg) {
+ apply(initializer, arg);
+ return null;
+ }
+
+ @override
+ R visitGenerativeConstructorDeclaration(
+ FunctionExpression node,
+ ConstructorElement constructor,
+ NodeList parameters,
+ NodeList initializers,
+ Node body,
+ A arg) {
+ applyParameters(parameters, arg);
+ applyInitializers(initializers, arg);
+ apply(body, arg);
+ return null;
+ }
+
+ @override
+ R visitInstanceMethodDeclaration(
+ FunctionExpression node,
+ MethodElement method,
+ NodeList parameters,
+ Node body,
+ A arg) {
+ applyParameters(parameters, arg);
+ apply(body, arg);
+ return null;
+ }
+
+ @override
+ R visitLocalFunctionDeclaration(
+ FunctionExpression node,
+ LocalFunctionElement function,
+ NodeList parameters,
+ Node body,
+ A arg) {
+ applyParameters(parameters, arg);
+ apply(body, arg);
+ return null;
+ }
+
+ @override
+ R visitRedirectingFactoryConstructorDeclaration(
+ FunctionExpression node,
+ ConstructorElement constructor,
+ NodeList parameters,
+ InterfaceType redirectionType,
+ ConstructorElement redirectionTarget,
+ A arg) {
+ applyParameters(parameters, arg);
+ return null;
+ }
+
+ @override
+ R visitRedirectingGenerativeConstructorDeclaration(
+ FunctionExpression node,
+ ConstructorElement constructor,
+ NodeList parameters,
+ NodeList initializers,
+ A arg) {
+ applyParameters(parameters, arg);
+ applyInitializers(initializers, arg);
+ return null;
+ }
+
+ @override
+ R visitStaticFunctionDeclaration(
+ FunctionExpression node,
+ MethodElement function,
+ NodeList parameters,
+ Node body,
+ A arg) {
+ applyParameters(parameters, arg);
+ apply(body, arg);
+ return null;
+ }
+
+ @override
+ R visitSuperConstructorInvoke(
+ Send node,
+ ConstructorElement superConstructor,
+ InterfaceType type,
+ NodeList arguments,
+ Selector selector,
+ A arg) {
+ apply(arguments, arg);
+ return null;
+ }
+
+ @override
+ R visitThisConstructorInvoke(
+ Send node,
+ ConstructorElement thisConstructor,
+ NodeList arguments,
+ Selector selector,
+ A arg) {
+ apply(arguments, arg);
+ return null;
+ }
+
+ @override
+ R visitTopLevelFunctionDeclaration(
+ FunctionExpression node,
+ MethodElement function,
+ NodeList parameters,
+ Node body,
+ A arg) {
+ applyParameters(parameters, arg);
+ apply(body, arg);
+ return null;
+ }
+
+ @override
+ R errorUnresolvedFieldInitializer(
+ SendSet node,
+ Element element,
+ Node initializer,
+ A arg) {
+ apply(initializer, arg);
+ return null;
+ }
+
+ @override
+ R errorUnresolvedSuperConstructorInvoke(
+ Send node,
+ Element element,
+ NodeList arguments,
+ Selector selector,
+ A arg) {
+ apply(arguments, arg);
+ return null;
+ }
+
+ @override
+ R errorUnresolvedThisConstructorInvoke(
+ Send node,
+ Element element,
+ NodeList arguments,
+ Selector selector,
+ A arg) {
+ apply(arguments, arg);
+ return null;
+ }
+
+ @override
+ R visitLocalVariableDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ LocalVariableElement variable,
+ Node initializer,
+ A arg) {
+ if (initializer != null) {
+ apply(initializer, arg);
+ }
+ return null;
+ }
+
+ @override
+ R visitOptionalParameterDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ ParameterElement parameter,
+ ConstantExpression defaultValue,
+ int index,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitParameterDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ ParameterElement parameter,
+ int index,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitInitializingFormalDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ InitializingFormalElement initializingFormal,
+ int index,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitLocalConstantDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ LocalVariableElement variable,
+ ConstantExpression constant,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitNamedInitializingFormalDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ InitializingFormalElement initializingFormal,
+ ConstantExpression defaultValue,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitNamedParameterDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ ParameterElement parameter,
+ ConstantExpression defaultValue,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitOptionalInitializingFormalDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ InitializingFormalElement initializingFormal,
+ ConstantExpression defaultValue,
+ int index,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitInstanceFieldDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ FieldElement field,
+ Node initializer,
+ A arg) {
+ if (initializer != null) {
+ apply(initializer, arg);
+ }
+ return null;
+ }
+
+ @override
+ R visitStaticConstantDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ FieldElement field,
+ ConstantExpression constant,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitStaticFieldDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ FieldElement field,
+ Node initializer,
+ A arg) {
+ if (initializer != null) {
+ apply(initializer, arg);
+ }
+ return null;
+ }
+
+ @override
+ R visitTopLevelConstantDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ FieldElement field,
+ ConstantExpression constant,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitTopLevelFieldDeclaration(
+ VariableDefinitions node,
+ Node definition,
+ FieldElement field,
+ Node initializer,
+ A arg) {
+ if (initializer != null) {
+ apply(initializer, arg);
+ }
+ return null;
+ }
+
+ @override
+ R visitAbstractGetterDeclaration(
+ FunctionExpression node,
+ MethodElement getter,
+ A arg) {
+ return null;
+ }
+
+ @override
+ R visitAbstractSetterDeclaration(
+ FunctionExpression node,
+ MethodElement setter,
+ NodeList parameters,
+ A arg) {
+ applyParameters(parameters, arg);
+ return null;
+ }
+
+ @override
+ R visitInstanceGetterDeclaration(
+ FunctionExpression node,
+ MethodElement getter,
+ Node body,
+ A arg) {
+ apply(body, arg);
+ return null;
+ }
+
+ @override
+ R visitInstanceSetterDeclaration(
+ FunctionExpression node,
+ MethodElement setter,
+ NodeList parameters,
+ Node body,
+ A arg) {
+ applyParameters(parameters, arg);
+ apply(body, arg);
+ return null;
+ }
+
+ @override
+ R visitStaticGetterDeclaration(
+ FunctionExpression node,
+ MethodElement getter,
+ Node body,
+ A arg) {
+ apply(body, arg);
+ return null;
+ }
+
+ @override
+ R visitStaticSetterDeclaration(
+ FunctionExpression node,
+ MethodElement setter,
+ NodeList parameters,
+ Node body,
+ A arg) {
+ applyParameters(parameters, arg);
+ apply(body, arg);
+ return null;
+ }
+
+ @override
+ R visitTopLevelGetterDeclaration(
+ FunctionExpression node,
+ MethodElement getter,
+ Node body,
+ A arg) {
+ apply(body, arg);
+ return null;
+ }
+
+ @override
+ R visitTopLevelSetterDeclaration(
+ FunctionExpression node,
+ MethodElement setter,
+ NodeList parameters,
+ Node body,
+ A arg) {
+ applyParameters(parameters, arg);
+ apply(body, arg);
+ return null;
+ }
+}
+
+/// AST visitor that visits all normal [Send] and [SendSet] nodes using the
+/// [SemanticVisitor].
+class TraversalVisitor<R, A> extends SemanticVisitor<R, A>
+ with TraversalSendMixin<R, A>,
+ TraversalDeclarationMixin<R, A> {
+ TraversalVisitor(TreeElements elements) : super(elements);
+
+ SemanticSendVisitor<R, A> get sendVisitor => this;
+
+ SemanticDeclarationVisitor<R, A> get declVisitor => this;
+
+ R apply(Node node, A arg) {
+ node.accept(this);
+ return null;
+ }
+
+ @override
+ applyInitializers(NodeList initializers, A arg) {
+ visitInitializers(initializers, arg);
+ }
+
+ @override
+ applyParameters(NodeList parameters, A arg) {
+ visitParameters(parameters, arg);
+ }
+
+ @override
+ internalError(Spannable spannable, String message) {
+ throw new SpannableAssertionFailure(spannable, message);
+ }
+
+ @override
+ R visitNode(Node node) {
+ node.visitChildren(this);
+ return null;
+ }
+}
+
+/// Mixin that groups all non-compound `visitStaticX` and `visitTopLevelX`
+/// method by delegating calls to `handleStaticX` methods.
+///
+/// This mixin is useful for the cases where both top level members and static
+/// class members are handled uniformly.
+abstract class BaseImplementationOfStaticsMixin<R, A>
+ implements SemanticSendVisitor<R, A> {
+ R handleStaticFieldGet(
+ Send node,
+ FieldElement field,
+ A arg);
+
+ R handleStaticFieldInvoke(
+ Send node,
+ FieldElement field,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg);
+
+ R handleStaticFieldSet(
+ SendSet node,
+ FieldElement field,
+ Node rhs,
+ A arg);
+
+ R handleStaticFunctionGet(
+ Send node,
+ MethodElement function,
+ A arg);
+
+ R handleStaticFunctionInvoke(
+ Send node,
+ MethodElement function,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg);
+
+ R handleStaticFunctionIncompatibleInvoke(
+ Send node,
+ MethodElement function,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg);
+
+ R handleStaticGetterGet(
+ Send node,
+ FunctionElement getter,
+ A arg);
+
+ R handleStaticGetterInvoke(
+ Send node,
+ FunctionElement getter,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg);
+
+ R handleStaticSetterSet(
+ SendSet node,
+ FunctionElement setter,
+ Node rhs,
+ A arg);
+
+ @override
+ R visitStaticFieldGet(
+ Send node,
+ FieldElement field,
+ A arg) {
+ return handleStaticFieldGet(node, field, arg);
+ }
+
+ @override
+ R visitStaticFieldInvoke(
+ Send node,
+ FieldElement field,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
+ return handleStaticFieldInvoke(node, field, arguments, callStructure, arg);
+ }
+
+ @override
+ R visitStaticFieldSet(
+ SendSet node,
+ FieldElement field,
+ Node rhs,
+ A arg) {
+ return handleStaticFieldSet(node, field, rhs, arg);
+ }
+
+ @override
+ R visitStaticFunctionGet(
+ Send node,
+ MethodElement function,
+ A arg) {
+ return handleStaticFunctionGet(node, function, arg);
+ }
+
+ @override
+ R visitStaticFunctionInvoke(
+ Send node,
+ MethodElement function,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
+ return handleStaticFunctionInvoke(
+ node, function, arguments, callStructure, arg);
+ }
+
+ @override
+ R visitStaticFunctionIncompatibleInvoke(
+ Send node,
+ MethodElement function,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
+ return handleStaticFunctionIncompatibleInvoke(
+ node, function, arguments, callStructure, arg);
+ }
+
+ @override
+ R visitStaticGetterGet(
+ Send node,
+ FunctionElement getter,
+ A arg) {
+ return handleStaticGetterGet(node, getter, arg);
+ }
+
+ @override
+ R visitStaticGetterInvoke(
+ Send node,
+ FunctionElement getter,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
+ return handleStaticGetterInvoke(
+ node, getter, arguments, callStructure, arg);
+ }
+
+ @override
+ R visitStaticSetterSet(
+ SendSet node,
+ FunctionElement setter,
+ Node rhs,
+ A arg) {
+ return handleStaticSetterSet(node, setter, rhs, arg);
+ }
+
+ @override
+ R visitTopLevelFieldGet(
+ Send node,
+ FieldElement field,
+ A arg) {
+ return handleStaticFieldGet(node, field, arg);
+ }
+
+ @override
+ R visitTopLevelFieldInvoke(
+ Send node,
+ FieldElement field,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
+ return handleStaticFieldInvoke(node, field, arguments, callStructure, arg);
+ }
+
+ @override
+ R visitTopLevelFieldSet(
+ SendSet node,
+ FieldElement field,
+ Node rhs,
+ A arg) {
+ return handleStaticFieldSet(node, field, rhs, arg);
+ }
+
+ @override
+ R visitTopLevelFunctionGet(
+ Send node,
+ MethodElement function,
+ A arg) {
+ return handleStaticFunctionGet(node, function, arg);
+ }
+
+ @override
+ R visitTopLevelFunctionInvoke(
+ Send node,
+ MethodElement function,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
+ return handleStaticFunctionInvoke(
+ node, function, arguments, callStructure, arg);
+ }
+
+ @override
+ R visitTopLevelFunctionIncompatibleInvoke(
+ Send node,
+ MethodElement function,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
+ return handleStaticFunctionIncompatibleInvoke(
+ node, function, arguments, callStructure, arg);
+ }
+
+ @override
+ R visitTopLevelGetterGet(
+ Send node,
+ FunctionElement getter,
+ A arg) {
+ return handleStaticGetterGet(node, getter, arg);
+ }
+
+ @override
+ R visitTopLevelGetterInvoke(
+ Send node,
+ FunctionElement getter,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
+ return handleStaticGetterInvoke(
+ node, getter, arguments, callStructure, arg);
+ }
+
+ @override
+ R visitTopLevelSetterSet(
+ SendSet node,
+ FunctionElement setter,
+ Node rhs,
+ A arg) {
+ return handleStaticSetterSet(node, setter, rhs, arg);
+ }
+}
+
+/// Mixin that groups all compounds visitors `visitStaticX` and `visitTopLevelX`
+/// method by delegating calls to `handleStaticX` methods.
+///
+/// This mixin is useful for the cases where both top level members and static
+/// class members are handled uniformly.
+abstract class BaseImplementationOfStaticCompoundsMixin<R, A>
+ implements SemanticSendVisitor<R, A> {
+ R handleStaticFieldCompound(
+ Send node,
+ FieldElement field,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg);
+
+ R handleStaticFieldPostfixPrefix(
+ Send node,
+ FieldElement field,
+ IncDecOperator operator,
+ A arg,
+ {bool isPrefix});
+
+ R handleStaticGetterSetterCompound(
+ Send node,
+ FunctionElement getter,
+ FunctionElement setter,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg);
+
+ R handleStaticGetterSetterPostfixPrefix(
+ Send node,
+ FunctionElement getter,
+ FunctionElement setter,
+ IncDecOperator operator,
+ A arg,
+ {bool isPrefix});
+
+ R handleStaticMethodSetterCompound(
+ Send node,
+ FunctionElement method,
+ FunctionElement setter,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg);
+
+ R handleStaticMethodSetterPostfixPrefix(
+ Send node,
+ FunctionElement getter,
+ FunctionElement setter,
+ IncDecOperator operator,
+ A arg,
+ {bool isPrefix});
+
+ R handleFinalStaticFieldCompound(
+ Send node,
+ FieldElement field,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg);
+
+ R handleFinalStaticFieldPostfixPrefix(
+ Send node,
+ FieldElement field,
+ IncDecOperator operator,
+ A arg,
+ {bool isPrefix});
+
+ R handleStaticMethodCompound(
+ Send node,
+ FunctionElement method,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg);
+
+ R handleStaticMethodPostfixPrefix(
+ Send node,
+ FunctionElement method,
+ IncDecOperator operator,
+ A arg,
+ {bool isPrefix});
+
+ R handleUnresolvedStaticGetterCompound(
+ Send node,
+ Element element,
+ FunctionElement setter,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg);
+
+ R handleUnresolvedStaticGetterPostfixPrefix(
+ Send node,
+ Element element,
+ FunctionElement setter,
+ IncDecOperator operator,
+ A arg,
+ {bool isPrefix});
+
+ R handleUnresolvedStaticSetterCompound(
+ Send node,
+ FunctionElement getter,
+ Element element,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg);
+
+ R handleUnresolvedStaticSetterPostfixPrefix(
+ Send node,
+ FunctionElement getter,
+ Element element,
+ IncDecOperator operator,
+ A arg,
+ {bool isPrefix});
+
+ @override
+ R visitStaticFieldCompound(
+ Send node,
+ FieldElement field,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ return handleStaticFieldCompound(node, field, operator, rhs, arg);
+ }
+
+ @override
+ R visitStaticFieldPostfix(
+ Send node,
+ FieldElement field,
+ IncDecOperator operator,
+ A arg) {
+ return handleStaticFieldPostfixPrefix(
+ node, field, operator, arg, isPrefix: false);
+ }
+
+ @override
+ R visitStaticFieldPrefix(
+ Send node,
+ FieldElement field,
+ IncDecOperator operator,
+ A arg) {
+ return handleStaticFieldPostfixPrefix(
+ node, field, operator, arg, isPrefix: true);
+ }
+
+ @override
+ R visitStaticGetterSetterCompound(
+ Send node,
+ FunctionElement getter,
+ FunctionElement setter,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ return handleStaticGetterSetterCompound(
+ node, getter, setter, operator, rhs, arg);
+ }
+
+ @override
+ R visitStaticGetterSetterPostfix(
+ Send node,
+ FunctionElement getter,
+ FunctionElement setter,
+ IncDecOperator operator,
+ A arg) {
+ return handleStaticGetterSetterPostfixPrefix(
+ node, getter, setter, operator, arg, isPrefix: false);
+ }
+
+ @override
+ R visitStaticGetterSetterPrefix(
+ Send node,
+ FunctionElement getter,
+ FunctionElement setter,
+ IncDecOperator operator,
+ A arg) {
+ return handleStaticGetterSetterPostfixPrefix(
+ node, getter, setter, operator, arg, isPrefix: true);
+ }
+
+ @override
+ R visitStaticMethodSetterCompound(
+ Send node,
+ FunctionElement method,
+ FunctionElement setter,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ return handleStaticMethodSetterCompound(
+ node, method, setter, operator, rhs, arg);
+ }
+
+ @override
+ R visitStaticMethodSetterPostfix(
+ Send node,
+ FunctionElement getter,
+ FunctionElement setter,
+ IncDecOperator operator,
+ A arg) {
+ return handleStaticMethodSetterPostfixPrefix(
+ node, getter, setter, operator, arg, isPrefix: false);
+ }
+
+ @override
+ R visitStaticMethodSetterPrefix(
+ Send node,
+ FunctionElement getter,
+ FunctionElement setter,
+ IncDecOperator operator,
+ A arg) {
+ return handleStaticMethodSetterPostfixPrefix(
+ node, getter, setter, operator, arg, isPrefix: true);
+ }
+
+ @override
+ R visitTopLevelFieldCompound(
+ Send node,
+ FieldElement field,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ return handleStaticFieldCompound(node, field, operator, rhs, arg);
+ }
+
+ @override
+ R visitTopLevelFieldPostfix(
+ Send node,
+ FieldElement field,
+ IncDecOperator operator,
+ A arg) {
+ return handleStaticFieldPostfixPrefix(
+ node, field, operator, arg, isPrefix: false);
+ }
+
+ @override
+ R visitTopLevelFieldPrefix(
+ Send node,
+ FieldElement field,
+ IncDecOperator operator,
+ A arg) {
+ return handleStaticFieldPostfixPrefix(
+ node, field, operator, arg, isPrefix: true);
+ }
+
+ @override
+ R visitTopLevelGetterSetterCompound(
+ Send node,
+ FunctionElement getter,
+ FunctionElement setter,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ return handleStaticGetterSetterCompound(
+ node, getter, setter, operator, rhs, arg);
+ }
+
+ @override
+ R visitTopLevelGetterSetterPostfix(
+ Send node,
+ FunctionElement getter,
+ FunctionElement setter,
+ IncDecOperator operator,
+ A arg) {
+ return handleStaticGetterSetterPostfixPrefix(
+ node, getter, setter, operator, arg, isPrefix: false);
+ }
+
+ @override
+ R visitTopLevelGetterSetterPrefix(
+ Send node,
+ FunctionElement getter,
+ FunctionElement setter,
+ IncDecOperator operator,
+ A arg) {
+ return handleStaticGetterSetterPostfixPrefix(
+ node, getter, setter, operator, arg, isPrefix: true);
+ }
+
+ @override
+ R visitTopLevelMethodSetterCompound(
+ Send node,
+ FunctionElement method,
+ FunctionElement setter,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ return handleStaticMethodSetterCompound(
+ node, method, setter, operator, rhs, arg);
+ }
+
+ @override
+ R visitTopLevelMethodSetterPostfix(
+ Send node,
+ FunctionElement method,
+ FunctionElement setter,
+ IncDecOperator operator,
+ A arg) {
+ return handleStaticMethodSetterPostfixPrefix(
+ node, method, setter, operator, arg, isPrefix: false);
+ }
+
+ @override
+ R visitTopLevelMethodSetterPrefix(
+ Send node,
+ FunctionElement method,
+ FunctionElement setter,
+ IncDecOperator operator,
+ A arg) {
+ return handleStaticMethodSetterPostfixPrefix(
+ node, method, setter, operator, arg, isPrefix: true);
+ }
+
+ @override
+ R visitFinalStaticFieldCompound(
+ Send node,
+ FieldElement field,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ return handleFinalStaticFieldCompound(
+ node, field, operator, rhs, arg);
+ }
+
+ @override
+ R visitFinalStaticFieldPostfix(
+ Send node,
+ FieldElement field,
+ IncDecOperator operator,
+ A arg) {
+ return handleFinalStaticFieldPostfixPrefix(
+ node, field, operator, arg, isPrefix: false);
+ }
+
+ @override
+ R visitFinalStaticFieldPrefix(
+ Send node,
+ FieldElement field,
+ IncDecOperator operator,
+ A arg) {
+ return handleFinalStaticFieldPostfixPrefix(
+ node, field, operator, arg, isPrefix: true);
+ }
+
+ @override
+ R visitStaticMethodCompound(
+ Send node,
+ FunctionElement method,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ return handleStaticMethodCompound(
+ node, method, operator, rhs, arg);
+ }
+
+ @override
+ R visitStaticMethodPostfix(
+ Send node,
+ FunctionElement method,
+ IncDecOperator operator,
+ A arg) {
+ return handleStaticMethodPostfixPrefix(
+ node, method, operator, arg, isPrefix: false);
+ }
+
+ @override
+ R visitStaticMethodPrefix(
+ Send node,
+ FunctionElement method,
+ IncDecOperator operator,
+ A arg) {
+ return handleStaticMethodPostfixPrefix(
+ node, method, operator, arg, isPrefix: true);
+ }
+
+ @override
+ R visitUnresolvedStaticGetterCompound(
+ Send node,
+ Element element,
+ FunctionElement setter,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ return handleUnresolvedStaticGetterCompound(
+ node, element, setter, operator, rhs, arg);
+ }
+
+ @override
+ R visitUnresolvedStaticGetterPostfix(
+ Send node,
+ Element element,
+ FunctionElement setter,
+ IncDecOperator operator,
+ A arg) {
+ return handleUnresolvedStaticGetterPostfixPrefix(
+ node, element, setter, operator, arg, isPrefix: false);
+ }
+
+ @override
+ R visitUnresolvedStaticGetterPrefix(
+ Send node,
+ Element element,
+ FunctionElement setter,
+ IncDecOperator operator,
+ A arg) {
+ return handleUnresolvedStaticGetterPostfixPrefix(
+ node, element, setter, operator, arg, isPrefix: true);
+ }
+
+ @override
+ R visitUnresolvedStaticSetterCompound(
+ Send node,
+ FunctionElement getter,
+ Element element,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ return handleUnresolvedStaticSetterCompound(
+ node, getter, element, operator, rhs, arg);
+ }
+
+ @override
+ R visitUnresolvedStaticSetterPostfix(
+ Send node,
+ FunctionElement getter,
+ Element element,
+ IncDecOperator operator,
+ A arg) {
+ return handleUnresolvedStaticSetterPostfixPrefix(
+ node, getter, element, operator, arg, isPrefix: false);
+ }
+
+ @override
+ R visitUnresolvedStaticSetterPrefix(
+ Send node,
+ FunctionElement getter,
+ Element element,
+ IncDecOperator operator,
+ A arg) {
+ return handleUnresolvedStaticSetterPostfixPrefix(
+ node, getter, element, operator, arg, isPrefix: true);
+ }
+}
+
+/// Mixin that groups all non-compound `visitLocalX` and `visitParameterX`
+/// methods by delegating calls to `handleLocalX` methods.
+///
+/// This mixin is useful for the cases where both parameters, local variables,
+/// and local functions, captured or not, are handled uniformly.
+abstract class BaseImplementationOfLocalsMixin<R, A>
+ implements SemanticSendVisitor<R, A> {
+ R handleLocalGet(
+ Send node,
+ LocalElement element,
+ A arg);
+
+ R handleLocalInvoke(
+ Send node,
+ LocalElement element,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg);
+
+ R handleLocalSet(
+ SendSet node,
+ LocalElement element,
+ Node rhs,
+ A arg);
+
+ @override
+ R visitLocalFunctionGet(
+ Send node,
+ LocalFunctionElement function,
+ A arg) {
+ return handleLocalGet(node, function, arg);
+ }
+
+ @override
+ R visitLocalFunctionInvoke(
+ Send node,
+ LocalFunctionElement function,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
+ return handleLocalInvoke(node, function, arguments, callStructure, arg);
+ }
+
+ @override
+ R visitLocalVariableGet(
+ Send node,
+ LocalVariableElement variable,
+ A arg) {
+ return handleLocalGet(node, variable, arg);
+ }
+
+ @override
+ R visitLocalVariableInvoke(
+ Send node,
+ LocalVariableElement variable,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
+ return handleLocalInvoke(node, variable, arguments, callStructure, arg);
+ }
+
+ @override
+ R visitLocalVariableSet(
+ SendSet node,
+ LocalVariableElement variable,
+ Node rhs,
+ A arg) {
+ return handleLocalSet(node, variable, rhs, arg);
+ }
+
+ @override
+ R visitParameterGet(
+ Send node,
+ ParameterElement parameter,
+ A arg) {
+ return handleLocalGet(node, parameter, arg);
+ }
+
+ @override
+ R visitParameterInvoke(
+ Send node,
+ ParameterElement parameter,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
+ return handleLocalInvoke(node, parameter, arguments, callStructure, arg);
+ }
+
+ @override
+ R visitParameterSet(
+ SendSet node,
+ ParameterElement parameter,
+ Node rhs,
+ A arg) {
+ return handleLocalSet(node, parameter, rhs, arg);
+ }
+}
+
+/// Mixin that groups all compound `visitLocalX` and `visitParameterX` methods
+/// by delegating calls to `handleLocalX` methods.
+///
+/// This mixin is useful for the cases where both parameters, local variables,
+/// and local functions, captured or not, are handled uniformly.
+abstract class BaseImplementationOfLocalCompoundsMixin<R, A>
+ implements SemanticSendVisitor<R, A> {
+ R handleLocalCompound(
+ Send node,
+ LocalElement element,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg);
+
+ R handleLocalPostfixPrefix(
+ Send node,
+ LocalElement element,
+ IncDecOperator operator,
+ A arg,
+ {bool isPrefix});
+
+ @override
+ R visitLocalVariableCompound(
+ Send node,
+ LocalVariableElement variable,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ return handleLocalCompound(node, variable, operator, rhs, arg);
+ }
+
+ @override
+ R visitLocalVariablePostfix(
+ Send node,
+ LocalVariableElement variable,
+ IncDecOperator operator,
+ A arg) {
+ return handleLocalPostfixPrefix(
+ node, variable, operator, arg, isPrefix: false);
+ }
+
+ @override
+ R visitLocalVariablePrefix(
+ Send node,
+ LocalVariableElement variable,
+ IncDecOperator operator,
+ A arg) {
+ return handleLocalPostfixPrefix(
+ node, variable, operator, arg, isPrefix: true);
+ }
+
+ @override
+ R visitParameterCompound(
+ Send node,
+ ParameterElement parameter,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ return handleLocalCompound(node, parameter, operator, rhs, arg);
+ }
+
+ @override
+ R visitParameterPostfix(
+ Send node,
+ ParameterElement parameter,
+ IncDecOperator operator,
+ A arg) {
+ return handleLocalPostfixPrefix(
+ node, parameter, operator, arg, isPrefix: false);
+ }
+
+ @override
+ R visitParameterPrefix(
+ Send node,
+ ParameterElement parameter,
+ IncDecOperator operator,
+ A arg) {
+ return handleLocalPostfixPrefix(
+ node, parameter, operator, arg, isPrefix: true);
+ }
+}
+
+/// Mixin that groups all `visitConstantX` and `visitXTypeLiteralY` methods for
+/// constant type literals by delegating calls to `handleConstantX` methods.
+///
+/// This mixin is useful for the cases where expressions on constants are
+/// handled uniformly.
+abstract class BaseImplementationOfConstantsMixin<R, A>
+ implements SemanticSendVisitor<R, A> {
+ R handleConstantGet(
+ Node node,
+ ConstantExpression constant,
+ A arg);
+
+ R handleConstantInvoke(
+ Send node,
+ ConstantExpression constant,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg);
+
+ @override
+ R visitClassTypeLiteralGet(
+ Send node,
+ ConstantExpression constant,
+ A arg) {
+ return handleConstantGet(node, constant, arg);
+ }
+
+ @override
+ R visitClassTypeLiteralInvoke(
+ Send node,
+ ConstantExpression constant,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
+ return handleConstantInvoke(node, constant, arguments, callStructure, arg);
+ }
+
+ @override
+ R visitConstConstructorInvoke(
+ NewExpression node,
+ ConstructedConstantExpression constant,
+ A arg) {
+ return handleConstantGet(node, constant, arg);
+ }
+
+ @override
+ R visitConstantGet(
+ Send node,
+ ConstantExpression constant,
+ A arg) {
+ return handleConstantGet(node, constant, arg);
+ }
+
+ @override
+ R visitConstantInvoke(
+ Send node,
+ ConstantExpression constant,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
+ return handleConstantInvoke(node, constant, arguments, callStructure, arg);
+ }
+
+ @override
+ R visitDynamicTypeLiteralGet(
+ Send node,
+ ConstantExpression constant,
+ A arg) {
+ return handleConstantGet(node, constant, arg);
+ }
+
+ @override
+ R visitDynamicTypeLiteralInvoke(
+ Send node,
+ ConstantExpression constant,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
+ return handleConstantInvoke(node, constant, arguments, callStructure, arg);
+ }
+
+ @override
+ R visitTypedefTypeLiteralGet(
+ Send node,
+ ConstantExpression constant,
+ A arg) {
+ return handleConstantGet(node, constant, arg);
+ }
+
+ @override
+ R visitTypedefTypeLiteralInvoke(
+ Send node,
+ ConstantExpression constant,
+ NodeList arguments,
+ CallStructure callStructure,
+ A arg) {
+ return handleConstantInvoke(node, constant, arguments, callStructure, arg);
+ }
+}
+
+/// Mixin that groups all non-compound `visitDynamicPropertyX` and
+/// `visitThisPropertyY` methods for by delegating calls to `handleDynamicX`
+/// methods, providing `null` as the receiver for the this properties.
+///
+/// This mixin is useful for the cases where dynamic and this properties are
+/// handled uniformly.
+abstract class BaseImplementationOfDynamicsMixin<R, A>
+ implements SemanticSendVisitor<R, A> {
+ R handleDynamicGet(
+ Send node,
+ Node receiver,
+ Selector selector,
+ A arg);
+
+ R handleDynamicInvoke(
+ Send node,
+ Node receiver,
+ NodeList arguments,
+ Selector selector,
+ A arg);
+
+ R handleDynamicSet(
+ SendSet node,
+ Node receiver,
+ Selector selector,
+ Node rhs,
+ A arg);
+
+ @override
+ R visitDynamicPropertyGet(
+ Send node,
+ Node receiver,
+ Selector selector,
+ A arg) {
+ return handleDynamicGet(node, receiver, selector, arg);
+ }
+
+ @override
+ R visitDynamicPropertyInvoke(
+ Send node,
+ Node receiver,
+ NodeList arguments,
+ Selector selector,
+ A arg) {
+ return handleDynamicInvoke(node, receiver, arguments, selector, arg);
+ }
+
+ @override
+ R visitDynamicPropertySet(
+ SendSet node,
+ Node receiver,
+ Selector selector,
+ Node rhs,
+ A arg) {
+ return handleDynamicSet(node, receiver, selector, rhs, arg);
+ }
+
+ @override
+ R visitThisPropertyGet(
+ Send node,
+ Selector selector,
+ A arg) {
+ return handleDynamicGet(node, null, selector, arg);
+ }
+
+ @override
+ R visitThisPropertyInvoke(
+ Send node,
+ NodeList arguments,
+ Selector selector,
+ A arg) {
+ return handleDynamicInvoke(node, null, arguments, selector, arg);
+ }
+
+ @override
+ R visitThisPropertySet(
+ SendSet node,
+ Selector selector,
+ Node rhs,
+ A arg) {
+ return handleDynamicSet(node, null, selector, rhs, arg);
+ }
+}
+
+/// Mixin that groups all compounds of `visitDynamicPropertyX` and
+/// `visitThisPropertyY` methods for by delegating calls to `handleDynamicX`
+/// methods, providing `null` as the receiver for the this properties.
+///
+/// This mixin is useful for the cases where dynamic and this properties are
+/// handled uniformly.
+abstract class BaseImplementationOfDynamicCompoundsMixin<R, A>
+ implements SemanticSendVisitor<R, A> {
+ R handleDynamicCompound(
+ Send node,
+ Node receiver,
+ AssignmentOperator operator,
+ Node rhs,
+ Selector getterSelector,
+ Selector setterSelector,
+ A arg);
+
+ R handleDynamicPostfixPrefix(
+ Send node,
+ Node receiver,
+ IncDecOperator operator,
+ Selector getterSelector,
+ Selector setterSelector,
+ A arg,
+ {bool isPrefix});
+
+ R handleDynamicIndexPostfixPrefix(
+ Send node,
+ Node receiver,
+ Node index,
+ IncDecOperator operator,
+ A arg,
+ {bool isPrefix});
+
+ @override
+ R visitDynamicPropertyCompound(
+ Send node,
+ Node receiver,
+ AssignmentOperator operator,
+ Node rhs,
+ Selector getterSelector,
+ Selector setterSelector,
+ A arg) {
+ return handleDynamicCompound(
+ node, receiver, operator, rhs, getterSelector, setterSelector, arg);
+ }
+
+ @override
+ R visitDynamicPropertyPostfix(
+ Send node,
+ Node receiver,
+ IncDecOperator operator,
+ Selector getterSelector,
+ Selector setterSelector,
+ A arg) {
+ return handleDynamicPostfixPrefix(
+ node, receiver, operator,
+ getterSelector, setterSelector, arg, isPrefix: false);
+ }
+
+ @override
+ R visitDynamicPropertyPrefix(
+ Send node,
+ Node receiver,
+ IncDecOperator operator,
+ Selector getterSelector,
+ Selector setterSelector,
+ A arg) {
+ return handleDynamicPostfixPrefix(
+ node, receiver, operator,
+ getterSelector, setterSelector, arg, isPrefix: true);
+ }
+
+ @override
+ R visitThisPropertyCompound(
+ Send node,
+ AssignmentOperator operator,
+ Node rhs,
+ Selector getterSelector,
+ Selector setterSelector,
+ A arg) {
+ return handleDynamicCompound(
+ node, null, operator, rhs, getterSelector, setterSelector, arg);
+ }
+
+ @override
+ R visitThisPropertyPostfix(
+ Send node,
+ IncDecOperator operator,
+ Selector getterSelector,
+ Selector setterSelector,
+ A arg) {
+ return handleDynamicPostfixPrefix(
+ node, null, operator,
+ getterSelector, setterSelector, arg, isPrefix: false);
+ }
+
+ @override
+ R visitThisPropertyPrefix(
+ Send node,
+ IncDecOperator operator,
+ Selector getterSelector,
+ Selector setterSelector,
+ A arg) {
+ return handleDynamicPostfixPrefix(
+ node, null, operator,
+ getterSelector, setterSelector, arg, isPrefix: true);
+ }
+
+ @override
+ R visitIndexPostfix(
+ Send node,
+ Node receiver,
+ Node index,
+ IncDecOperator operator,
+ A arg) {
+ return handleDynamicIndexPostfixPrefix(
+ node, receiver, index, operator, arg, isPrefix: false);
+ }
+
+ @override
+ R visitIndexPrefix(
+ Send node,
+ Node receiver,
+ Node index,
+ IncDecOperator operator,
+ A arg) {
+ return handleDynamicIndexPostfixPrefix(
+ node, receiver, index, operator, arg, isPrefix: true);
+ }
+}
+
+/// The getter kind for statically resolved compound expressions.
+enum CompoundGetter {
+ /// The compound reads from a field.
+ FIELD,
+
+ /// The compound reads from a getter.
+ GETTER,
+
+ /// The compound reads (closurizes) a method.
+ METHOD,
+
+ /// The getter is unresolved. The accompanied element is an erroneous element.
+ UNRESOLVED,
+}
+
+/// The setter kind for statically resolved compound expressions.
+enum CompoundSetter {
+ /// The compound writes to a field.
+ FIELD,
+
+ /// The compound writes to a setter.
+ SETTER,
+
+ /// The setter is unresolved or unassignable. The accompanied element may be
+ /// `null`, and erroneous element, or the unassignable element.
+ INVALID,
+}
+
+/// The kind of a [CompoundRhs].
+enum CompoundKind {
+ /// A prefix expression, like `--a`.
+ PREFIX,
+
+ /// A postfix expression, like `a++`.
+ POSTFIX,
+
+ /// A compound assignment, like `a *= b`.
+ ASSIGNMENT,
+}
+
+/// The right-hand side of a compound expression.
+abstract class CompoundRhs {
+ /// The kind of compound.
+ CompoundKind get kind;
+
+ /// The binary operator implied by the compound operator.
+ BinaryOperator get operator;
+
+ /// The explicit right hand side in case of a compound assignment, `null`
+ /// otherwise.
+ Node get rhs;
+}
+
+/// A prefix or postfix of [incDecOperator].
+class IncDecCompound implements CompoundRhs {
+ final CompoundKind kind;
+ final IncDecOperator incDecOperator;
+
+ IncDecCompound(this.kind, this.incDecOperator);
+
+ BinaryOperator get operator => incDecOperator.binaryOperator;
+
+ Node get rhs => null;
+}
+
+/// A compound assignment with [assignmentOperator] and [rhs].
+class AssignmentCompound implements CompoundRhs {
+ final AssignmentOperator assignmentOperator;
+ final Node rhs;
+
+ AssignmentCompound(this.assignmentOperator, this.rhs);
+
+ CompoundKind get kind => CompoundKind.ASSIGNMENT;
+
+ BinaryOperator get operator => assignmentOperator.binaryOperator;
+}
+
+/// Simplified handling of compound assignments and prefix/postfix expressions.
+abstract class BaseImplementationOfCompoundsMixin<R, A>
+ implements SemanticSendVisitor<R, A> {
+
+ /// Handle a super compounds, like `super.foo += 42` or `--super.bar`.
+ R handleSuperCompounds(
+ SendSet node,
+ Element getter,
+ CompoundGetter getterKind,
+ Element setter,
+ CompoundSetter setterKind,
+ CompoundRhs rhs,
+ A arg);
+
+ /// Handle a static or top level compounds, like `foo += 42` or `--bar`.
+ R handleStaticCompounds(
+ SendSet node,
+ Element getter,
+ CompoundGetter getterKind,
+ Element setter,
+ CompoundSetter setterKind,
+ CompoundRhs rhs,
+ A arg);
+
+ /// Handle a local compounds, like `foo += 42` or `--bar`. If [isSetterValid]
+ /// is false [local] is unassignable.
+ R handleLocalCompounds(
+ SendSet node,
+ LocalElement local,
+ CompoundRhs rhs,
+ A arg,
+ {bool isSetterValid});
+
+ /// Handle a compounds on a type literal constant, like `Object += 42` or
+ /// `--Object`.
+ R handleTypeLiteralConstantCompounds(
+ SendSet node,
+ ConstantExpression constant,
+ CompoundRhs rhs,
+ A arg);
+
+ /// Handle a compounds on a type variable type literal, like `T += 42` or
+ /// `--T`.
+ R handleTypeVariableTypeLiteralCompounds(
+ SendSet node,
+ TypeVariableElement typeVariable,
+ CompoundRhs rhs,
+ A arg);
+
+ /// Handle a dynamic compounds, like `o.foo += 42` or `--o.foo`. [receiver] is
+ /// `null` for properties on `this`, like `--this.foo` or `--foo`.
+ R handleDynamicCompounds(
+ Send node,
+ Node receiver,
+ CompoundRhs rhs,
+ Selector getterSelector,
+ Selector setterSelector,
+ A arg);
+
+ R visitDynamicPropertyCompound(
+ Send node,
+ Node receiver,
+ AssignmentOperator operator,
+ Node rhs,
+ Selector getterSelector,
+ Selector setterSelector,
+ A arg) {
+ return handleDynamicCompounds(
+ node,
+ receiver,
+ new AssignmentCompound(operator, rhs),
+ getterSelector,
+ setterSelector,
+ arg);
+ }
+
+ @override
+ R visitThisPropertyCompound(
+ Send node,
+ AssignmentOperator operator,
+ Node rhs,
+ Selector getterSelector,
+ Selector setterSelector,
A arg) {
- return null;
+ return handleDynamicCompounds(
+ node,
+ null,
+ new AssignmentCompound(operator, rhs),
+ getterSelector,
+ setterSelector,
+ arg);
}
@override
- R visitParameterDeclaration(
- VariableDefinitions node,
- Node definition,
+ R visitParameterCompound(
+ Send node,
ParameterElement parameter,
- int index,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return null;
+ return handleLocalCompounds(
+ node,
+ parameter,
+ new AssignmentCompound(operator, rhs),
+ arg,
+ isSetterValid: true);
}
@override
- R visitInitializingFormalDeclaration(
- VariableDefinitions node,
- Node definition,
- InitializingFormalElement initializingFormal,
- int index,
+ R visitFinalParameterCompound(
+ Send node,
+ ParameterElement parameter,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return null;
+ return handleLocalCompounds(
+ node,
+ parameter,
+ new AssignmentCompound(operator, rhs),
+ arg,
+ isSetterValid: false);
}
@override
- R visitLocalConstantDeclaration(
- VariableDefinitions node,
- Node definition,
+ R visitLocalVariableCompound(
+ Send node,
LocalVariableElement variable,
- ConstantExpression constant,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return null;
+ return handleLocalCompounds(
+ node,
+ variable,
+ new AssignmentCompound(operator, rhs),
+ arg,
+ isSetterValid: true);
}
@override
- R visitNamedInitializingFormalDeclaration(
- VariableDefinitions node,
- Node definition,
- InitializingFormalElement initializingFormal,
- ConstantExpression defaultValue,
+ R visitFinalLocalVariableCompound(
+ Send node,
+ LocalVariableElement variable,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return null;
+ return handleLocalCompounds(
+ node,
+ variable,
+ new AssignmentCompound(operator, rhs),
+ arg,
+ isSetterValid: false);
}
@override
- R visitNamedParameterDeclaration(
- VariableDefinitions node,
- Node definition,
- ParameterElement parameter,
- ConstantExpression defaultValue,
+ R visitLocalFunctionCompound(
+ Send node,
+ LocalFunctionElement function,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return null;
+ return handleLocalCompounds(
+ node,
+ function,
+ new AssignmentCompound(operator, rhs),
+ arg,
+ isSetterValid: false);
}
@override
- R visitOptionalInitializingFormalDeclaration(
- VariableDefinitions node,
- Node definition,
- InitializingFormalElement initializingFormal,
- ConstantExpression defaultValue,
- int index,
+ R visitStaticFieldCompound(
+ Send node,
+ FieldElement field,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return null;
+ return handleStaticCompounds(
+ node,
+ field, CompoundGetter.FIELD,
+ field, CompoundSetter.FIELD,
+ new AssignmentCompound(operator, rhs),
+ arg);
}
@override
- R visitInstanceFieldDeclaration(
- VariableDefinitions node,
- Node definition,
+ R visitFinalStaticFieldCompound(
+ Send node,
FieldElement field,
- Node initializer,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- if (initializer != null) {
- apply(initializer, arg);
- }
- return null;
+ return handleStaticCompounds(
+ node,
+ field, CompoundGetter.FIELD,
+ null, CompoundSetter.INVALID,
+ new AssignmentCompound(operator, rhs),
+ arg);
}
@override
- R visitStaticConstantDeclaration(
- VariableDefinitions node,
- Node definition,
- FieldElement field,
- ConstantExpression constant,
+ R visitStaticGetterSetterCompound(
+ Send node,
+ FunctionElement getter,
+ FunctionElement setter,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return null;
+ return handleStaticCompounds(
+ node,
+ getter, CompoundGetter.GETTER,
+ setter, CompoundSetter.SETTER,
+ new AssignmentCompound(operator, rhs),
+ arg);
}
@override
- R visitStaticFieldDeclaration(
- VariableDefinitions node,
- Node definition,
- FieldElement field,
- Node initializer,
+ R visitStaticMethodSetterCompound(
+ Send node,
+ FunctionElement method,
+ FunctionElement setter,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- if (initializer != null) {
- apply(initializer, arg);
- }
- return null;
+ return handleStaticCompounds(
+ node,
+ method, CompoundGetter.METHOD,
+ setter, CompoundSetter.SETTER,
+ new AssignmentCompound(operator, rhs),
+ arg);
}
@override
- R visitTopLevelConstantDeclaration(
- VariableDefinitions node,
- Node definition,
+ R visitTopLevelFieldCompound(
+ Send node,
FieldElement field,
- ConstantExpression constant,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return null;
+ return handleStaticCompounds(
+ node,
+ field, CompoundGetter.FIELD,
+ field, CompoundSetter.FIELD,
+ new AssignmentCompound(operator, rhs),
+ arg);
}
@override
- R visitTopLevelFieldDeclaration(
- VariableDefinitions node,
- Node definition,
+ R visitFinalTopLevelFieldCompound(
+ Send node,
FieldElement field,
- Node initializer,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- if (initializer != null) {
- apply(initializer, arg);
- }
- return null;
+ return handleStaticCompounds(
+ node,
+ field, CompoundGetter.FIELD,
+ null, CompoundSetter.INVALID,
+ new AssignmentCompound(operator, rhs),
+ arg);
}
@override
- R visitAbstractGetterDeclaration(
- FunctionExpression node,
- MethodElement getter,
+ R visitTopLevelGetterSetterCompound(
+ Send node,
+ FunctionElement getter,
+ FunctionElement setter,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return null;
+ return handleStaticCompounds(
+ node,
+ getter, CompoundGetter.GETTER,
+ setter, CompoundSetter.SETTER,
+ new AssignmentCompound(operator, rhs),
+ arg);
}
@override
- R visitAbstractSetterDeclaration(
- FunctionExpression node,
- MethodElement setter,
- NodeList parameters,
+ R visitTopLevelMethodSetterCompound(
+ Send node,
+ FunctionElement method,
+ FunctionElement setter,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- applyParameters(parameters, arg);
- return null;
+ return handleStaticCompounds(
+ node,
+ method, CompoundGetter.METHOD,
+ setter, CompoundSetter.SETTER,
+ new AssignmentCompound(operator, rhs),
+ arg);
}
@override
- R visitInstanceGetterDeclaration(
- FunctionExpression node,
- MethodElement getter,
- Node body,
+ R visitSuperFieldCompound(
+ Send node,
+ FieldElement field,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- apply(body, arg);
- return null;
+ return handleSuperCompounds(
+ node,
+ field, CompoundGetter.FIELD,
+ field, CompoundSetter.FIELD,
+ new AssignmentCompound(operator, rhs),
+ arg);
}
@override
- R visitInstanceSetterDeclaration(
- FunctionExpression node,
- MethodElement setter,
- NodeList parameters,
- Node body,
+ R visitFinalSuperFieldCompound(
+ Send node,
+ FieldElement field,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- applyParameters(parameters, arg);
- apply(body, arg);
- return null;
+ return handleSuperCompounds(
+ node,
+ field, CompoundGetter.FIELD,
+ field, CompoundSetter.INVALID,
+ new AssignmentCompound(operator, rhs),
+ arg);
}
@override
- R visitStaticGetterDeclaration(
- FunctionExpression node,
- MethodElement getter,
- Node body,
+ R visitSuperGetterSetterCompound(
+ Send node,
+ FunctionElement getter,
+ FunctionElement setter,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- apply(body, arg);
- return null;
+ return handleSuperCompounds(
+ node,
+ getter, CompoundGetter.GETTER,
+ setter, CompoundSetter.SETTER,
+ new AssignmentCompound(operator, rhs),
+ arg);
}
@override
- R visitStaticSetterDeclaration(
- FunctionExpression node,
- MethodElement setter,
- NodeList parameters,
- Node body,
+ R visitSuperMethodSetterCompound(
+ Send node,
+ FunctionElement method,
+ FunctionElement setter,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- applyParameters(parameters, arg);
- apply(body, arg);
- return null;
+ return handleSuperCompounds(
+ node,
+ method, CompoundGetter.METHOD,
+ setter, CompoundSetter.SETTER,
+ new AssignmentCompound(operator, rhs),
+ arg);
}
@override
- R visitTopLevelGetterDeclaration(
- FunctionExpression node,
- MethodElement getter,
- Node body,
+ R visitSuperFieldSetterCompound(
+ Send node,
+ FieldElement field,
+ FunctionElement setter,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- apply(body, arg);
- return null;
+ return handleSuperCompounds(
+ node,
+ field, CompoundGetter.FIELD,
+ setter, CompoundSetter.SETTER,
+ new AssignmentCompound(operator, rhs),
+ arg);
}
@override
- R visitTopLevelSetterDeclaration(
- FunctionExpression node,
- MethodElement setter,
- NodeList parameters,
- Node body,
+ R visitSuperGetterFieldCompound(
+ Send node,
+ FunctionElement getter,
+ FieldElement field,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- applyParameters(parameters, arg);
- apply(body, arg);
- return null;
+ return handleSuperCompounds(
+ node,
+ getter, CompoundGetter.GETTER,
+ field, CompoundSetter.FIELD,
+ new AssignmentCompound(operator, rhs),
+ arg);
}
-}
-/// AST visitor that visits all normal [Send] and [SendSet] nodes using the
-/// [SemanticVisitor].
-class TraversalVisitor<R, A> extends SemanticVisitor<R, A>
- with TraversalSendMixin<R, A>,
- TraversalDeclarationMixin<R, A> {
- TraversalVisitor(TreeElements elements) : super(elements);
+ @override
+ R visitClassTypeLiteralCompound(
+ Send node,
+ ConstantExpression constant,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ return handleTypeLiteralConstantCompounds(
+ node,
+ constant,
+ new AssignmentCompound(operator, rhs),
+ arg);
+ }
- SemanticSendVisitor<R, A> get sendVisitor => this;
+ @override
+ R visitTypedefTypeLiteralCompound(
+ Send node,
+ ConstantExpression constant,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ return handleTypeLiteralConstantCompounds(
+ node,
+ constant,
+ new AssignmentCompound(operator, rhs),
+ arg);
+ }
- SemanticDeclarationVisitor<R, A> get declVisitor => this;
+ @override
+ R visitTypeVariableTypeLiteralCompound(
+ Send node,
+ TypeVariableElement element,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ return handleTypeVariableTypeLiteralCompounds(
+ node,
+ element,
+ new AssignmentCompound(operator, rhs),
+ arg);
+ }
- R apply(Node node, A arg) {
- node.accept(this);
- return null;
+ @override
+ R visitDynamicTypeLiteralCompound(
+ Send node,
+ ConstantExpression constant,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ return handleTypeLiteralConstantCompounds(
+ node,
+ constant,
+ new AssignmentCompound(operator, rhs),
+ arg);
}
- @override
- applyInitializers(NodeList initializers, A arg) {
- visitInitializers(initializers, arg);
+
+ R visitDynamicPropertyPrefix(
+ Send node,
+ Node receiver,
+ IncDecOperator operator,
+ Selector getterSelector,
+ Selector setterSelector,
+ A arg) {
+ return handleDynamicCompounds(
+ node,
+ receiver,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ getterSelector,
+ setterSelector,
+ arg);
}
@override
- applyParameters(NodeList parameters, A arg) {
- visitParameters(parameters, arg);
+ R visitParameterPrefix(
+ Send node,
+ ParameterElement parameter,
+ IncDecOperator operator,
+ A arg) {
+ return handleLocalCompounds(
+ node,
+ parameter,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg,
+ isSetterValid: true);
}
@override
- internalError(Spannable spannable, String message) {
- throw new SpannableAssertionFailure(spannable, message);
+ R visitLocalVariablePrefix(
+ Send node,
+ LocalVariableElement variable,
+ IncDecOperator operator,
+ A arg) {
+ return handleLocalCompounds(
+ node,
+ variable,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg,
+ isSetterValid: true);
}
@override
- R visitNode(Node node) {
- node.visitChildren(this);
- return null;
+ R visitLocalFunctionPrefix(
+ Send node,
+ LocalFunctionElement function,
+ IncDecOperator operator,
+ A arg) {
+ return handleLocalCompounds(
+ node,
+ function,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg,
+ isSetterValid: false);
}
-}
-/// Mixin that groups all `visitStaticX` and `visitTopLevelX` method by
-/// delegating calls to `handleStaticX` methods.
-///
-/// This mixin is useful for the cases where both top level members and static
-/// class members are handled uniformly.
-abstract class BaseImplementationOfStaticsMixin<R, A>
- implements SemanticSendVisitor<R, A> {
- R handleStaticFieldCompound(
+
+ R visitThisPropertyPrefix(
Send node,
- FieldElement field,
- AssignmentOperator operator,
- Node rhs,
- A arg);
+ IncDecOperator operator,
+ Selector getterSelector,
+ Selector setterSelector,
+ A arg) {
+ return handleDynamicCompounds(
+ node,
+ null,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ getterSelector,
+ setterSelector,
+ arg);
+ }
- R handleStaticFieldGet(
+ @override
+ R visitStaticFieldPrefix(
Send node,
FieldElement field,
- A arg);
+ IncDecOperator operator,
+ A arg) {
+ return handleStaticCompounds(
+ node,
+ field, CompoundGetter.FIELD,
+ field, CompoundSetter.FIELD,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
+ }
- R handleStaticFieldInvoke(
+ @override
+ R visitStaticGetterSetterPrefix(
Send node,
- FieldElement field,
- NodeList arguments,
- CallStructure callStructure,
- A arg);
+ FunctionElement getter,
+ FunctionElement setter,
+ IncDecOperator operator,
+ A arg) {
+ return handleStaticCompounds(
+ node,
+ getter, CompoundGetter.GETTER,
+ setter, CompoundSetter.SETTER,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
+ }
- R handleStaticFieldPostfixPrefix(
+
+ R visitStaticMethodSetterPrefix(
Send node,
- FieldElement field,
+ FunctionElement getter,
+ FunctionElement setter,
IncDecOperator operator,
- A arg,
- {bool isPrefix});
+ A arg) {
+ return handleStaticCompounds(
+ node,
+ getter, CompoundGetter.METHOD,
+ setter, CompoundSetter.SETTER,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
+ }
- R handleStaticFieldSet(
- SendSet node,
+ @override
+ R visitTopLevelFieldPrefix(
+ Send node,
FieldElement field,
- Node rhs,
- A arg);
+ IncDecOperator operator,
+ A arg) {
+ return handleStaticCompounds(
+ node,
+ field, CompoundGetter.FIELD,
+ field, CompoundSetter.FIELD,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
+ }
- R handleStaticFunctionGet(
+ @override
+ R visitTopLevelGetterSetterPrefix(
Send node,
- MethodElement function,
- A arg);
+ FunctionElement getter,
+ FunctionElement setter,
+ IncDecOperator operator,
+ A arg) {
+ return handleStaticCompounds(
+ node,
+ getter, CompoundGetter.GETTER,
+ setter, CompoundSetter.SETTER,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
+ }
- R handleStaticFunctionInvoke(
+ @override
+ R visitTopLevelMethodSetterPrefix(
Send node,
- MethodElement function,
- NodeList arguments,
- CallStructure callStructure,
- A arg);
+ FunctionElement method,
+ FunctionElement setter,
+ IncDecOperator operator,
+ A arg) {
+ return handleStaticCompounds(
+ node,
+ method, CompoundGetter.METHOD,
+ setter, CompoundSetter.SETTER,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
+ }
- R handleStaticFunctionIncompatibleInvoke(
+ @override
+ R visitSuperFieldPrefix(
Send node,
- MethodElement function,
- NodeList arguments,
- CallStructure callStructure,
- A arg);
+ FieldElement field,
+ IncDecOperator operator,
+ A arg) {
+ return handleSuperCompounds(
+ node,
+ field, CompoundGetter.FIELD,
+ field, CompoundSetter.FIELD,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
+ }
- R handleStaticGetterGet(
+ @override
+ R visitSuperFieldFieldPrefix(
Send node,
- FunctionElement getter,
- A arg);
+ FieldElement readField,
+ FieldElement writtenField,
+ IncDecOperator operator,
+ A arg) {
+ return handleSuperCompounds(
+ node,
+ readField, CompoundGetter.FIELD,
+ writtenField, CompoundSetter.FIELD,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
+ }
- R handleStaticGetterInvoke(
+ @override
+ R visitSuperFieldSetterPrefix(
Send node,
- FunctionElement getter,
- NodeList arguments,
- CallStructure callStructure,
- A arg);
+ FieldElement field,
+ FunctionElement setter,
+ IncDecOperator operator,
+ A arg) {
+ return handleSuperCompounds(
+ node,
+ field, CompoundGetter.FIELD,
+ setter, CompoundSetter.SETTER,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
+ }
- R handleStaticGetterSetterCompound(
+
+ R visitSuperGetterSetterPrefix(
Send node,
FunctionElement getter,
FunctionElement setter,
- AssignmentOperator operator,
- Node rhs,
- A arg);
+ IncDecOperator operator,
+ A arg) {
+ return handleSuperCompounds(
+ node,
+ getter, CompoundGetter.GETTER,
+ setter, CompoundSetter.SETTER,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
+ }
- R handleStaticGetterSetterPostfixPrefix(
+ @override
+ R visitSuperGetterFieldPrefix(
Send node,
FunctionElement getter,
- FunctionElement setter,
+ FieldElement field,
IncDecOperator operator,
- A arg,
- {bool isPrefix});
+ A arg) {
+ return handleSuperCompounds(
+ node,
+ getter, CompoundGetter.GETTER,
+ field, CompoundSetter.FIELD,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
+ }
- R handleStaticMethodSetterCompound(
+ @override
+ R visitSuperMethodSetterPrefix(
Send node,
FunctionElement method,
FunctionElement setter,
- AssignmentOperator operator,
- Node rhs,
- A arg);
+ IncDecOperator operator,
+ A arg) {
+ return handleSuperCompounds(
+ node,
+ method, CompoundGetter.METHOD,
+ setter, CompoundSetter.SETTER,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
+ }
- R handleStaticMethodSetterPostfixPrefix(
+ @override
+ R visitClassTypeLiteralPrefix(
Send node,
- FunctionElement getter,
- FunctionElement setter,
+ ConstantExpression constant,
IncDecOperator operator,
- A arg,
- {bool isPrefix});
+ A arg) {
+ return handleTypeLiteralConstantCompounds(
+ node,
+ constant,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
+ }
- R handleStaticSetterSet(
- SendSet node,
- FunctionElement setter,
- Node rhs,
- A arg);
+ @override
+ R visitTypedefTypeLiteralPrefix(
+ Send node,
+ ConstantExpression constant,
+ IncDecOperator operator,
+ A arg) {
+ return handleTypeLiteralConstantCompounds(
+ node,
+ constant,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
+ }
@override
- R visitStaticFieldCompound(
+ R visitTypeVariableTypeLiteralPrefix(
Send node,
- FieldElement field,
- AssignmentOperator operator,
- Node rhs,
+ TypeVariableElement element,
+ IncDecOperator operator,
A arg) {
- return handleStaticFieldCompound(node, field, operator, rhs, arg);
+ return handleTypeVariableTypeLiteralCompounds(
+ node,
+ element,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
@override
- R visitStaticFieldGet(
+ R visitDynamicTypeLiteralPrefix(
Send node,
- FieldElement field,
+ ConstantExpression constant,
+ IncDecOperator operator,
A arg) {
- return handleStaticFieldGet(node, field, arg);
+ return handleTypeLiteralConstantCompounds(
+ node,
+ constant,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
@override
- R visitStaticFieldInvoke(
+ R visitDynamicPropertyPostfix(
Send node,
- FieldElement field,
- NodeList arguments,
- CallStructure callStructure,
+ Node receiver,
+ IncDecOperator operator,
+ Selector getterSelector,
+ Selector setterSelector,
A arg) {
- return handleStaticFieldInvoke(node, field, arguments, callStructure, arg);
+ return handleDynamicCompounds(
+ node,
+ receiver,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ getterSelector,
+ setterSelector,
+ arg);
}
@override
- R visitStaticFieldPostfix(
+ R visitParameterPostfix(
Send node,
- FieldElement field,
+ ParameterElement parameter,
IncDecOperator operator,
A arg) {
- return handleStaticFieldPostfixPrefix(
- node, field, operator, arg, isPrefix: false);
+ return handleLocalCompounds(
+ node,
+ parameter,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg,
+ isSetterValid: true);
}
@override
- R visitStaticFieldPrefix(
+ R visitLocalVariablePostfix(
Send node,
- FieldElement field,
+ LocalVariableElement variable,
IncDecOperator operator,
A arg) {
- return handleStaticFieldPostfixPrefix(
- node, field, operator, arg, isPrefix: true);
+ return handleLocalCompounds(
+ node,
+ variable,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg,
+ isSetterValid: true);
}
@override
- R visitStaticFieldSet(
- SendSet node,
- FieldElement field,
- Node rhs,
+ R visitLocalFunctionPostfix(
+ Send node,
+ LocalFunctionElement function,
+ IncDecOperator operator,
A arg) {
- return handleStaticFieldSet(node, field, rhs, arg);
+ return handleLocalCompounds(
+ node,
+ function,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg,
+ isSetterValid: false);
+ }
+
+
+ R visitThisPropertyPostfix(
+ Send node,
+ IncDecOperator operator,
+ Selector getterSelector,
+ Selector setterSelector,
+ A arg) {
+ return handleDynamicCompounds(
+ node,
+ null,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ getterSelector,
+ setterSelector,
+ arg);
}
@override
- R visitStaticFunctionGet(
+ R visitStaticFieldPostfix(
Send node,
- MethodElement function,
+ FieldElement field,
+ IncDecOperator operator,
A arg) {
- return handleStaticFunctionGet(node, function, arg);
+ return handleStaticCompounds(
+ node,
+ field, CompoundGetter.FIELD,
+ field, CompoundSetter.FIELD,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
- R visitStaticFunctionInvoke(
+ R visitStaticGetterSetterPostfix(
Send node,
- MethodElement function,
- NodeList arguments,
- CallStructure callStructure,
+ FunctionElement getter,
+ FunctionElement setter,
+ IncDecOperator operator,
A arg) {
- return handleStaticFunctionInvoke(
- node, function, arguments, callStructure, arg);
+ return handleStaticCompounds(
+ node,
+ getter, CompoundGetter.GETTER,
+ setter, CompoundSetter.SETTER,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
- @override
- R visitStaticFunctionIncompatibleInvoke(
+
+ R visitStaticMethodSetterPostfix(
Send node,
- MethodElement function,
- NodeList arguments,
- CallStructure callStructure,
+ FunctionElement getter,
+ FunctionElement setter,
+ IncDecOperator operator,
A arg) {
- return handleStaticFunctionIncompatibleInvoke(
- node, function, arguments, callStructure, arg);
+ return handleStaticCompounds(
+ node,
+ getter, CompoundGetter.METHOD,
+ setter, CompoundSetter.SETTER,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
- R visitStaticGetterGet(
+ R visitTopLevelFieldPostfix(
Send node,
- FunctionElement getter,
+ FieldElement field,
+ IncDecOperator operator,
A arg) {
- return handleStaticGetterGet(node, getter, arg);
+ return handleStaticCompounds(
+ node,
+ field, CompoundGetter.FIELD,
+ field, CompoundSetter.FIELD,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
- R visitStaticGetterInvoke(
+ R visitTopLevelGetterSetterPostfix(
Send node,
FunctionElement getter,
- NodeList arguments,
- CallStructure callStructure,
+ FunctionElement setter,
+ IncDecOperator operator,
A arg) {
- return handleStaticGetterInvoke(
- node, getter, arguments, callStructure, arg);
+ return handleStaticCompounds(
+ node,
+ getter, CompoundGetter.GETTER,
+ setter, CompoundSetter.SETTER,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
- R visitStaticGetterSetterCompound(
+ R visitTopLevelMethodSetterPostfix(
Send node,
- FunctionElement getter,
+ FunctionElement method,
FunctionElement setter,
- AssignmentOperator operator,
- Node rhs,
+ IncDecOperator operator,
A arg) {
- return handleStaticGetterSetterCompound(
- node, getter, setter, operator, rhs, arg);
+ return handleStaticCompounds(
+ node,
+ method, CompoundGetter.METHOD,
+ setter, CompoundSetter.SETTER,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
- R visitStaticGetterSetterPostfix(
+ R visitSuperFieldPostfix(
Send node,
- FunctionElement getter,
- FunctionElement setter,
+ FieldElement field,
IncDecOperator operator,
A arg) {
- return handleStaticGetterSetterPostfixPrefix(
- node, getter, setter, operator, arg, isPrefix: false);
+ return handleSuperCompounds(
+ node,
+ field, CompoundGetter.FIELD,
+ field, CompoundSetter.FIELD,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
- R visitStaticGetterSetterPrefix(
+ R visitSuperFieldFieldPostfix(
Send node,
- FunctionElement getter,
- FunctionElement setter,
+ FieldElement readField,
+ FieldElement writtenField,
IncDecOperator operator,
A arg) {
- return handleStaticGetterSetterPostfixPrefix(
- node, getter, setter, operator, arg, isPrefix: true);
+ return handleSuperCompounds(
+ node,
+ readField, CompoundGetter.FIELD,
+ writtenField, CompoundSetter.FIELD,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
- R visitStaticMethodSetterCompound(
+ R visitSuperFieldSetterPostfix(
Send node,
- FunctionElement method,
+ FieldElement field,
FunctionElement setter,
- AssignmentOperator operator,
- Node rhs,
+ IncDecOperator operator,
A arg) {
- return handleStaticMethodSetterCompound(
- node, method, setter, operator, rhs, arg);
+ return handleSuperCompounds(
+ node,
+ field, CompoundGetter.FIELD,
+ setter, CompoundSetter.SETTER,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
- @override
- R visitStaticMethodSetterPostfix(
+
+ R visitSuperGetterSetterPostfix(
Send node,
FunctionElement getter,
FunctionElement setter,
IncDecOperator operator,
A arg) {
- return handleStaticMethodSetterPostfixPrefix(
- node, getter, setter, operator, arg, isPrefix: false);
+ return handleSuperCompounds(
+ node,
+ getter, CompoundGetter.GETTER,
+ setter, CompoundSetter.SETTER,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
- R visitStaticMethodSetterPrefix(
+ R visitSuperGetterFieldPostfix(
Send node,
FunctionElement getter,
- FunctionElement setter,
+ FieldElement field,
IncDecOperator operator,
A arg) {
- return handleStaticMethodSetterPostfixPrefix(
- node, getter, setter, operator, arg, isPrefix: true);
+ return handleSuperCompounds(
+ node,
+ getter, CompoundGetter.GETTER,
+ field, CompoundSetter.FIELD,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
- R visitStaticSetterSet(
- SendSet node,
+ R visitSuperMethodSetterPostfix(
+ Send node,
+ FunctionElement method,
FunctionElement setter,
- Node rhs,
+ IncDecOperator operator,
A arg) {
- return handleStaticSetterSet(node, setter, rhs, arg);
+ return handleSuperCompounds(
+ node,
+ method, CompoundGetter.METHOD,
+ setter, CompoundSetter.SETTER,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
- R visitTopLevelFieldCompound(
+ R visitClassTypeLiteralPostfix(
Send node,
- FieldElement field,
- AssignmentOperator operator,
- Node rhs,
+ ConstantExpression constant,
+ IncDecOperator operator,
A arg) {
- return handleStaticFieldCompound(node, field, operator, rhs, arg);
+ return handleTypeLiteralConstantCompounds(
+ node,
+ constant,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
- R visitTopLevelFieldGet(
+ R visitTypedefTypeLiteralPostfix(
Send node,
- FieldElement field,
+ ConstantExpression constant,
+ IncDecOperator operator,
A arg) {
- return handleStaticFieldGet(node, field, arg);
+ return handleTypeLiteralConstantCompounds(
+ node,
+ constant,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
- R visitTopLevelFieldInvoke(
+ R visitTypeVariableTypeLiteralPostfix(
Send node,
- FieldElement field,
- NodeList arguments,
- CallStructure callStructure,
+ TypeVariableElement element,
+ IncDecOperator operator,
A arg) {
- return handleStaticFieldInvoke(node, field, arguments, callStructure, arg);
+ return handleTypeVariableTypeLiteralCompounds(
+ node,
+ element,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
- R visitTopLevelFieldPostfix(
+ R visitDynamicTypeLiteralPostfix(
Send node,
- FieldElement field,
+ ConstantExpression constant,
IncDecOperator operator,
A arg) {
- return handleStaticFieldPostfixPrefix(
- node, field, operator, arg, isPrefix: false);
+ return handleTypeLiteralConstantCompounds(
+ node,
+ constant,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
- R visitTopLevelFieldPrefix(
+ R visitUnresolvedStaticGetterPostfix(
Send node,
- FieldElement field,
+ Element element,
+ MethodElement setter,
IncDecOperator operator,
A arg) {
- return handleStaticFieldPostfixPrefix(
- node, field, operator, arg, isPrefix: true);
+ return handleStaticCompounds(
+ node,
+ element,
+ CompoundGetter.UNRESOLVED,
+ setter,
+ CompoundSetter.SETTER,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
- R visitTopLevelFieldSet(
- SendSet node,
- FieldElement field,
- Node rhs,
+ R visitUnresolvedTopLevelGetterPostfix(
+ Send node,
+ Element element,
+ MethodElement setter,
+ IncDecOperator operator,
A arg) {
- return handleStaticFieldSet(node, field, rhs, arg);
+ return handleStaticCompounds(
+ node,
+ element,
+ CompoundGetter.UNRESOLVED,
+ setter,
+ CompoundSetter.SETTER,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
- R visitTopLevelFunctionGet(
+ R visitUnresolvedStaticSetterPostfix(
Send node,
- MethodElement function,
+ MethodElement getter,
+ Element element,
+ IncDecOperator operator,
A arg) {
- return handleStaticFunctionGet(node, function, arg);
+ return handleStaticCompounds(
+ node,
+ getter,
+ CompoundGetter.GETTER,
+ element,
+ CompoundSetter.INVALID,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
- R visitTopLevelFunctionInvoke(
+ R visitUnresolvedTopLevelSetterPostfix(
Send node,
- MethodElement function,
- NodeList arguments,
- CallStructure callStructure,
+ MethodElement getter,
+ Element element,
+ IncDecOperator operator,
A arg) {
- return handleStaticFunctionInvoke(
- node, function, arguments, callStructure, arg);
+ return handleStaticCompounds(
+ node,
+ getter,
+ CompoundGetter.GETTER,
+ element,
+ CompoundSetter.INVALID,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
- R visitTopLevelFunctionIncompatibleInvoke(
+ R visitStaticMethodPostfix(
Send node,
- MethodElement function,
- NodeList arguments,
- CallStructure callStructure,
+ MethodElement method,
+ IncDecOperator operator,
A arg) {
- return handleStaticFunctionIncompatibleInvoke(
- node, function, arguments, callStructure, arg);
+ return handleStaticCompounds(
+ node,
+ method,
+ CompoundGetter.METHOD,
+ method,
+ CompoundSetter.INVALID,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
- R visitTopLevelGetterGet(
+ R visitTopLevelMethodPostfix(
Send node,
- FunctionElement getter,
+ MethodElement method,
+ IncDecOperator operator,
A arg) {
- return handleStaticGetterGet(node, getter, arg);
+ return handleStaticCompounds(
+ node,
+ method,
+ CompoundGetter.METHOD,
+ method,
+ CompoundSetter.INVALID,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
- R visitTopLevelGetterInvoke(
+ R visitUnresolvedPostfix(
Send node,
- FunctionElement getter,
- NodeList arguments,
- CallStructure callStructure,
+ Element element,
+ IncDecOperator operator,
A arg) {
- return handleStaticGetterInvoke(
- node, getter, arguments, callStructure, arg);
+ return handleStaticCompounds(
+ node,
+ element,
+ CompoundGetter.UNRESOLVED,
+ element,
+ CompoundSetter.INVALID,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
- R visitTopLevelGetterSetterCompound(
+ R visitUnresolvedStaticGetterPrefix(
Send node,
- FunctionElement getter,
- FunctionElement setter,
- AssignmentOperator operator,
- Node rhs,
+ Element element,
+ MethodElement setter,
+ IncDecOperator operator,
A arg) {
- return handleStaticGetterSetterCompound(
- node, getter, setter, operator, rhs, arg);
+ return handleStaticCompounds(
+ node,
+ element,
+ CompoundGetter.UNRESOLVED,
+ setter,
+ CompoundSetter.SETTER,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
@override
- R visitTopLevelGetterSetterPostfix(
+ R visitUnresolvedTopLevelGetterPrefix(
Send node,
- FunctionElement getter,
- FunctionElement setter,
+ Element element,
+ MethodElement setter,
IncDecOperator operator,
A arg) {
- return handleStaticGetterSetterPostfixPrefix(
- node, getter, setter, operator, arg, isPrefix: false);
+ return handleStaticCompounds(
+ node,
+ element,
+ CompoundGetter.UNRESOLVED,
+ setter,
+ CompoundSetter.SETTER,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
@override
- R visitTopLevelGetterSetterPrefix(
+ R visitUnresolvedStaticSetterPrefix(
Send node,
- FunctionElement getter,
- FunctionElement setter,
+ MethodElement getter,
+ Element element,
IncDecOperator operator,
A arg) {
- return handleStaticGetterSetterPostfixPrefix(
- node, getter, setter, operator, arg, isPrefix: true);
+ return handleStaticCompounds(
+ node,
+ getter,
+ CompoundGetter.GETTER,
+ element,
+ CompoundSetter.INVALID,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
@override
- R visitTopLevelMethodSetterCompound(
+ R visitUnresolvedTopLevelSetterPrefix(
Send node,
- FunctionElement method,
- FunctionElement setter,
- AssignmentOperator operator,
- Node rhs,
+ MethodElement getter,
+ Element element,
+ IncDecOperator operator,
A arg) {
- return handleStaticMethodSetterCompound(
- node, method, setter, operator, rhs, arg);
+ return handleStaticCompounds(
+ node,
+ getter,
+ CompoundGetter.GETTER,
+ element,
+ CompoundSetter.INVALID,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
@override
- R visitTopLevelMethodSetterPostfix(
+ R visitStaticMethodPrefix(
Send node,
- FunctionElement method,
- FunctionElement setter,
+ MethodElement method,
IncDecOperator operator,
A arg) {
- return handleStaticMethodSetterPostfixPrefix(
- node, method, setter, operator, arg, isPrefix: false);
+ return handleStaticCompounds(
+ node,
+ method,
+ CompoundGetter.METHOD,
+ method,
+ CompoundSetter.INVALID,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
@override
- R visitTopLevelMethodSetterPrefix(
+ R visitTopLevelMethodPrefix(
Send node,
- FunctionElement method,
- FunctionElement setter,
+ MethodElement method,
IncDecOperator operator,
A arg) {
- return handleStaticMethodSetterPostfixPrefix(
- node, method, setter, operator, arg, isPrefix: true);
+ return handleStaticCompounds(
+ node,
+ method,
+ CompoundGetter.METHOD,
+ method,
+ CompoundSetter.INVALID,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
@override
- R visitTopLevelSetterSet(
- SendSet node,
- FunctionElement setter,
- Node rhs,
+ R visitUnresolvedPrefix(
+ Send node,
+ Element element,
+ IncDecOperator operator,
A arg) {
- return handleStaticSetterSet(node, setter, rhs, arg);
+ return handleStaticCompounds(
+ node,
+ element,
+ CompoundGetter.UNRESOLVED,
+ element,
+ CompoundSetter.INVALID,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
-}
-/// Mixin that groups all `visitLocalX` and `visitParameterX` method by
-/// delegating calls to `handleLocalX` methods.
-///
-/// This mixin is useful for the cases where both parameters, local variables,
-/// and local functions, captured or not, are handled uniformly.
-abstract class BaseImplementationOfLocalsMixin<R, A>
- implements SemanticSendVisitor<R, A> {
- R handleLocalCompound(
+ @override
+ R visitUnresolvedStaticGetterCompound(
Send node,
- LocalElement element,
+ Element element,
+ MethodElement setter,
AssignmentOperator operator,
Node rhs,
- A arg);
-
- R handleLocalGet(
- Send node,
- LocalElement element,
- A arg);
+ A arg) {
+ return handleStaticCompounds(
+ node,
+ element,
+ CompoundGetter.UNRESOLVED,
+ setter,
+ CompoundSetter.SETTER,
+ new AssignmentCompound(operator, rhs),
+ arg);
+ }
- R handleLocalInvoke(
+ @override
+ R visitUnresolvedTopLevelGetterCompound(
Send node,
- LocalElement element,
- NodeList arguments,
- CallStructure callStructure,
- A arg);
+ Element element,
+ MethodElement setter,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg) {
+ return handleStaticCompounds(
+ node,
+ element,
+ CompoundGetter.UNRESOLVED,
+ setter,
+ CompoundSetter.SETTER,
+ new AssignmentCompound(operator, rhs),
+ arg);
+ }
- R handleLocalPostfixPrefix(
+ @override
+ R visitUnresolvedStaticSetterCompound(
Send node,
- LocalElement element,
- IncDecOperator operator,
- A arg,
- {bool isPrefix});
-
- R handleLocalSet(
- SendSet node,
- LocalElement element,
+ MethodElement getter,
+ Element element,
+ AssignmentOperator operator,
Node rhs,
- A arg);
+ A arg) {
+ return handleStaticCompounds(
+ node,
+ getter,
+ CompoundGetter.GETTER,
+ element,
+ CompoundSetter.INVALID,
+ new AssignmentCompound(operator, rhs),
+ arg);
+ }
@override
- R visitLocalFunctionGet(
+ R visitUnresolvedTopLevelSetterCompound(
Send node,
- LocalFunctionElement function,
+ MethodElement getter,
+ Element element,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return handleLocalGet(node, function, arg);
+ return handleStaticCompounds(
+ node,
+ getter,
+ CompoundGetter.GETTER,
+ element,
+ CompoundSetter.INVALID,
+ new AssignmentCompound(operator, rhs),
+ arg);
}
@override
- R visitLocalFunctionInvoke(
+ R visitStaticMethodCompound(
Send node,
- LocalFunctionElement function,
- NodeList arguments,
- CallStructure callStructure,
+ MethodElement method,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return handleLocalInvoke(node, function, arguments, callStructure, arg);
+ return handleStaticCompounds(
+ node,
+ method,
+ CompoundGetter.METHOD,
+ method,
+ CompoundSetter.INVALID,
+ new AssignmentCompound(operator, rhs),
+ arg);
}
@override
- R visitLocalVariableCompound(
+ R visitTopLevelMethodCompound(
Send node,
- LocalVariableElement variable,
+ MethodElement method,
AssignmentOperator operator,
Node rhs,
A arg) {
- return handleLocalCompound(node, variable, operator, rhs, arg);
+ return handleStaticCompounds(
+ node,
+ method,
+ CompoundGetter.METHOD,
+ method,
+ CompoundSetter.INVALID,
+ new AssignmentCompound(operator, rhs),
+ arg);
}
@override
- R visitLocalVariableGet(
+ R visitUnresolvedCompound(
Send node,
- LocalVariableElement variable,
+ Element element,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return handleLocalGet(node, variable, arg);
+ return handleStaticCompounds(
+ node,
+ element,
+ CompoundGetter.UNRESOLVED,
+ element,
+ CompoundSetter.INVALID,
+ new AssignmentCompound(operator, rhs),
+ arg);
}
@override
- R visitLocalVariableInvoke(
+ R visitFinalLocalVariablePostfix(
Send node,
LocalVariableElement variable,
- NodeList arguments,
- CallStructure callStructure,
+ IncDecOperator operator,
A arg) {
- return handleLocalInvoke(node, variable, arguments, callStructure, arg);
+ return handleLocalCompounds(
+ node,
+ variable,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg,
+ isSetterValid: false);
}
@override
- R visitLocalVariablePostfix(
+ R visitFinalLocalVariablePrefix(
Send node,
LocalVariableElement variable,
IncDecOperator operator,
A arg) {
- return handleLocalPostfixPrefix(
- node, variable, operator, arg, isPrefix: false);
+ return handleLocalCompounds(
+ node,
+ variable,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg,
+ isSetterValid: false);
}
@override
- R visitLocalVariablePrefix(
+ R visitFinalParameterPostfix(
Send node,
- LocalVariableElement variable,
+ ParameterElement parameter,
IncDecOperator operator,
A arg) {
- return handleLocalPostfixPrefix(
- node, variable, operator, arg, isPrefix: true);
+ return handleLocalCompounds(
+ node,
+ parameter,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg,
+ isSetterValid: false);
}
@override
- R visitLocalVariableSet(
- SendSet node,
- LocalVariableElement variable,
- Node rhs,
+ R visitFinalParameterPrefix(
+ Send node,
+ ParameterElement parameter,
+ IncDecOperator operator,
A arg) {
- return handleLocalSet(node, variable, rhs, arg);
+ return handleLocalCompounds(
+ node,
+ parameter,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg,
+ isSetterValid: false);
}
@override
- R visitParameterCompound(
+ R visitFinalStaticFieldPostfix(
Send node,
- ParameterElement parameter,
- AssignmentOperator operator,
- Node rhs,
+ FieldElement field,
+ IncDecOperator operator,
A arg) {
- return handleLocalCompound(node, parameter, operator, rhs, arg);
+ return handleStaticCompounds(
+ node,
+ field,
+ CompoundGetter.FIELD,
+ field,
+ CompoundSetter.INVALID,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
- R visitParameterGet(
+ R visitFinalStaticFieldPrefix(
Send node,
- ParameterElement parameter,
+ FieldElement field,
+ IncDecOperator operator,
A arg) {
- return handleLocalGet(node, parameter, arg);
+ return handleStaticCompounds(
+ node,
+ field,
+ CompoundGetter.FIELD,
+ field,
+ CompoundSetter.INVALID,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
@override
- R visitParameterInvoke(
+ R visitSuperFieldFieldCompound(
Send node,
- ParameterElement parameter,
- NodeList arguments,
- CallStructure callStructure,
+ FieldElement readField,
+ FieldElement writtenField,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return handleLocalInvoke(node, parameter, arguments, callStructure, arg);
+ return handleSuperCompounds(
+ node,
+ readField,
+ CompoundGetter.FIELD,
+ writtenField,
+ CompoundSetter.FIELD,
+ new AssignmentCompound(operator, rhs),
+ arg);
}
@override
- R visitParameterPostfix(
+ R visitFinalSuperFieldPostfix(
Send node,
- ParameterElement parameter,
+ FieldElement field,
IncDecOperator operator,
A arg) {
- return handleLocalPostfixPrefix(
- node, parameter, operator, arg, isPrefix: false);
+ return handleSuperCompounds(
+ node,
+ field,
+ CompoundGetter.FIELD,
+ field,
+ CompoundSetter.INVALID,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
- R visitParameterPrefix(
+ R visitFinalSuperFieldPrefix(
Send node,
- ParameterElement parameter,
+ FieldElement field,
IncDecOperator operator,
A arg) {
- return handleLocalPostfixPrefix(
- node, parameter, operator, arg, isPrefix: true);
+ return handleSuperCompounds(
+ node,
+ field,
+ CompoundGetter.FIELD,
+ field,
+ CompoundSetter.INVALID,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
@override
- R visitParameterSet(
- SendSet node,
- ParameterElement parameter,
+ R visitSuperMethodCompound(
+ Send node,
+ FunctionElement method,
+ AssignmentOperator operator,
Node rhs,
A arg) {
- return handleLocalSet(node, parameter, rhs, arg);
+ return handleSuperCompounds(
+ node,
+ method,
+ CompoundGetter.METHOD,
+ method,
+ CompoundSetter.INVALID,
+ new AssignmentCompound(operator, rhs),
+ arg);
}
-}
-
-/// Mixin that groups all `visitConstantX` and `visitXTypeLiteralY` methods for
-/// constant type literals by delegating calls to `handleConstantX` methods.
-///
-/// This mixin is useful for the cases where expressions on constants are
-/// handled uniformly.
-abstract class BaseImplementationOfConstantsMixin<R, A>
- implements SemanticSendVisitor<R, A> {
- R handleConstantGet(
- Node node,
- ConstantExpression constant,
- A arg);
- R handleConstantInvoke(
+ @override
+ R visitSuperMethodPostfix(
Send node,
- ConstantExpression constant,
- NodeList arguments,
- CallStructure callStructure,
- A arg);
+ FunctionElement method,
+ IncDecOperator operator,
+ A arg) {
+ return handleSuperCompounds(
+ node,
+ method,
+ CompoundGetter.METHOD,
+ method,
+ CompoundSetter.INVALID,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
+ }
@override
- R visitClassTypeLiteralGet(
+ R visitSuperMethodPrefix(
Send node,
- ConstantExpression constant,
+ FunctionElement method,
+ IncDecOperator operator,
A arg) {
- return handleConstantGet(node, constant, arg);
+ return handleSuperCompounds(
+ node,
+ method,
+ CompoundGetter.METHOD,
+ method,
+ CompoundSetter.INVALID,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
@override
- R visitClassTypeLiteralInvoke(
+ R visitFinalTopLevelFieldPostfix(
Send node,
- ConstantExpression constant,
- NodeList arguments,
- CallStructure callStructure,
+ FieldElement field,
+ IncDecOperator operator,
A arg) {
- return handleConstantInvoke(node, constant, arguments, callStructure, arg);
+ return handleStaticCompounds(
+ node,
+ field,
+ CompoundGetter.FIELD,
+ field,
+ CompoundSetter.INVALID,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
- R visitConstConstructorInvoke(
- NewExpression node,
- ConstructedConstantExpression constant,
+ R visitFinalTopLevelFieldPrefix(
+ Send node,
+ FieldElement field,
+ IncDecOperator operator,
A arg) {
- return handleConstantGet(node, constant, arg);
+ return handleStaticCompounds(
+ node,
+ field,
+ CompoundGetter.FIELD,
+ field,
+ CompoundSetter.INVALID,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
@override
- R visitConstantGet(
+ R visitUnresolvedSuperCompound(
Send node,
- ConstantExpression constant,
+ Element element,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return handleConstantGet(node, constant, arg);
+ return handleSuperCompounds(
+ node,
+ element,
+ CompoundGetter.UNRESOLVED,
+ element,
+ CompoundSetter.INVALID,
+ new AssignmentCompound(operator, rhs),
+ arg);
}
@override
- R visitConstantInvoke(
+ R visitUnresolvedSuperPostfix(
Send node,
- ConstantExpression constant,
- NodeList arguments,
- CallStructure callStructure,
+ Element element,
+ IncDecOperator operator,
A arg) {
- return handleConstantInvoke(node, constant, arguments, callStructure, arg);
+ return handleSuperCompounds(
+ node,
+ element,
+ CompoundGetter.UNRESOLVED,
+ element,
+ CompoundSetter.INVALID,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
- R visitDynamicTypeLiteralGet(
+ R visitUnresolvedSuperPrefix(
Send node,
- ConstantExpression constant,
+ Element element,
+ IncDecOperator operator,
A arg) {
- return handleConstantGet(node, constant, arg);
+ return handleSuperCompounds(
+ node,
+ element,
+ CompoundGetter.UNRESOLVED,
+ element,
+ CompoundSetter.INVALID,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
@override
- R visitDynamicTypeLiteralInvoke(
- Send node,
- ConstantExpression constant,
- NodeList arguments,
- CallStructure callStructure,
+ R visitUnresolvedSuperGetterCompound(
+ Send node, Element element,
+ MethodElement setter,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return handleConstantInvoke(node, constant, arguments, callStructure, arg);
+ return handleSuperCompounds(
+ node,
+ element,
+ CompoundGetter.UNRESOLVED,
+ setter,
+ CompoundSetter.SETTER,
+ new AssignmentCompound(operator, rhs),
+ arg);
}
@override
- R visitTypedefTypeLiteralGet(
+ R visitUnresolvedSuperGetterPostfix(
Send node,
- ConstantExpression constant,
+ Element element,
+ MethodElement setter,
+ IncDecOperator operator,
A arg) {
- return handleConstantGet(node, constant, arg);
+ return handleSuperCompounds(
+ node,
+ element,
+ CompoundGetter.UNRESOLVED,
+ setter,
+ CompoundSetter.SETTER,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
}
@override
- R visitTypedefTypeLiteralInvoke(
+ R visitUnresolvedSuperGetterPrefix(
Send node,
- ConstantExpression constant,
- NodeList arguments,
- CallStructure callStructure,
+ Element element,
+ MethodElement setter,
+ IncDecOperator operator,
A arg) {
- return handleConstantInvoke(node, constant, arguments, callStructure, arg);
+ return handleSuperCompounds(
+ node,
+ element,
+ CompoundGetter.UNRESOLVED,
+ setter,
+ CompoundSetter.SETTER,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
}
-}
-/// Mixin that groups all `visitDynamicPropertyX` and `visitThisPropertyY`
-/// methods for by delegating calls to `handleDynamicX` methods, providing
-/// `null` as the receiver for the this properties.
-///
-/// This mixin is useful for the cases where dynamic and this properties are
-/// handled uniformly.
-abstract class BaseImplementationOfDynamicsMixin<R, A>
- implements SemanticSendVisitor<R, A> {
- R handleDynamicCompound(
+ @override
+ R visitUnresolvedSuperSetterCompound(
Send node,
- Node receiver,
+ MethodElement getter,
+ Element element,
AssignmentOperator operator,
Node rhs,
- Selector getterSelector,
- Selector setterSelector,
- A arg);
-
- R handleDynamicGet(
- Send node,
- Node receiver,
- Selector selector,
- A arg);
+ A arg) {
+ return handleSuperCompounds(
+ node,
+ getter,
+ CompoundGetter.GETTER,
+ element,
+ CompoundSetter.INVALID,
+ new AssignmentCompound(operator, rhs),
+ arg);
+ }
- R handleDynamicInvoke(
+ @override
+ R visitUnresolvedSuperSetterPostfix(
Send node,
- Node receiver,
- NodeList arguments,
- Selector selector,
- A arg);
+ MethodElement getter,
+ Element element,
+ IncDecOperator operator,
+ A arg) {
+ return handleSuperCompounds(
+ node,
+ getter,
+ CompoundGetter.GETTER,
+ element,
+ CompoundSetter.INVALID,
+ new IncDecCompound(CompoundKind.POSTFIX, operator),
+ arg);
+ }
- R handleDynamicPostfixPrefix(
+ @override
+ R visitUnresolvedSuperSetterPrefix(
Send node,
- Node receiver,
+ MethodElement getter,
+ Element element,
IncDecOperator operator,
- Selector getterSelector,
- Selector setterSelector,
- A arg,
- {bool isPrefix});
+ A arg) {
+ return handleSuperCompounds(
+ node,
+ getter,
+ CompoundGetter.GETTER,
+ element,
+ CompoundSetter.INVALID,
+ new IncDecCompound(CompoundKind.PREFIX, operator),
+ arg);
+ }
+}
- R handleDynamicSet(
+/// Simplified handling of indexed compound assignments and prefix/postfix
+/// expressions.
+abstract class BaseImplementationOfIndexCompoundsMixin<R, A>
+ implements SemanticSendVisitor<R, A> {
+
+ /// Handle a dynamic index compounds, like `receiver[index] += rhs` or
+ /// `--receiver[index]`.
+ R handleIndexCompounds(
SendSet node,
Node receiver,
- Selector selector,
- Node rhs,
+ Node index,
+ CompoundRhs rhs,
A arg);
- R handleDynamicIndexPostfixPrefix(
- Send node,
- Node receiver,
+ /// Handle a super index compounds, like `super[index] += rhs` or
+ /// `--super[index]`.
+ R handleSuperIndexCompounds(
+ SendSet node,
+ Element indexFunction,
+ Element indexSetFunction,
Node index,
- IncDecOperator operator,
+ CompoundRhs rhs,
A arg,
- {bool isPrefix});
+ {bool isGetterValid,
+ bool isSetterValid});
@override
- R visitDynamicPropertyCompound(
+ R visitSuperCompoundIndexSet(
Send node,
- Node receiver,
+ FunctionElement indexFunction,
+ FunctionElement indexSetFunction,
+ Node index,
AssignmentOperator operator,
Node rhs,
- Selector getterSelector,
- Selector setterSelector,
A arg) {
- return handleDynamicCompound(
- node, receiver, operator, rhs, getterSelector, setterSelector, arg);
+ return handleSuperIndexCompounds(
+ node, indexFunction, indexSetFunction, index,
+ new AssignmentCompound(operator, rhs), arg,
+ isGetterValid: true, isSetterValid: true);
+ }
+
+ @override
+ R visitSuperIndexPostfix(
+ Send node,
+ FunctionElement indexFunction,
+ FunctionElement indexSetFunction,
+ Node index,
+ IncDecOperator operator,
+ A arg) {
+ return handleSuperIndexCompounds(
+ node, indexFunction, indexSetFunction, index,
+ new IncDecCompound(CompoundKind.POSTFIX, operator), arg,
+ isGetterValid: true, isSetterValid: true);
+ }
+
+ @override
+ R visitSuperIndexPrefix(
+ Send node,
+ FunctionElement indexFunction,
+ FunctionElement indexSetFunction,
+ Node index,
+ IncDecOperator operator,
+ A arg) {
+ return handleSuperIndexCompounds(
+ node, indexFunction, indexSetFunction, index,
+ new IncDecCompound(CompoundKind.PREFIX, operator), arg,
+ isGetterValid: true, isSetterValid: true);
}
@override
- R visitDynamicPropertyGet(
+ R visitUnresolvedSuperGetterCompoundIndexSet(
Send node,
- Node receiver,
- Selector selector,
+ Element indexFunction,
+ FunctionElement indexSetFunction,
+ Node index,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return handleDynamicGet(node, receiver, selector, arg);
+ return handleSuperIndexCompounds(
+ node, indexFunction, indexSetFunction, index,
+ new AssignmentCompound(operator, rhs), arg,
+ isGetterValid: false, isSetterValid: true);
}
@override
- R visitDynamicPropertyInvoke(
+ R visitUnresolvedSuperSetterCompoundIndexSet(
Send node,
- Node receiver,
- NodeList arguments,
- Selector selector,
+ FunctionElement indexFunction,
+ Element indexSetFunction,
+ Node index,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return handleDynamicInvoke(node, receiver, arguments, selector, arg);
+ return handleSuperIndexCompounds(
+ node, indexFunction, indexSetFunction, index,
+ new AssignmentCompound(operator, rhs), arg,
+ isGetterValid: true, isSetterValid: false);
}
@override
- R visitDynamicPropertyPostfix(
+ R visitUnresolvedSuperCompoundIndexSet(
Send node,
- Node receiver,
- IncDecOperator operator,
- Selector getterSelector,
- Selector setterSelector,
+ Element element,
+ Node index,
+ AssignmentOperator operator,
+ Node rhs,
A arg) {
- return handleDynamicPostfixPrefix(
- node, receiver, operator,
- getterSelector, setterSelector, arg, isPrefix: false);
+ return handleSuperIndexCompounds(
+ node, element, element, index,
+ new AssignmentCompound(operator, rhs), arg,
+ isGetterValid: false, isSetterValid: false);
}
@override
- R visitDynamicPropertyPrefix(
+ R visitUnresolvedSuperGetterIndexPostfix(
Send node,
- Node receiver,
+ Element element,
+ FunctionElement indexSetFunction,
+ Node index,
IncDecOperator operator,
- Selector getterSelector,
- Selector setterSelector,
- A arg) {
- return handleDynamicPostfixPrefix(
- node, receiver, operator,
- getterSelector, setterSelector, arg, isPrefix: true);
- }
-
- @override
- R visitDynamicPropertySet(
- SendSet node,
- Node receiver,
- Selector selector,
- Node rhs,
A arg) {
- return handleDynamicSet(node, receiver, selector, rhs, arg);
+ return handleSuperIndexCompounds(
+ node, element, indexSetFunction, index,
+ new IncDecCompound(CompoundKind.POSTFIX, operator), arg,
+ isGetterValid: false, isSetterValid: true);
}
@override
- R visitThisPropertyCompound(
+ R visitUnresolvedSuperGetterIndexPrefix(
Send node,
- AssignmentOperator operator,
- Node rhs,
- Selector getterSelector,
- Selector setterSelector,
+ Element element,
+ FunctionElement indexSetFunction,
+ Node index,
+ IncDecOperator operator,
A arg) {
- return handleDynamicCompound(
- node, null, operator, rhs, getterSelector, setterSelector, arg);
+ return handleSuperIndexCompounds(
+ node, element, indexSetFunction, index,
+ new IncDecCompound(CompoundKind.PREFIX, operator), arg,
+ isGetterValid: false, isSetterValid: true);
}
@override
- R visitThisPropertyGet(
+ R visitUnresolvedSuperSetterIndexPostfix(
Send node,
- Selector selector,
+ MethodElement indexFunction,
+ Element element,
+ Node index,
+ IncDecOperator operator,
A arg) {
- return handleDynamicGet(node, null, selector, arg);
+ return handleSuperIndexCompounds(
+ node, indexFunction, element, index,
+ new IncDecCompound(CompoundKind.POSTFIX, operator), arg,
+ isGetterValid: true, isSetterValid: false);
}
@override
- R visitThisPropertyInvoke(
+ R visitUnresolvedSuperSetterIndexPrefix(
Send node,
- NodeList arguments,
- Selector selector,
+ MethodElement indexFunction,
+ Element element,
+ Node index,
+ IncDecOperator operator,
A arg) {
- return handleDynamicInvoke(node, null, arguments, selector, arg);
+ return handleSuperIndexCompounds(
+ node, indexFunction, element, index,
+ new IncDecCompound(CompoundKind.PREFIX, operator), arg,
+ isGetterValid: true, isSetterValid: false);
}
@override
- R visitThisPropertyPostfix(
+ R visitUnresolvedSuperIndexPostfix(
Send node,
+ Element element,
+ Node index,
IncDecOperator operator,
- Selector getterSelector,
- Selector setterSelector,
A arg) {
- return handleDynamicPostfixPrefix(
- node, null, operator,
- getterSelector, setterSelector, arg, isPrefix: false);
+ return handleSuperIndexCompounds(
+ node, element, element, index,
+ new IncDecCompound(CompoundKind.POSTFIX, operator), arg,
+ isGetterValid: false, isSetterValid: false);
}
@override
- R visitThisPropertyPrefix(
+ R visitUnresolvedSuperIndexPrefix(
Send node,
+ Element element,
+ Node index,
IncDecOperator operator,
- Selector getterSelector,
- Selector setterSelector,
A arg) {
- return handleDynamicPostfixPrefix(
- node, null, operator,
- getterSelector, setterSelector, arg, isPrefix: true);
+ return handleSuperIndexCompounds(
+ node, element, element, index,
+ new IncDecCompound(CompoundKind.PREFIX, operator), arg,
+ isGetterValid: false, isSetterValid: false);
}
@override
- R visitThisPropertySet(
+ R visitCompoundIndexSet(
SendSet node,
- Selector selector,
+ Node receiver,
+ Node index,
+ AssignmentOperator operator,
Node rhs,
A arg) {
- return handleDynamicSet(node, null, selector, rhs, arg);
+ return handleIndexCompounds(
+ node, receiver, index,
+ new AssignmentCompound(operator, rhs), arg);
}
@override
@@ -6401,8 +9589,9 @@ abstract class BaseImplementationOfDynamicsMixin<R, A>
Node index,
IncDecOperator operator,
A arg) {
- return handleDynamicIndexPostfixPrefix(
- node, receiver, index, operator, arg, isPrefix: false);
+ return handleIndexCompounds(
+ node, receiver, index,
+ new IncDecCompound(CompoundKind.POSTFIX, operator), arg);
}
@override
@@ -6412,11 +9601,14 @@ abstract class BaseImplementationOfDynamicsMixin<R, A>
Node index,
IncDecOperator operator,
A arg) {
- return handleDynamicIndexPostfixPrefix(
- node, receiver, index, operator, arg, isPrefix: true);
+ return handleIndexCompounds(
+ node, receiver, index,
+ new IncDecCompound(CompoundKind.PREFIX, operator), arg);
}
}
+
+
/// Mixin that groups all `visitSuperXPrefix`, `visitSuperXPostfix` methods by
/// delegating calls to `handleSuperXPostfixPrefix` methods.
///
@@ -6476,6 +9668,7 @@ abstract class BaseImplementationOfSuperIncDecsMixin<R, A>
R handleUnresolvedSuperGetterIndexPostfixPrefix(
Send node,
Element element,
+ MethodElement setter,
Node index,
IncDecOperator operator,
A arg,
@@ -6490,6 +9683,51 @@ abstract class BaseImplementationOfSuperIncDecsMixin<R, A>
A arg,
{bool isPrefix});
+ R handleUnresolvedSuperIndexPostfixPrefix(
+ Send node,
+ Element element,
+ Node index,
+ IncDecOperator operator,
+ A arg,
+ {bool isPrefix});
+
+ R handleFinalSuperFieldPostfixPrefix(
+ Send node,
+ FieldElement field,
+ IncDecOperator operator,
+ A arg,
+ {bool isPrefix});
+
+ R handleSuperMethodPostfixPrefix(
+ Send node,
+ MethodElement method,
+ IncDecOperator operator,
+ A arg,
+ {bool isPrefix});
+
+ R handleUnresolvedSuperPostfixPrefix(
+ Send node,
+ Element element,
+ IncDecOperator operator,
+ A arg,
+ {bool isPrefix});
+
+ R handleUnresolvedSuperGetterPostfixPrefix(
+ Send node,
+ Element element,
+ MethodElement setter,
+ IncDecOperator operator,
+ A arg,
+ {bool isPrefix});
+
+ R handleUnresolvedSuperSetterPostfixPrefix(
+ Send node,
+ MethodElement getter,
+ Element element,
+ IncDecOperator operator,
+ A arg,
+ {bool isPrefix});
+
@override
R visitSuperFieldFieldPostfix(
Send node,
@@ -6650,22 +9888,24 @@ abstract class BaseImplementationOfSuperIncDecsMixin<R, A>
R visitUnresolvedSuperGetterIndexPostfix(
Send node,
Element element,
+ MethodElement setter,
Node index,
IncDecOperator operator,
A arg) {
return handleUnresolvedSuperGetterIndexPostfixPrefix(
- node, element, index, operator, arg, isPrefix: false);
+ node, element, setter, index, operator, arg, isPrefix: false);
}
@override
R visitUnresolvedSuperGetterIndexPrefix(
Send node,
Element element,
+ MethodElement setter,
Node index,
IncDecOperator operator,
A arg) {
return handleUnresolvedSuperGetterIndexPostfixPrefix(
- node, element, index, operator, arg, isPrefix: true);
+ node, element, setter, index, operator, arg, isPrefix: true);
}
@override
@@ -6691,6 +9931,132 @@ abstract class BaseImplementationOfSuperIncDecsMixin<R, A>
return handleUnresolvedSuperSetterIndexPostfixPrefix(
node, indexFunction, element, index, operator, arg, isPrefix: true);
}
+
+ @override
+ R visitUnresolvedSuperIndexPostfix(
+ Send node,
+ Element element,
+ Node index,
+ IncDecOperator operator,
+ A arg) {
+ return handleUnresolvedSuperIndexPostfixPrefix(
+ node, element, index, operator, arg, isPrefix: false);
+ }
+
+ @override
+ R visitUnresolvedSuperIndexPrefix(
+ Send node,
+ Element element,
+ Node index,
+ IncDecOperator operator,
+ A arg) {
+ return handleUnresolvedSuperIndexPostfixPrefix(
+ node, element, index, operator, arg, isPrefix: true);
+ }
+
+ @override
+ R visitFinalSuperFieldPostfix(
+ Send node,
+ FieldElement field,
+ IncDecOperator operator,
+ A arg) {
+ return handleFinalSuperFieldPostfixPrefix(
+ node, field, operator, arg, isPrefix: false);
+ }
+
+ @override
+ R visitFinalSuperFieldPrefix(
+ Send node,
+ FieldElement field,
+ IncDecOperator operator,
+ A arg) {
+ return handleFinalSuperFieldPostfixPrefix(
+ node, field, operator, arg, isPrefix: true);
+ }
+
+ @override
+ R visitSuperMethodPostfix(
+ Send node,
+ MethodElement method,
+ IncDecOperator operator,
+ A arg) {
+ return handleSuperMethodPostfixPrefix(
+ node, method, operator, arg, isPrefix: false);
+ }
+
+ @override
+ R visitSuperMethodPrefix(
+ Send node,
+ MethodElement method,
+ IncDecOperator operator,
+ A arg) {
+ return handleSuperMethodPostfixPrefix(
+ node, method, operator, arg, isPrefix: true);
+ }
+
+ @override
+ R visitUnresolvedSuperPostfix(
+ Send node,
+ Element element,
+ IncDecOperator operator,
+ A arg) {
+ return handleUnresolvedSuperPostfixPrefix(
+ node, element, operator, arg, isPrefix: false);
+ }
+
+ @override
+ R visitUnresolvedSuperPrefix(
+ Send node,
+ Element element,
+ IncDecOperator operator,
+ A arg) {
+ return handleUnresolvedSuperPostfixPrefix(
+ node, element, operator, arg, isPrefix: true);
+ }
+
+ @override
+ R visitUnresolvedSuperGetterPostfix(
+ Send node,
+ Element element,
+ MethodElement setter,
+ IncDecOperator operator,
+ A arg) {
+ return handleUnresolvedSuperGetterPostfixPrefix(
+ node, element, setter, operator, arg, isPrefix: false);
+ }
+
+ @override
+ R visitUnresolvedSuperGetterPrefix(
+ Send node,
+ Element element,
+ MethodElement setter,
+ IncDecOperator operator,
+ A arg) {
+ return handleUnresolvedSuperGetterPostfixPrefix(
+ node, element, setter, operator, arg, isPrefix: true);
+ }
+
+ @override
+ R visitUnresolvedSuperSetterPostfix(
+ Send node,
+ MethodElement getter,
+ Element element,
+ IncDecOperator operator,
+ A arg) {
+ return handleUnresolvedSuperSetterPostfixPrefix(
+ node, getter, element, operator, arg, isPrefix: false);
+ }
+
+ @override
+ R visitUnresolvedSuperSetterPrefix(
+ Send node,
+ MethodElement getter,
+ Element element,
+ IncDecOperator operator,
+ A arg) {
+ return handleUnresolvedSuperSetterPostfixPrefix(
+ node, getter, element, operator, arg, isPrefix: true);
+ }
}
/// Mixin that groups the non-constant `visitXConstructorInvoke` methods by
@@ -6720,6 +10086,7 @@ abstract class BaseImplementationOfNewMixin<R, A>
node, constructor, type, arguments, callStructure, arg);
}
+ @override
R visitRedirectingGenerativeConstructorInvoke(
NewExpression node,
ConstructorElement constructor,
@@ -6731,6 +10098,7 @@ abstract class BaseImplementationOfNewMixin<R, A>
node, constructor, type, arguments, callStructure, arg);
}
+ @override
R visitFactoryConstructorInvoke(
NewExpression node,
ConstructorElement constructor,
@@ -6742,6 +10110,7 @@ abstract class BaseImplementationOfNewMixin<R, A>
node, constructor, type, arguments, callStructure, arg);
}
+ @override
R visitRedirectingFactoryConstructorInvoke(
NewExpression node,
ConstructorElement constructor,
@@ -6755,6 +10124,7 @@ abstract class BaseImplementationOfNewMixin<R, A>
node, constructor, type, arguments, callStructure, arg);
}
+ @override
R visitUnresolvedConstructorInvoke(
NewExpression node,
Element constructor,
@@ -6766,6 +10136,7 @@ abstract class BaseImplementationOfNewMixin<R, A>
node, constructor, type, arguments, selector.callStructure, arg);
}
+ @override
R visitUnresolvedClassConstructorInvoke(
NewExpression node,
Element element,
@@ -6777,6 +10148,7 @@ abstract class BaseImplementationOfNewMixin<R, A>
node, element, type, arguments, selector.callStructure, arg);
}
+ @override
R visitAbstractClassConstructorInvoke(
NewExpression node,
ConstructorElement constructor,
@@ -6787,6 +10159,8 @@ abstract class BaseImplementationOfNewMixin<R, A>
return handleConstructorInvoke(
node, constructor, type, arguments, callStructure, arg);
}
+
+ @override
R visitUnresolvedRedirectingFactoryConstructorInvoke(
NewExpression node,
ConstructorElement constructor,
« no previous file with comments | « pkg/compiler/lib/src/resolution/semantic_visitor.dart ('k') | pkg/compiler/lib/src/resolution/send_resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698