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

Side by Side Diff: pkg/analyzer/lib/src/summary/summary_sdk.dart

Issue 1927323002: Implement stable resolution of generic types without type arguments to their bounds. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Merge and regenerate the task graph. Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analyzer.src.summary.summary_sdk; 5 library analyzer.src.summary.summary_sdk;
6 6
7 import 'package:analyzer/dart/element/element.dart'; 7 import 'package:analyzer/dart/element/element.dart';
8 import 'package:analyzer/dart/element/type.dart'; 8 import 'package:analyzer/dart/element/type.dart';
9 import 'package:analyzer/src/context/cache.dart' show CacheEntry; 9 import 'package:analyzer/src/context/cache.dart' show CacheEntry;
10 import 'package:analyzer/src/context/context.dart'; 10 import 'package:analyzer/src/context/context.dart';
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 } 58 }
59 if (target is Source) { 59 if (target is Source) {
60 if (result == LIBRARY_ELEMENT1 || 60 if (result == LIBRARY_ELEMENT1 ||
61 result == LIBRARY_ELEMENT2 || 61 result == LIBRARY_ELEMENT2 ||
62 result == LIBRARY_ELEMENT3 || 62 result == LIBRARY_ELEMENT3 ||
63 result == LIBRARY_ELEMENT4 || 63 result == LIBRARY_ELEMENT4 ||
64 result == LIBRARY_ELEMENT5 || 64 result == LIBRARY_ELEMENT5 ||
65 result == LIBRARY_ELEMENT6 || 65 result == LIBRARY_ELEMENT6 ||
66 result == LIBRARY_ELEMENT7 || 66 result == LIBRARY_ELEMENT7 ||
67 result == LIBRARY_ELEMENT8 || 67 result == LIBRARY_ELEMENT8 ||
68 result == LIBRARY_ELEMENT9 ||
68 result == LIBRARY_ELEMENT) { 69 result == LIBRARY_ELEMENT) {
69 // TODO(scheglov) try to find a way to avoid listing every result 70 // TODO(scheglov) try to find a way to avoid listing every result
70 // e.g. "result.whenComplete == LIBRARY_ELEMENT" 71 // e.g. "result.whenComplete == LIBRARY_ELEMENT"
71 String uri = target.uri.toString(); 72 String uri = target.uri.toString();
72 LibraryElement libraryElement = resynthesizer.getLibraryElement(uri); 73 LibraryElement libraryElement = resynthesizer.getLibraryElement(uri);
73 entry.setValue(result, libraryElement, TargetedResult.EMPTY_LIST); 74 entry.setValue(result, libraryElement, TargetedResult.EMPTY_LIST);
74 return true; 75 return true;
75 } else if (result == READY_LIBRARY_ELEMENT2 || 76 } else if (result == READY_LIBRARY_ELEMENT2 ||
76 result == READY_LIBRARY_ELEMENT5 || 77 result == READY_LIBRARY_ELEMENT6 ||
77 result == READY_LIBRARY_ELEMENT6) { 78 result == READY_LIBRARY_ELEMENT7) {
78 entry.setValue(result, true, TargetedResult.EMPTY_LIST); 79 entry.setValue(result, true, TargetedResult.EMPTY_LIST);
79 return true; 80 return true;
80 } else if (result == SOURCE_KIND) { 81 } else if (result == SOURCE_KIND) {
81 String uri = target.uri.toString(); 82 String uri = target.uri.toString();
82 SourceKind kind = _getSourceKind(uri); 83 SourceKind kind = _getSourceKind(uri);
83 if (kind != null) { 84 if (kind != null) {
84 entry.setValue(result, kind, TargetedResult.EMPTY_LIST); 85 entry.setValue(result, kind, TargetedResult.EMPTY_LIST);
85 return true; 86 return true;
86 } 87 }
87 return false; 88 return false;
88 } else { 89 } else {
89 // throw new UnimplementedError('$result of $target'); 90 // throw new UnimplementedError('$result of $target');
90 } 91 }
91 } 92 }
92 if (target is LibrarySpecificUnit) { 93 if (target is LibrarySpecificUnit) {
93 if (target.library == null || !target.library.isInSystemLibrary) { 94 if (target.library == null || !target.library.isInSystemLibrary) {
94 return false; 95 return false;
95 } 96 }
96 if (result == CREATED_RESOLVED_UNIT1 || 97 if (result == CREATED_RESOLVED_UNIT1 ||
97 result == CREATED_RESOLVED_UNIT2 || 98 result == CREATED_RESOLVED_UNIT2 ||
98 result == CREATED_RESOLVED_UNIT3 || 99 result == CREATED_RESOLVED_UNIT3 ||
99 result == CREATED_RESOLVED_UNIT4 || 100 result == CREATED_RESOLVED_UNIT4 ||
100 result == CREATED_RESOLVED_UNIT5 || 101 result == CREATED_RESOLVED_UNIT5 ||
101 result == CREATED_RESOLVED_UNIT6 || 102 result == CREATED_RESOLVED_UNIT6 ||
102 result == CREATED_RESOLVED_UNIT7 || 103 result == CREATED_RESOLVED_UNIT7 ||
103 result == CREATED_RESOLVED_UNIT8 || 104 result == CREATED_RESOLVED_UNIT8 ||
104 result == CREATED_RESOLVED_UNIT9 || 105 result == CREATED_RESOLVED_UNIT9 ||
105 result == CREATED_RESOLVED_UNIT10) { 106 result == CREATED_RESOLVED_UNIT10 ||
107 result == CREATED_RESOLVED_UNIT11) {
106 entry.setValue(result, true, TargetedResult.EMPTY_LIST); 108 entry.setValue(result, true, TargetedResult.EMPTY_LIST);
107 return true; 109 return true;
108 } 110 }
109 if (result == COMPILATION_UNIT_ELEMENT) { 111 if (result == COMPILATION_UNIT_ELEMENT) {
110 String libraryUri = target.library.uri.toString(); 112 String libraryUri = target.library.uri.toString();
111 String unitUri = target.unit.uri.toString(); 113 String unitUri = target.unit.uri.toString();
112 CompilationUnitElement unit = resynthesizer.getElement( 114 CompilationUnitElement unit = resynthesizer.getElement(
113 new ElementLocationImpl.con3(<String>[libraryUri, unitUri])); 115 new ElementLocationImpl.con3(<String>[libraryUri, unitUri]));
114 if (unit != null) { 116 if (unit != null) {
115 entry.setValue(result, unit, TargetedResult.EMPTY_LIST); 117 entry.setValue(result, unit, TargetedResult.EMPTY_LIST);
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 * throw a [StateError] if there is no class with the given name. 421 * throw a [StateError] if there is no class with the given name.
420 */ 422 */
421 InterfaceType _getType(LibraryElement library, String name) { 423 InterfaceType _getType(LibraryElement library, String name) {
422 Element element = library.getType(name); 424 Element element = library.getType(name);
423 if (element == null) { 425 if (element == null) {
424 throw new StateError("No definition of type $name"); 426 throw new StateError("No definition of type $name");
425 } 427 }
426 return (element as ClassElement).type; 428 return (element as ClassElement).type;
427 } 429 }
428 } 430 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/package_bundle_reader.dart ('k') | pkg/analyzer/lib/src/task/dart.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698