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

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

Issue 1904543002: Implement FunctionElementForLink_FunctionTypedParam.parameters. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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') | pkg/analyzer/test/src/summary/resynthesize_ast_test.dart » ('j') | 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 e80e14f0850416b7ac16f4cabe73155c1ce2ed63..e5f0dfabb287a049466d3c4338fe1b7bcb410b36 100644
--- a/pkg/analyzer/test/src/summary/linker_test.dart
+++ b/pkg/analyzer/test/src/summary/linker_test.dart
@@ -2,6 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/src/summary/format.dart';
import 'package:analyzer/src/summary/link.dart';
import 'package:unittest/unittest.dart';
@@ -66,6 +67,20 @@ class C<T> extends B<T> {
// No assertions--just make sure it doesn't crash.
}
+ void test_baseClass_genericWithFunctionTypedParameter() {
+ createLinker('''
+class B<T> {
+ void f(void g(T t));
+}
+class C<U> extends B<U> {
+ void f(g) {}
+}
+''');
+ LibraryElementForLink library = linker.getLibrary(linkerInputs.testDartUri);
+ library.libraryCycleForLink.ensureLinked();
+ // No assertions--just make sure it doesn't crash.
+ }
+
void test_baseClass_genericWithGenericMethod() {
createLinker('''
class B<T> {
@@ -540,4 +555,32 @@ class D extends C {
library.libraryCycleForLink.ensureLinked();
// No assertions--just make sure it doesn't crash.
}
+
+ void test_parameterParentElementForLink_implicitFunctionTypeIndices() {
+ createLinker('void f(a, void g(b, c, d, void h())) {}');
+ TopLevelFunctionElementForLink f = testLibrary.getContainedName('f');
+ expect(f.implicitFunctionTypeIndices, []);
+ ParameterElementForLink g = f.parameters[1];
+ FunctionType gType = g.type;
+ FunctionElementForLink_FunctionTypedParam gTypeElement = gType.element;
+ expect(gTypeElement.implicitFunctionTypeIndices, [1]);
+ ParameterElementForLink h = gTypeElement.parameters[3];
+ FunctionType hType = h.type;
+ FunctionElementForLink_FunctionTypedParam hTypeElement = hType.element;
+ expect(hTypeElement.implicitFunctionTypeIndices, [1, 3]);
+ }
+
+ void test_parameterParentElementForLink_innermostExecutable() {
+ createLinker('void f(void g(void h())) {}');
+ TopLevelFunctionElementForLink f = testLibrary.getContainedName('f');
+ expect(f.innermostExecutable, same(f));
+ ParameterElementForLink g = f.parameters[0];
+ FunctionType gType = g.type;
+ FunctionElementForLink_FunctionTypedParam gTypeElement = gType.element;
+ expect(gTypeElement.innermostExecutable, same(f));
+ ParameterElementForLink h = gTypeElement.parameters[0];
+ FunctionType hType = h.type;
+ FunctionElementForLink_FunctionTypedParam hTypeElement = hType.element;
+ expect(hTypeElement.innermostExecutable, same(f));
+ }
}
« no previous file with comments | « pkg/analyzer/lib/src/summary/link.dart ('k') | pkg/analyzer/test/src/summary/resynthesize_ast_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698