Chromium Code Reviews| Index: pkg/compiler/lib/src/js_backend/constant_emitter.dart |
| diff --git a/pkg/compiler/lib/src/js_backend/constant_emitter.dart b/pkg/compiler/lib/src/js_backend/constant_emitter.dart |
| index 391a35c269e05bd3975edb96c0924206cd9cf34d..d21083f6624610bc266520fc5c57a194369d3138 100644 |
| --- a/pkg/compiler/lib/src/js_backend/constant_emitter.dart |
| +++ b/pkg/compiler/lib/src/js_backend/constant_emitter.dart |
| @@ -254,6 +254,7 @@ class ConstantEmitter implements ConstantValueVisitor<jsAst.Expression, Null> { |
| jsAst.Expression constructor = |
| backend.emitter.constructorAccess(classElement); |
| jsAst.Expression value = new jsAst.New(constructor, arguments); |
| + // Fix. Add an argument. |
|
Siggi Cherem (dart-lang)
2016/08/19 16:39:46
did you indent to fix this one with this CL too?
|
| return maybeAddTypeArguments(constant.type, value); |
| } |
| @@ -307,8 +308,11 @@ class ConstantEmitter implements ConstantValueVisitor<jsAst.Expression, Null> { |
| element.forEachInstanceField((_, FieldElement field) { |
| fields.add(constantReferenceGenerator(constant.fields[field])); |
| }, includeSuperAndInjectedMembers: true); |
| + if (backend.classNeedsRti(constant.type.element)) { |
| + fields.add(_reifiedTypeArguments(constant.type)); |
| + } |
| jsAst.New instantiation = new jsAst.New(constructor, fields); |
| - return maybeAddTypeArguments(constant.type, instantiation); |
| + return instantiation; |
| } |
| String stripComments(String rawJavaScript) { |
| @@ -320,20 +324,23 @@ class ConstantEmitter implements ConstantValueVisitor<jsAst.Expression, Null> { |
| if (type is InterfaceType && |
| !type.treatAsRaw && |
| backend.classNeedsRti(type.element)) { |
| - InterfaceType interface = type; |
| - RuntimeTypesEncoder rtiEncoder = backend.rtiEncoder; |
| - Iterable<jsAst.Expression> arguments = interface.typeArguments.map( |
| - (DartType type) => |
| - rtiEncoder.getTypeRepresentationWithPlaceholders(type, (_) {})); |
| - jsAst.Expression argumentList = |
| - new jsAst.ArrayInitializer(arguments.toList()); |
| return new jsAst.Call( |
| getHelperProperty(backend.helpers.setRuntimeTypeInfo), |
| - [value, argumentList]); |
| + [value, _reifiedTypeArguments(type)]); |
| } |
| return value; |
| } |
| + jsAst.Expression _reifiedTypeArguments(InterfaceType type) { |
| + RuntimeTypesEncoder rtiEncoder = backend.rtiEncoder; |
| + Iterable<jsAst.Expression> arguments = type.typeArguments.map( |
| + (DartType type) => |
| + rtiEncoder.getTypeRepresentationWithPlaceholders(type, (_) {})); |
| + jsAst.Expression argumentList = |
| + new jsAst.ArrayInitializer(arguments.toList()); |
| + return argumentList; |
| + } |
| + |
| @override |
| jsAst.Expression visitDeferred(DeferredConstantValue constant, [_]) { |
| return constantReferenceGenerator(constant.referenced); |