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

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

Issue 1559233002: WIP: Compute constant expressions in resolution. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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 5b87b15b7854b9530c326d914669e032382792f6..c480ae0f198424a8b3d6d84b19631760b0ed9e70 100644
--- a/pkg/compiler/lib/src/js_backend/constant_emitter.dart
+++ b/pkg/compiler/lib/src/js_backend/constant_emitter.dart
@@ -66,6 +66,11 @@ class ConstantEmitter
return new jsAst.LiteralNull();
}
+ @override
+ jsAst.Expression visitNonConstant(NonConstantValue constant, [_]) {
+ return new jsAst.LiteralNull();
+ }
+
static final _exponentialRE = new RegExp(
'^'
'\([-+]?\)' // 1: sign
@@ -292,9 +297,11 @@ class ConstantEmitter
}
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>[];
+ constant.type.element.implementation.forEachInstanceField(
+ (ClassElement enclosingClass, VariableElement member) {
+ fields.add(constantReferenceGenerator(constant.fields[member]));
+ }, includeSuperAndInjectedMembers: true);
jsAst.New instantiation = new jsAst.New(constructor, fields);
return maybeAddTypeArguments(constant.type, instantiation);
}
« no previous file with comments | « pkg/compiler/lib/src/elements/modelx.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