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

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

Issue 2252183002: Fix calling object methods and properties on function types (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix calling object methods and properties on function types Created 4 years, 4 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/file_system/file_system.dart' show ResourceProvider; 9 import 'package:analyzer/file_system/file_system.dart' show ResourceProvider;
10 import 'package:analyzer/src/context/cache.dart' show CacheEntry; 10 import 'package:analyzer/src/context/cache.dart' show CacheEntry;
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 Source mapDartUri(String uriStr) { 182 Source mapDartUri(String uriStr) {
183 Uri uri = Uri.parse(uriStr); 183 Uri uri = Uri.parse(uriStr);
184 return _uriResolver.resolveAbsolute(uri); 184 return _uriResolver.resolveAbsolute(uri);
185 } 185 }
186 } 186 }
187 187
188 /** 188 /**
189 * Implementation of [TypeProvider] which can be initialized separately with 189 * Implementation of [TypeProvider] which can be initialized separately with
190 * `dart:core` and `dart:async` libraries. 190 * `dart:core` and `dart:async` libraries.
191 */ 191 */
192 class SummaryTypeProvider implements TypeProvider { 192 class SummaryTypeProvider extends Object
193 with TypeProviderBaseMixin
194 implements TypeProvider {
193 LibraryElement _coreLibrary; 195 LibraryElement _coreLibrary;
194 LibraryElement _asyncLibrary; 196 LibraryElement _asyncLibrary;
195 197
196 InterfaceType _boolType; 198 InterfaceType _boolType;
197 InterfaceType _deprecatedType; 199 InterfaceType _deprecatedType;
198 InterfaceType _doubleType; 200 InterfaceType _doubleType;
199 InterfaceType _functionType; 201 InterfaceType _functionType;
200 InterfaceType _futureDynamicType; 202 InterfaceType _futureDynamicType;
201 InterfaceType _futureNullType; 203 InterfaceType _futureNullType;
202 InterfaceType _futureType; 204 InterfaceType _futureType;
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 } 302 }
301 303
302 @override 304 @override
303 InterfaceType get mapType { 305 InterfaceType get mapType {
304 assert(_coreLibrary != null); 306 assert(_coreLibrary != null);
305 _mapType ??= _getType(_coreLibrary, "Map"); 307 _mapType ??= _getType(_coreLibrary, "Map");
306 return _mapType; 308 return _mapType;
307 } 309 }
308 310
309 @override 311 @override
310 List<InterfaceType> get nonSubtypableTypes => <InterfaceType>[
311 nullType,
312 numType,
313 intType,
314 doubleType,
315 boolType,
316 stringType
317 ];
318
319 @override
320 DartObjectImpl get nullObject { 312 DartObjectImpl get nullObject {
321 if (_nullObject == null) { 313 if (_nullObject == null) {
322 _nullObject = new DartObjectImpl(nullType, NullState.NULL_STATE); 314 _nullObject = new DartObjectImpl(nullType, NullState.NULL_STATE);
323 } 315 }
324 return _nullObject; 316 return _nullObject;
325 } 317 }
326 318
327 @override 319 @override
328 InterfaceType get nullType { 320 InterfaceType get nullType {
329 assert(_coreLibrary != null); 321 assert(_coreLibrary != null);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 * throw a [StateError] if there is no class with the given name. 405 * throw a [StateError] if there is no class with the given name.
414 */ 406 */
415 InterfaceType _getType(LibraryElement library, String name) { 407 InterfaceType _getType(LibraryElement library, String name) {
416 Element element = library.getType(name); 408 Element element = library.getType(name);
417 if (element == null) { 409 if (element == null) {
418 throw new StateError("No definition of type $name"); 410 throw new StateError("No definition of type $name");
419 } 411 }
420 return (element as ClassElement).type; 412 return (element as ClassElement).type;
421 } 413 }
422 } 414 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698