Chromium Code Reviews| 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..22395eef6e05f294bd33ec65550e7e78bb6624ed 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; |
| @@ -628,7 +628,7 @@ class TypeRepresentationGenerator extends DartTypeVisitor { |
| this.onVariable = onVariable; |
| this.shouldEncodeTypedef = |
| (encodeTypedef != null) ? encodeTypedef : (TypedefType type) => false; |
| - jsAst.Expression representation = visit(type); |
| + jsAst.Expression representation = apply(type); |
| this.onVariable = null; |
| this.shouldEncodeTypedef = null; |
| return representation; |
| @@ -638,9 +638,8 @@ class TypeRepresentationGenerator extends DartTypeVisitor { |
| return backend.emitter.typeAccess(element); |
| } |
| - visit(DartType type) { |
| - return type.accept(this, null); |
| - } |
| + @override |
| + apply(DartType type, [_]) => type.accept(this, null); |
|
floitsch
2015/04/21 13:10:34
visit
Johnni Winther
2015/04/21 13:37:05
Done.
|
| visitTypeVariableType(TypeVariableType type, _) { |
| return onVariable(type); |
| @@ -663,7 +662,7 @@ class TypeRepresentationGenerator extends DartTypeVisitor { |
| index++; |
| } |
| for (DartType type in types) { |
| - jsAst.Expression element = visit(type); |
| + jsAst.Expression element = apply(type); |
| if (element is jsAst.LiteralNull) { |
| elements.add(new jsAst.ArrayHole()); |
| } else { |
| @@ -686,7 +685,7 @@ class TypeRepresentationGenerator extends DartTypeVisitor { |
| if (type.returnType.isVoid) { |
| addProperty(namer.functionTypeVoidReturnTag, js('true')); |
| } else if (!type.returnType.treatAsDynamic) { |
| - addProperty(namer.functionTypeReturnTypeTag, visit(type.returnType)); |
| + addProperty(namer.functionTypeReturnTypeTag, apply(type.returnType)); |
| } |
| if (!type.parameterTypes.isEmpty) { |
| addProperty(namer.functionTypeRequiredParametersTag, |
| @@ -703,7 +702,7 @@ class TypeRepresentationGenerator extends DartTypeVisitor { |
| assert(types.length == names.length); |
| for (int index = 0; index < types.length; index++) { |
| jsAst.Expression name = js.string(names[index]); |
| - namedArguments.add(new jsAst.Property(name, visit(types[index]))); |
| + namedArguments.add(new jsAst.Property(name, apply(types[index]))); |
| } |
| addProperty(namer.functionTypeNamedParametersTag, |
| new jsAst.ObjectInitializer(namedArguments)); |
| @@ -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); |
| + apply(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); |
| + apply(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); |
| + apply(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) { |
| + apply(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); |
| } |