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

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

Issue 2847213002: Synthetic function elements don't have a name or enclosing element/library. (Closed)
Patch Set: Created 3 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 | « no previous file | pkg/front_end/testcases/inference/generic_methods_uses_greatest_lower_bound.dart » ('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 2b30ed75748961fffb2935d3f315695fcea18b95..9e8301744a20eda82ef50556cf92de5436916fc2 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
@@ -119,16 +119,18 @@ class _InstrumentationValueForType extends fasta.InstrumentationValue {
}
void _appendElementName(StringBuffer buffer, Element element) {
- String name = element.name ?? '';
- if (element.library == null) {
- // TODO(scheglov) This is wrong - every element must be in a library.
- buffer.write('<unknown>::$name');
+ // Synthetic FunctionElement(s) don't have a name or enclosing library.
+ if (element.isSynthetic && element is FunctionElement) {
return;
}
- String libraryName = element.library.name;
- if (libraryName == '') {
- throw new StateError('The element $name must be in a named library.');
+
+ LibraryElement library = element.library;
+ if (library == null) {
+ throw new StateError('Unexpected element without library: $element');
}
+ String libraryName = library.name;
+
+ String name = element.name ?? '';
if (libraryName != 'dart.core' &&
libraryName != 'dart.async' &&
libraryName != 'test') {
« no previous file with comments | « no previous file | pkg/front_end/testcases/inference/generic_methods_uses_greatest_lower_bound.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698