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

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

Issue 2260353002: Remove use of JS templates in reified type information (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 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/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..beae71b502e6686cbadb8c1778a52df00c85d550 100644
--- a/pkg/compiler/lib/src/js_backend/constant_emitter.dart
+++ b/pkg/compiler/lib/src/js_backend/constant_emitter.dart
@@ -320,20 +320,29 @@ 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) {
+ jsAst.Expression unexpected(TypeVariableType variable) {
+ reporter.internalError(
+ NO_LOCATION_SPANNABLE,
+ "Unexpected type variable '${variable.getStringAsDeclared(null)}'"
+ " in constant type '${type.getStringAsDeclared(null)}'");
+ return null;
+ }
+ List<jsAst.Expression> arguments = <jsAst.Expression>[];
+ RuntimeTypesEncoder rtiEncoder = backend.rtiEncoder;
+ for (DartType argument in type.typeArguments) {
+ arguments.add(rtiEncoder.getTypeRepresentation(argument, unexpected));
+ }
+ return new jsAst.ArrayInitializer(arguments);
+ }
+
@override
jsAst.Expression visitDeferred(DeferredConstantValue constant, [_]) {
return constantReferenceGenerator(constant.referenced);
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_backend/runtime_types.dart » ('j') | pkg/compiler/lib/src/js_backend/runtime_types.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698