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

Unified Diff: pkg/compiler/lib/src/resolution/resolution.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
Index: pkg/compiler/lib/src/resolution/resolution.dart
diff --git a/pkg/compiler/lib/src/resolution/resolution.dart b/pkg/compiler/lib/src/resolution/resolution.dart
index 05e1cf08270a8adf530cfb01eb1b98806ccbd360..f77519078554fdd3435b4a9270104b57fe86c583 100644
--- a/pkg/compiler/lib/src/resolution/resolution.dart
+++ b/pkg/compiler/lib/src/resolution/resolution.dart
@@ -53,6 +53,7 @@ import 'class_members.dart' show MembersCreator;
import 'constructors.dart';
import 'members.dart';
import 'registry.dart';
+import 'resolution_result.dart';
import 'scope.dart' show MutableScope;
import 'signatures.dart';
import 'tree_elements.dart';
@@ -387,7 +388,10 @@ class ResolverTask extends CompilerTask {
if (initializer != null) {
// TODO(johnniwinther): Avoid analyzing initializers if
// [Compiler.analyzeSignaturesOnly] is set.
- visitor.visit(initializer);
+ ResolutionResult result = visitor.visit(initializer);
+ if (result.isConstant) {
+ element.constant = result.constant;
+ }
} else if (modifiers.isConst) {
reporter.reportErrorMessage(
element, MessageKind.CONST_WITHOUT_INITIALIZER);
« no previous file with comments | « pkg/compiler/lib/src/resolution/constructors.dart ('k') | tests/compiler/dart2js/constant_expression_evaluate_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698