Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 engine.resolver; | 5 library engine.resolver; |
| 6 | 6 |
| 7 import "dart:math" as math; | 7 import "dart:math" as math; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:analyzer/src/generated/utilities_collection.dart'; | 10 import 'package:analyzer/src/generated/utilities_collection.dart'; |
| (...skipping 13185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13196 } | 13196 } |
| 13197 } | 13197 } |
| 13198 | 13198 |
| 13199 /** | 13199 /** |
| 13200 * The interface `TypeProvider` defines the behavior of objects that provide acc ess to types | 13200 * The interface `TypeProvider` defines the behavior of objects that provide acc ess to types |
| 13201 * defined by the language. | 13201 * defined by the language. |
| 13202 */ | 13202 */ |
| 13203 abstract class TypeProvider { | 13203 abstract class TypeProvider { |
| 13204 /** | 13204 /** |
| 13205 * Return the type representing the built-in type 'bool'. | 13205 * Return the type representing the built-in type 'bool'. |
| 13206 * | |
| 13207 * @return the type representing the built-in type 'bool' | |
| 13208 */ | 13206 */ |
| 13209 InterfaceType get boolType; | 13207 InterfaceType get boolType; |
| 13210 | 13208 |
| 13211 /** | 13209 /** |
| 13212 * Return the type representing the type 'bottom'. | 13210 * Return the type representing the type 'bottom'. |
| 13213 * | |
| 13214 * @return the type representing the type 'bottom' | |
| 13215 */ | 13211 */ |
| 13216 DartType get bottomType; | 13212 DartType get bottomType; |
| 13217 | 13213 |
| 13218 /** | 13214 /** |
| 13219 * Return the type representing the built-in type 'Deprecated'. | 13215 * Return the type representing the built-in type 'Deprecated'. |
| 13220 * | |
| 13221 * @return the type representing the built-in type 'Deprecated' | |
| 13222 */ | 13216 */ |
| 13223 InterfaceType get deprecatedType; | 13217 InterfaceType get deprecatedType; |
| 13224 | 13218 |
| 13225 /** | 13219 /** |
| 13226 * Return the type representing the built-in type 'double'. | 13220 * Return the type representing the built-in type 'double'. |
| 13227 * | |
| 13228 * @return the type representing the built-in type 'double' | |
| 13229 */ | 13221 */ |
| 13230 InterfaceType get doubleType; | 13222 InterfaceType get doubleType; |
| 13231 | 13223 |
| 13232 /** | 13224 /** |
| 13233 * Return the type representing the built-in type 'dynamic'. | 13225 * Return the type representing the built-in type 'dynamic'. |
| 13234 * | |
| 13235 * @return the type representing the built-in type 'dynamic' | |
| 13236 */ | 13226 */ |
| 13237 DartType get dynamicType; | 13227 DartType get dynamicType; |
| 13238 | 13228 |
| 13239 /** | 13229 /** |
| 13240 * Return the type representing the built-in type 'Function'. | 13230 * Return the type representing the built-in type 'Function'. |
| 13241 * | |
| 13242 * @return the type representing the built-in type 'Function' | |
| 13243 */ | 13231 */ |
| 13244 InterfaceType get functionType; | 13232 InterfaceType get functionType; |
| 13245 | 13233 |
| 13246 /** | 13234 /** |
| 13247 * Return the type representing 'Future<dynamic>'. | 13235 * Return the type representing 'Future<dynamic>'. |
| 13248 */ | 13236 */ |
| 13249 InterfaceType get futureDynamicType; | 13237 InterfaceType get futureDynamicType; |
| 13250 | 13238 |
| 13251 /** | 13239 /** |
| 13252 * Return the type representing 'Future<Null>'. | 13240 * Return the type representing 'Future<Null>'. |
| 13253 */ | 13241 */ |
| 13254 InterfaceType get futureNullType; | 13242 InterfaceType get futureNullType; |
| 13255 | 13243 |
| 13256 /** | 13244 /** |
| 13257 * Return the type representing the built-in type 'Future'. | 13245 * Return the type representing the built-in type 'Future'. |
| 13258 */ | 13246 */ |
| 13259 InterfaceType get futureType; | 13247 InterfaceType get futureType; |
| 13260 | 13248 |
| 13261 /** | 13249 /** |
| 13262 * Return the type representing the built-in type 'int'. | 13250 * Return the type representing the built-in type 'int'. |
| 13263 * | |
| 13264 * @return the type representing the built-in type 'int' | |
| 13265 */ | 13251 */ |
| 13266 InterfaceType get intType; | 13252 InterfaceType get intType; |
| 13267 | 13253 |
| 13268 /** | 13254 /** |
| 13269 * Return the type representing the type 'Iterable<dynamic>'. | 13255 * Return the type representing the type 'Iterable<dynamic>'. |
| 13270 */ | 13256 */ |
| 13271 InterfaceType get iterableDynamicType; | 13257 InterfaceType get iterableDynamicType; |
| 13272 | 13258 |
| 13273 /** | 13259 /** |
| 13274 * Return the type representing the built-in type 'Iterable'. | 13260 * Return the type representing the built-in type 'Iterable'. |
| 13275 */ | 13261 */ |
| 13276 InterfaceType get iterableType; | 13262 InterfaceType get iterableType; |
| 13277 | 13263 |
| 13278 /** | 13264 /** |
| 13279 * Return the type representing the built-in type 'List'. | 13265 * Return the type representing the built-in type 'List'. |
| 13280 * | |
| 13281 * @return the type representing the built-in type 'List' | |
| 13282 */ | 13266 */ |
| 13283 InterfaceType get listType; | 13267 InterfaceType get listType; |
| 13284 | 13268 |
| 13285 /** | 13269 /** |
| 13270 * Return a list containing all of the types that cannot be either extended or | |
| 13271 * implemented. | |
| 13272 */ | |
| 13273 List<InterfaceType> get nonSubtypableTypes; | |
|
vsm
2015/04/07 20:51:12
sealedTypes is another option
| |
| 13274 | |
| 13275 /** | |
| 13286 * Return the type representing the built-in type 'Map'. | 13276 * Return the type representing the built-in type 'Map'. |
| 13287 * | |
| 13288 * @return the type representing the built-in type 'Map' | |
| 13289 */ | 13277 */ |
| 13290 InterfaceType get mapType; | 13278 InterfaceType get mapType; |
| 13291 | 13279 |
| 13292 /** | 13280 /** |
| 13293 * Return a [DartObjectImpl] representing the `null` object. | 13281 * Return a [DartObjectImpl] representing the `null` object. |
| 13294 */ | 13282 */ |
| 13295 DartObjectImpl get nullObject; | 13283 DartObjectImpl get nullObject; |
| 13296 | 13284 |
| 13297 /** | 13285 /** |
| 13298 * Return the type representing the built-in type 'Null'. | 13286 * Return the type representing the built-in type 'Null'. |
| 13299 * | |
| 13300 * @return the type representing the built-in type 'null' | |
| 13301 */ | 13287 */ |
| 13302 InterfaceType get nullType; | 13288 InterfaceType get nullType; |
| 13303 | 13289 |
| 13304 /** | 13290 /** |
| 13305 * Return the type representing the built-in type 'num'. | 13291 * Return the type representing the built-in type 'num'. |
| 13306 * | |
| 13307 * @return the type representing the built-in type 'num' | |
| 13308 */ | 13292 */ |
| 13309 InterfaceType get numType; | 13293 InterfaceType get numType; |
| 13310 | 13294 |
| 13311 /** | 13295 /** |
| 13312 * Return the type representing the built-in type 'Object'. | 13296 * Return the type representing the built-in type 'Object'. |
| 13313 * | |
| 13314 * @return the type representing the built-in type 'Object' | |
| 13315 */ | 13297 */ |
| 13316 InterfaceType get objectType; | 13298 InterfaceType get objectType; |
| 13317 | 13299 |
| 13318 /** | 13300 /** |
| 13319 * Return the type representing the built-in type 'StackTrace'. | 13301 * Return the type representing the built-in type 'StackTrace'. |
| 13320 * | |
| 13321 * @return the type representing the built-in type 'StackTrace' | |
| 13322 */ | 13302 */ |
| 13323 InterfaceType get stackTraceType; | 13303 InterfaceType get stackTraceType; |
| 13324 | 13304 |
| 13325 /** | 13305 /** |
| 13326 * Return the type representing 'Stream<dynamic>'. | 13306 * Return the type representing 'Stream<dynamic>'. |
| 13327 */ | 13307 */ |
| 13328 InterfaceType get streamDynamicType; | 13308 InterfaceType get streamDynamicType; |
| 13329 | 13309 |
| 13330 /** | 13310 /** |
| 13331 * Return the type representing the built-in type 'Stream'. | 13311 * Return the type representing the built-in type 'Stream'. |
| 13332 */ | 13312 */ |
| 13333 InterfaceType get streamType; | 13313 InterfaceType get streamType; |
| 13334 | 13314 |
| 13335 /** | 13315 /** |
| 13336 * Return the type representing the built-in type 'String'. | 13316 * Return the type representing the built-in type 'String'. |
| 13337 * | |
| 13338 * @return the type representing the built-in type 'String' | |
| 13339 */ | 13317 */ |
| 13340 InterfaceType get stringType; | 13318 InterfaceType get stringType; |
| 13341 | 13319 |
| 13342 /** | 13320 /** |
| 13343 * Return the type representing the built-in type 'Symbol'. | 13321 * Return the type representing the built-in type 'Symbol'. |
| 13344 * | |
| 13345 * @return the type representing the built-in type 'Symbol' | |
| 13346 */ | 13322 */ |
| 13347 InterfaceType get symbolType; | 13323 InterfaceType get symbolType; |
| 13348 | 13324 |
| 13349 /** | 13325 /** |
| 13350 * Return the type representing the built-in type 'Type'. | 13326 * Return the type representing the built-in type 'Type'. |
| 13351 * | |
| 13352 * @return the type representing the built-in type 'Type' | |
| 13353 */ | 13327 */ |
| 13354 InterfaceType get typeType; | 13328 InterfaceType get typeType; |
| 13355 | 13329 |
| 13356 /** | 13330 /** |
| 13357 * Return the type representing typenames that can't be resolved. | 13331 * Return the type representing typenames that can't be resolved. |
| 13358 */ | 13332 */ |
| 13359 DartType get undefinedType; | 13333 DartType get undefinedType; |
| 13360 } | 13334 } |
| 13361 | 13335 |
| 13362 /** | 13336 /** |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13546 @override | 13520 @override |
| 13547 InterfaceType get iterableType => _iterableType; | 13521 InterfaceType get iterableType => _iterableType; |
| 13548 | 13522 |
| 13549 @override | 13523 @override |
| 13550 InterfaceType get listType => _listType; | 13524 InterfaceType get listType => _listType; |
| 13551 | 13525 |
| 13552 @override | 13526 @override |
| 13553 InterfaceType get mapType => _mapType; | 13527 InterfaceType get mapType => _mapType; |
| 13554 | 13528 |
| 13555 @override | 13529 @override |
| 13530 List<InterfaceType> get nonSubtypableTypes => <InterfaceType>[ | |
| 13531 nullType, | |
| 13532 numType, | |
| 13533 intType, | |
| 13534 doubleType, | |
| 13535 boolType, | |
| 13536 stringType | |
| 13537 ]; | |
| 13538 | |
| 13539 @override | |
| 13556 DartObjectImpl get nullObject { | 13540 DartObjectImpl get nullObject { |
| 13557 if (_nullObject == null) { | 13541 if (_nullObject == null) { |
| 13558 _nullObject = new DartObjectImpl(nullType, NullState.NULL_STATE); | 13542 _nullObject = new DartObjectImpl(nullType, NullState.NULL_STATE); |
| 13559 } | 13543 } |
| 13560 return _nullObject; | 13544 return _nullObject; |
| 13561 } | 13545 } |
| 13562 | 13546 |
| 13563 @override | 13547 @override |
| 13564 InterfaceType get nullType => _nullType; | 13548 InterfaceType get nullType => _nullType; |
| 13565 | 13549 |
| (...skipping 1839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 15405 nonFields.add(node); | 15389 nonFields.add(node); |
| 15406 return null; | 15390 return null; |
| 15407 } | 15391 } |
| 15408 | 15392 |
| 15409 @override | 15393 @override |
| 15410 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this); | 15394 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this); |
| 15411 | 15395 |
| 15412 @override | 15396 @override |
| 15413 Object visitWithClause(WithClause node) => null; | 15397 Object visitWithClause(WithClause node) => null; |
| 15414 } | 15398 } |
| OLD | NEW |