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

Unified Diff: pkg/analyzer/lib/src/generated/testing/element_factory.dart

Issue 1602203004: Serialize constant initializers. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Add new summarize_const_expr.dart file. 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/analyzer/lib/src/generated/testing/element_factory.dart
diff --git a/pkg/analyzer/lib/src/generated/testing/element_factory.dart b/pkg/analyzer/lib/src/generated/testing/element_factory.dart
index df416033e9c4ec634366a0450fd501124e902b18..a789ff0fe1005509bd5762e7844134203129558c 100644
--- a/pkg/analyzer/lib/src/generated/testing/element_factory.dart
+++ b/pkg/analyzer/lib/src/generated/testing/element_factory.dart
@@ -559,8 +559,12 @@ class ElementFactory {
if (isConst) {
ConstTopLevelVariableElementImpl constant =
new ConstTopLevelVariableElementImpl(AstFactory.identifier3(name));
- constant.constantInitializer = AstFactory.instanceCreationExpression2(
+ InstanceCreationExpression initializer = AstFactory.instanceCreationExpression2(
Keyword.CONST, AstFactory.typeName(type.element));
+ if (type is InterfaceType) {
+ initializer.staticElement = type.element.unnamedConstructor;
+ }
+ constant.constantInitializer = initializer;
variable = constant;
} else {
variable = new TopLevelVariableElementImpl(name, -1);

Powered by Google App Engine
This is Rietveld 408576698