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

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

Issue 2983413002: Resynthesize constructor initializers from Kernel. (Closed)
Patch Set: Created 3 years, 5 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_common.dart
diff --git a/pkg/analyzer/test/src/summary/resynthesize_common.dart b/pkg/analyzer/test/src/summary/resynthesize_common.dart
index 2c8617a31838aed70c625d5e5d7506e9f0e1210b..79747689a78b76a972b8f2113b90c0911e8f601c 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_common.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_common.dart
@@ -4331,7 +4331,7 @@ class C {
var library = await checkLibrary('''
class C {
final x;
- const A() : x = foo();
+ const C() : x = foo();
}
int foo() => 42;
''', allowErrors: true);
@@ -4383,6 +4383,26 @@ class C extends A {
''');
}
+ test_constructor_initializers_superInvocation_named_underscore() async {
+ var library = await checkLibrary('''
+class A {
+ const A._();
+}
+class B extends A {
+ const B() : super._();
+}
+''');
+ checkElementText(library, r'''
+class A {
+ const A._();
+}
+class B extends A {
+ const B() : super.
+ _/*location: test.dart;A;_*/();
+}
+''');
+ }
+
test_constructor_initializers_superInvocation_namedExpression() async {
var library = await checkLibrary('''
class A {
@@ -4879,7 +4899,24 @@ class D {
D() : x = new C();
}
''');
- checkElementText(library, r'''
+ if (isSharedFrontEnd) {
+ // The shared front-end keeps initializers for cycled constructors.
+ checkElementText(library, r'''
+class C {
+ final dynamic x;
+ C() :
+ x/*location: test.dart;C;x*/ = new
+ D/*location: test.dart;D*/();
+}
+class D {
+ final dynamic x;
+ D() :
+ x/*location: test.dart;D;x*/ = new
+ C/*location: test.dart;C*/();
+}
+''');
+ } else {
+ checkElementText(library, r'''
class C {
final dynamic x;
C();
@@ -4889,6 +4926,7 @@ class D {
D();
}
''');
+ }
}
test_defaultValue_refersToGenericClass_constructor() async {

Powered by Google App Engine
This is Rietveld 408576698