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

Unified Diff: pkg/compiler/lib/src/js_backend/runtime_types.dart

Issue 1093363002: Refactor DartTypeVisitor and ElementVisitor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments Created 5 years, 8 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
« no previous file with comments | « pkg/compiler/lib/src/js_backend/namer.dart ('k') | pkg/compiler/lib/src/resolution/members.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_backend/runtime_types.dart
diff --git a/pkg/compiler/lib/src/js_backend/runtime_types.dart b/pkg/compiler/lib/src/js_backend/runtime_types.dart
index 349905aeaad67b8ec99d4e83f90d705aac0f3381..cd89c02d1578a487d31484401cd991f621b1a1ef 100644
--- a/pkg/compiler/lib/src/js_backend/runtime_types.dart
+++ b/pkg/compiler/lib/src/js_backend/runtime_types.dart
@@ -607,7 +607,7 @@ class RuntimeTypes {
}
}
-class TypeRepresentationGenerator extends DartTypeVisitor {
+class TypeRepresentationGenerator implements DartTypeVisitor {
final Compiler compiler;
OnVariableCallback onVariable;
ShouldEncodeTypedefCallback shouldEncodeTypedef;
@@ -638,9 +638,8 @@ class TypeRepresentationGenerator extends DartTypeVisitor {
return backend.emitter.typeAccess(element);
}
- visit(DartType type) {
- return type.accept(this, null);
- }
+ @override
+ visit(DartType type, [_]) => type.accept(this, null);
visitTypeVariableType(TypeVariableType type, _) {
return onVariable(type);
@@ -740,7 +739,7 @@ class TypeRepresentationGenerator extends DartTypeVisitor {
}
}
- visitType(DartType type, _) {
+ visitStatementType(StatementType type, _) {
compiler.internalError(NO_LOCATION_SPANNABLE,
'Unexpected type: $type (${type.kind}).');
}
@@ -781,25 +780,17 @@ class ArgumentCollector extends DartTypeVisitor {
ArgumentCollector(this.backend);
collect(DartType type, {bool isTypeArgument: false}) {
- type.accept(this, isTypeArgument);
+ visit(type, isTypeArgument);
}
/// Collect all types in the list as if they were arguments of an
/// InterfaceType.
collectAll(List<DartType> types) {
for (DartType type in types) {
- type.accept(this, true);
+ visit(type, true);
}
}
- visitType(DartType type, _) {
- // Do nothing.
- }
-
- visitDynamicType(DynamicType type, _) {
- // Do not collect [:dynamic:].
- }
-
visitTypedefType(TypedefType type, bool isTypeArgument) {
type.unalias(backend.compiler).accept(this, isTypeArgument);
}
@@ -821,25 +812,17 @@ class FunctionArgumentCollector extends DartTypeVisitor {
FunctionArgumentCollector(this.backend);
collect(DartType type) {
- type.accept(this, false);
+ visit(type, false);
}
/// Collect all types in the list as if they were arguments of an
/// InterfaceType.
collectAll(Link<DartType> types) {
- for (Link<DartType> link = types; !link.isEmpty; link = link.tail) {
- link.head.accept(this, true);
+ for (DartType type in types) {
+ visit(type, true);
}
}
- visitType(DartType type, _) {
- // Do nothing.
- }
-
- visitDynamicType(DynamicType type, _) {
- // Do not collect [:dynamic:].
- }
-
visitTypedefType(TypedefType type, bool inFunctionType) {
type.unalias(backend.compiler).accept(this, inFunctionType);
}
« no previous file with comments | « pkg/compiler/lib/src/js_backend/namer.dart ('k') | pkg/compiler/lib/src/resolution/members.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698