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

Unified Diff: pkg/compiler/lib/src/constants/constant_constructors.dart

Issue 2104843002: Handle fields with initializers in constant constructors. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fix invariants. 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
« no previous file with comments | « pkg/compiler/lib/src/compile_time_constants.dart ('k') | pkg/compiler/lib/src/elements/modelx.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/constants/constant_constructors.dart
diff --git a/pkg/compiler/lib/src/constants/constant_constructors.dart b/pkg/compiler/lib/src/constants/constant_constructors.dart
index 129197f3dd01de426296d5c906755e4828854f42..4628f28629ef34f1e98467950eef14de9372289c 100644
--- a/pkg/compiler/lib/src/constants/constant_constructors.dart
+++ b/pkg/compiler/lib/src/constants/constant_constructors.dart
@@ -87,6 +87,11 @@ class ConstantConstructorComputer extends SemanticVisitor
applyParameters(parameters, _);
ConstructedConstantExpression constructorInvocation =
applyInitializers(node, _);
+ constructor.enclosingClass.forEachInstanceField((_, FieldElement field) {
+ if (!fieldMap.containsKey(field)) {
+ fieldMap[field] = field.constant;
+ }
+ });
return new GenerativeConstantConstructor(
currentClass.thisType, defaultValues, fieldMap, constructorInvocation);
}
« no previous file with comments | « pkg/compiler/lib/src/compile_time_constants.dart ('k') | pkg/compiler/lib/src/elements/modelx.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698