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

Unified Diff: pkg/analyzer/test/src/task/strong/front_end_inference_test.dart

Issue 2918373003: Improve annotation of type variables in type inference tests. (Closed)
Patch Set: Created 3 years, 6 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 | « no previous file | pkg/front_end/test/fasta/strong.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/task/strong/front_end_inference_test.dart
diff --git a/pkg/analyzer/test/src/task/strong/front_end_inference_test.dart b/pkg/analyzer/test/src/task/strong/front_end_inference_test.dart
index a350b5bb6d89cc721117e29a4d2dcdfc8aea28e3..9a75d364e9aee3c50e6f601bca8518005e022023 100644
--- a/pkg/analyzer/test/src/task/strong/front_end_inference_test.dart
+++ b/pkg/analyzer/test/src/task/strong/front_end_inference_test.dart
@@ -96,37 +96,36 @@ class _ElementNamer {
return;
}
- LibraryElement library = element.library;
- if (library == null) {
- throw new StateError('Unexpected element without library: $element');
+ var enclosing = element.enclosingElement;
+ if (enclosing is CompilationUnitElement) {
+ enclosing = enclosing.enclosingElement;
+ } else if (enclosing is ClassElement &&
+ currentFactoryConstructor != null &&
+ identical(enclosing, currentFactoryConstructor.enclosingElement) &&
+ element is TypeParameterElement) {
+ enclosing = currentFactoryConstructor;
+ }
+ if (enclosing != null) {
+ if (enclosing is LibraryElement &&
+ (enclosing.name == 'dart.core' ||
+ enclosing.name == 'dart.async' ||
+ enclosing.name == 'test')) {
+ // For brevity, omit library name
+ } else {
+ appendElementName(buffer, enclosing);
+ buffer.write('::');
+ }
}
- String libraryName = library.name;
String name = element.name ?? '';
- if (name.endsWith('=') &&
+ if (element is ConstructorElement && name == '') {
+ name = '•';
+ } else if (name.endsWith('=') &&
element is PropertyAccessorElement &&
element.isSetter) {
name = name.substring(0, name.length - 1);
}
- if (libraryName != 'dart.core' &&
- libraryName != 'dart.async' &&
- libraryName != 'test') {
- buffer.write('$libraryName::');
- }
- var enclosing = element.enclosingElement;
- if (enclosing is ClassElement) {
- buffer.write('${enclosing.name}::');
- if (currentFactoryConstructor != null &&
- identical(enclosing, currentFactoryConstructor.enclosingElement) &&
- element is TypeParameterElement) {
- String factoryConstructorName = currentFactoryConstructor.name;
- if (factoryConstructorName == '') {
- factoryConstructorName = '•';
- }
- buffer.write('$factoryConstructorName::');
- }
- }
- buffer.write('$name');
+ buffer.write(name);
}
}
« no previous file with comments | « no previous file | pkg/front_end/test/fasta/strong.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698