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

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

Issue 1700203002: Serialize and resynthesize unresolved identifiers. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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/test/src/summary/resynthesize_test.dart
diff --git a/pkg/analyzer/test/src/summary/resynthesize_test.dart b/pkg/analyzer/test/src/summary/resynthesize_test.dart
index 72a8c98a9ed3c55be6dfa8c3b0d1ad636cc2d222..f4e9ebb958ce96505d1ac30da50c4cdc1f267be7 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_test.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_test.dart
@@ -511,8 +511,12 @@ class ResynthTest extends ResolverTestCase {
void compareElements(Element resynthesized, Element original, String desc) {
ElementImpl rImpl = getActualElement(resynthesized, desc);
ElementImpl oImpl = getActualElement(original, desc);
- expect(rImpl.runtimeType, oImpl.runtimeType);
+ if (oImpl == null && rImpl == null) {
+ return;
+ }
+ expect(original, isNotNull);
expect(resynthesized, isNotNull);
+ expect(rImpl.runtimeType, oImpl.runtimeType);
expect(resynthesized.kind, original.kind);
expect(resynthesized.location, original.location, reason: desc);
expect(resynthesized.name, original.name);
@@ -931,7 +935,9 @@ class ResynthTest extends ResolverTestCase {
}
ElementImpl getActualElement(Element element, String desc) {
- if (element is ElementImpl) {
+ if (element == null) {
+ return null;
+ } else if (element is ElementImpl) {
return element;
} else if (element is ElementHandle) {
Element actualElement = element.actualElement;
@@ -1796,6 +1802,37 @@ const vFunctionTypeAlias = p.F;
''');
}
+ test_const_reference_unresolved_prefix0() {
+ checkLibrary(
+ r'''
+const V = foo;
+''',
+ allowErrors: true);
+ }
+
+ test_const_reference_unresolved_prefix1() {
+ checkLibrary(
+ r'''
+class C {}
+const v = C.foo;
+''',
+ allowErrors: true);
+ }
+
+ test_const_reference_unresolved_prefix2() {
+ addLibrarySource(
+ '/foo.dart',
+ '''
+class C {}
+''');
+ checkLibrary(
+ r'''
+import 'foo.dart' as p;
+const v = p.C.foo;
+''',
+ allowErrors: true);
+ }
+
test_const_topLevel_binary() {
checkLibrary(r'''
const vEqual = 1 == 2;
« no previous file with comments | « pkg/analyzer/lib/src/summary/summarize_elements.dart ('k') | pkg/analyzer/test/src/summary/summary_common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698