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

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

Issue 2072223002: Enforce use of the forEachInstanceField ordering for constructed constants. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Remove tab Created 4 years, 6 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 e88d927fdb8f4c819941282cc2f2106576f21723..eba60d909afa435a26f701e80e7717659c0b9b2a 100644
--- a/pkg/compiler/lib/src/js_backend/constant_emitter.dart
+++ b/pkg/compiler/lib/src/js_backend/constant_emitter.dart
@@ -285,7 +285,7 @@ class ConstantEmitter implements ConstantValueVisitor<jsAst.Expression, Null> {
@override
jsAst.Expression visitConstructed(ConstructedConstantValue constant, [_]) {
- Element element = constant.type.element;
+ ClassElement element = constant.type.element;
if (backend.isForeign(element) && element.name == 'JS_CONST') {
StringConstantValue str = constant.fields.values.single;
String value = str.primitiveValue.slowToString();
@@ -293,9 +293,10 @@ class ConstantEmitter implements ConstantValueVisitor<jsAst.Expression, Null> {
}
jsAst.Expression constructor =
backend.emitter.constructorAccess(constant.type.element);
- List<jsAst.Expression> fields = constant.fields.values
- .map(constantReferenceGenerator)
- .toList(growable: false);
+ List<jsAst.Expression> fields = <jsAst.Expression>[];
+ element.forEachInstanceField((_, FieldElement field) {
+ fields.add(constantReferenceGenerator(constant.fields[field]));
+ }, includeSuperAndInjectedMembers: true);
jsAst.New instantiation = new jsAst.New(constructor, fields);
return maybeAddTypeArguments(constant.type, instantiation);
}
« no previous file with comments | « pkg/compiler/lib/src/constants/values.dart ('k') | pkg/compiler/lib/src/js_backend/constant_handler_javascript.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698