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

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

Issue 2310573002: dart2js: Pass type information to constructor rather than add later. (Closed)
Patch Set: Filter out type info pseudofield when parsing fieldspec for mirrors Created 4 years, 3 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 c922d4d7763577ccd791471cf1052c4f2a828493..e30ef91bc4d213699020c50008785c3171918a69 100644
--- a/pkg/compiler/lib/src/js_backend/constant_emitter.dart
+++ b/pkg/compiler/lib/src/js_backend/constant_emitter.dart
@@ -251,10 +251,14 @@ class ConstantEmitter implements ConstantValueVisitor<jsAst.Expression, Null> {
"Compiler and ${className} disagree on number of fields.");
}
+ if (backend.classNeedsRtiField(classElement)) {
+ arguments.add(_reifiedTypeArguments(constant.type));
+ }
+
jsAst.Expression constructor =
backend.emitter.constructorAccess(classElement);
jsAst.Expression value = new jsAst.New(constructor, arguments);
- return maybeAddTypeArguments(constant.type, value);
+ return value;
}
JavaScriptBackend get backend => compiler.backend;
@@ -307,6 +311,9 @@ class ConstantEmitter implements ConstantValueVisitor<jsAst.Expression, Null> {
element.forEachInstanceField((_, FieldElement field) {
fields.add(constantReferenceGenerator(constant.fields[field]));
}, includeSuperAndInjectedMembers: true);
+ if (backend.classNeedsRtiField(constant.type.element)) {
+ fields.add(_reifiedTypeArguments(constant.type));
+ }
jsAst.New instantiation = new jsAst.New(constructor, fields);
return maybeAddTypeArguments(constant.type, instantiation);
}
« no previous file with comments | « pkg/compiler/lib/src/js_backend/backend.dart ('k') | pkg/compiler/lib/src/js_emitter/class_stub_generator.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698