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

Unified Diff: pkg/analyzer/test/src/summary/linker_test.dart

Issue 1994673003: Fix generation of variable initializer synthetic functions in summary AST linker. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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/analyzer/lib/src/summary/link.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/summary/linker_test.dart
diff --git a/pkg/analyzer/test/src/summary/linker_test.dart b/pkg/analyzer/test/src/summary/linker_test.dart
index 1512f75192192119688b88783adc8af6e1f93823..6dba3ebe312348d0d42a1188b07017b57a03aea7 100644
--- a/pkg/analyzer/test/src/summary/linker_test.dart
+++ b/pkg/analyzer/test/src/summary/linker_test.dart
@@ -723,4 +723,25 @@ class D extends C {
expect(d.isTypeParameterInScope(t), false);
expect(d.isTypeParameterInScope(u), false);
}
+
+ void test_variable_initializer_presence() {
+ // Any variable declaration with an initializer should have a non-null value
+ // for `initializer`, regardless of whether it is constant and regardless of
+ // whether it has an explicit type.
+ createLinker('''
+const int c = 0;
+int i = 0;
+int j;
+var v = 0;
+''');
+ LibraryElementForLink library = linker.getLibrary(linkerInputs.testDartUri);
+ PropertyAccessorElementForLink_Variable c = library.getContainedName('c');
+ expect(c.variable.initializer, isNotNull);
+ PropertyAccessorElementForLink_Variable i = library.getContainedName('i');
+ expect(i.variable.initializer, isNotNull);
+ PropertyAccessorElementForLink_Variable j = library.getContainedName('j');
+ expect(j.variable.initializer, isNull);
+ PropertyAccessorElementForLink_Variable v = library.getContainedName('v');
+ expect(v.variable.initializer, isNotNull);
+ }
}
« no previous file with comments | « pkg/analyzer/lib/src/summary/link.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698