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

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

Issue 2080183002: Revert "Enforce use of the forEachInstanceField ordering for constructed constants." (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: 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 85f06e8d48a13c330371c5ead7cbecad11c4a2c0..e88d927fdb8f4c819941282cc2f2106576f21723 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, [_]) {
- ClassElement element = constant.type.element;
+ Element element = constant.type.element;
if (backend.isForeign(element) && element.name == 'JS_CONST') {
StringConstantValue str = constant.fields.values.single;
String value = str.primitiveValue.slowToString();
@@ -293,10 +293,9 @@ class ConstantEmitter implements ConstantValueVisitor<jsAst.Expression, Null> {
}
jsAst.Expression constructor =
backend.emitter.constructorAccess(constant.type.element);
- List<jsAst.Expression> fields = <jsAst.Expression>[];
- element.forEachInstanceField((_, FieldElement field) {
- fields.add(constantReferenceGenerator(constant.fields[field]));
- });
+ List<jsAst.Expression> fields = constant.fields.values
+ .map(constantReferenceGenerator)
+ .toList(growable: false);
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