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

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

Issue 1686713002: Add support for redirectedConstructor to summaries. (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
« no previous file with comments | « pkg/analyzer/test/src/summary/resynthesize_test.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/summary_common.dart
diff --git a/pkg/analyzer/test/src/summary/summary_common.dart b/pkg/analyzer/test/src/summary/summary_common.dart
index 0108c63a19758fd40ce19797602908f50e1e2ba4..2173c3bee0270da5a701a6bcd2cdf07d59f57c41 100644
--- a/pkg/analyzer/test/src/summary/summary_common.dart
+++ b/pkg/analyzer/test/src/summary/summary_common.dart
@@ -2746,6 +2746,9 @@ class C<T> {
expect(executable.returnType, isNull);
expect(executable.isExternal, isFalse);
expect(executable.nameOffset, text.indexOf('C();'));
+ expect(executable.isRedirectedConstructor, isFalse);
+ expect(executable.redirectedConstructor, isNull);
+ expect(executable.redirectedConstructorName, isEmpty);
}
test_constructor_anonymous() {
@@ -3162,6 +3165,76 @@ class C {
expect(ctor.parameters[0].inferredTypeSlot, 0);
}
+ test_constructor_redirected_factory_named() {
+ String text = '''
+class C {
+ factory C() = D.named;
+ C._();
+}
+class D extends C {
+ D.named() : super._();
+}
+''';
+ UnlinkedExecutable executable =
+ serializeClassText(text, className: 'C').executables[0];
+ expect(executable.isRedirectedConstructor, isTrue);
+ expect(executable.isFactory, isTrue);
+ expect(executable.redirectedConstructorName, isEmpty);
+ checkTypeRef(executable.redirectedConstructor, null, null, 'named',
+ expectedKind: ReferenceKind.constructor,
+ prefixExpectations: [
+ new _PrefixExpectation(ReferenceKind.classOrEnum, 'D')
+ ]);
+ }
+
+ test_constructor_redirected_factory_unnamed() {
+ String text = '''
+class C {
+ factory C() = D;
+ C._();
+}
+class D extends C {
+ D() : super._();
+}
+''';
+ UnlinkedExecutable executable =
+ serializeClassText(text, className: 'C').executables[0];
+ expect(executable.isRedirectedConstructor, isTrue);
+ expect(executable.isFactory, isTrue);
+ expect(executable.redirectedConstructorName, isEmpty);
+ checkTypeRef(executable.redirectedConstructor, null, null, 'D');
+ }
+
+ test_constructor_redirected_thisInvocation_named() {
+ String text = '''
+class C {
+ C() : this.named();
+ C.named();
+}
+''';
+ UnlinkedExecutable executable =
+ serializeClassText(text, className: 'C').executables[0];
+ expect(executable.isRedirectedConstructor, isTrue);
+ expect(executable.isFactory, isFalse);
+ expect(executable.redirectedConstructorName, 'named');
+ expect(executable.redirectedConstructor, isNull);
+ }
+
+ test_constructor_redirected_thisInvocation_unnamed() {
+ String text = '''
+class C {
+ C.named() : this();
+ C();
+}
+''';
+ UnlinkedExecutable executable =
+ serializeClassText(text, className: 'C').executables[0];
+ expect(executable.isRedirectedConstructor, isTrue);
+ expect(executable.isFactory, isFalse);
+ expect(executable.redirectedConstructorName, isEmpty);
+ expect(executable.redirectedConstructor, isNull);
+ }
+
test_constructor_return_type() {
UnlinkedExecutable executable = findExecutable('',
executables: serializeClassText('class C { C(); }').executables);
« no previous file with comments | « pkg/analyzer/test/src/summary/resynthesize_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698