| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 * to have a bare "return;" in an async method. | 65 * to have a bare "return;" in an async method. |
| 66 */ | 66 */ |
| 67 final InterfaceType _futureNullType; | 67 final InterfaceType _futureNullType; |
| 68 | 68 |
| 69 /** | 69 /** |
| 70 * Create a new instance of the [BestPracticesVerifier]. | 70 * Create a new instance of the [BestPracticesVerifier]. |
| 71 * | 71 * |
| 72 * @param errorReporter the error reporter | 72 * @param errorReporter the error reporter |
| 73 */ | 73 */ |
| 74 BestPracticesVerifier(this._errorReporter, TypeProvider typeProvider) | 74 BestPracticesVerifier(this._errorReporter, TypeProvider typeProvider) |
| 75 : _futureNullType = typeProvider.futureType.substitute4( | 75 : _futureNullType = typeProvider.futureNullType; |
| 76 <DartType>[typeProvider.nullType]); | |
| 77 | 76 |
| 78 @override | 77 @override |
| 79 Object visitArgumentList(ArgumentList node) { | 78 Object visitArgumentList(ArgumentList node) { |
| 80 _checkForArgumentTypesNotAssignableInList(node); | 79 _checkForArgumentTypesNotAssignableInList(node); |
| 81 return super.visitArgumentList(node); | 80 return super.visitArgumentList(node); |
| 82 } | 81 } |
| 83 | 82 |
| 84 @override | 83 @override |
| 85 Object visitAsExpression(AsExpression node) { | 84 Object visitAsExpression(AsExpression node) { |
| 86 _checkForUnnecessaryCast(node); | 85 _checkForUnnecessaryCast(node); |
| (...skipping 13313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13400 DartType get dynamicType; | 13399 DartType get dynamicType; |
| 13401 | 13400 |
| 13402 /** | 13401 /** |
| 13403 * Return the type representing the built-in type 'Function'. | 13402 * Return the type representing the built-in type 'Function'. |
| 13404 * | 13403 * |
| 13405 * @return the type representing the built-in type 'Function' | 13404 * @return the type representing the built-in type 'Function' |
| 13406 */ | 13405 */ |
| 13407 InterfaceType get functionType; | 13406 InterfaceType get functionType; |
| 13408 | 13407 |
| 13409 /** | 13408 /** |
| 13409 * Return the type representing 'Future<Null>'. |
| 13410 */ |
| 13411 InterfaceType get futureNullType; |
| 13412 |
| 13413 /** |
| 13410 * Return the type representing the built-in type 'Future'. | 13414 * Return the type representing the built-in type 'Future'. |
| 13411 */ | 13415 */ |
| 13412 InterfaceType get futureType; | 13416 InterfaceType get futureType; |
| 13413 | 13417 |
| 13414 /** | 13418 /** |
| 13415 * Return the type representing the built-in type 'int'. | 13419 * Return the type representing the built-in type 'int'. |
| 13416 * | 13420 * |
| 13417 * @return the type representing the built-in type 'int' | 13421 * @return the type representing the built-in type 'int' |
| 13418 */ | 13422 */ |
| 13419 InterfaceType get intType; | 13423 InterfaceType get intType; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13516 * The type representing the built-in type 'dynamic'. | 13520 * The type representing the built-in type 'dynamic'. |
| 13517 */ | 13521 */ |
| 13518 DartType _dynamicType; | 13522 DartType _dynamicType; |
| 13519 | 13523 |
| 13520 /** | 13524 /** |
| 13521 * The type representing the built-in type 'Function'. | 13525 * The type representing the built-in type 'Function'. |
| 13522 */ | 13526 */ |
| 13523 InterfaceType _functionType; | 13527 InterfaceType _functionType; |
| 13524 | 13528 |
| 13525 /** | 13529 /** |
| 13530 * The type representing 'Future<Null>'. |
| 13531 */ |
| 13532 InterfaceType _futureNullType; |
| 13533 |
| 13534 /** |
| 13526 * The type representing the built-in type 'Future'. | 13535 * The type representing the built-in type 'Future'. |
| 13527 */ | 13536 */ |
| 13528 InterfaceType _futureType; | 13537 InterfaceType _futureType; |
| 13529 | 13538 |
| 13530 /** | 13539 /** |
| 13531 * The type representing the built-in type 'int'. | 13540 * The type representing the built-in type 'int'. |
| 13532 */ | 13541 */ |
| 13533 InterfaceType _intType; | 13542 InterfaceType _intType; |
| 13534 | 13543 |
| 13535 /** | 13544 /** |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13603 @override | 13612 @override |
| 13604 InterfaceType get doubleType => _doubleType; | 13613 InterfaceType get doubleType => _doubleType; |
| 13605 | 13614 |
| 13606 @override | 13615 @override |
| 13607 DartType get dynamicType => _dynamicType; | 13616 DartType get dynamicType => _dynamicType; |
| 13608 | 13617 |
| 13609 @override | 13618 @override |
| 13610 InterfaceType get functionType => _functionType; | 13619 InterfaceType get functionType => _functionType; |
| 13611 | 13620 |
| 13612 @override | 13621 @override |
| 13622 InterfaceType get futureNullType => _futureNullType; |
| 13623 |
| 13624 @override |
| 13613 InterfaceType get futureType => _futureType; | 13625 InterfaceType get futureType => _futureType; |
| 13614 | 13626 |
| 13615 @override | 13627 @override |
| 13616 InterfaceType get intType => _intType; | 13628 InterfaceType get intType => _intType; |
| 13617 | 13629 |
| 13618 @override | 13630 @override |
| 13619 InterfaceType get listType => _listType; | 13631 InterfaceType get listType => _listType; |
| 13620 | 13632 |
| 13621 @override | 13633 @override |
| 13622 InterfaceType get mapType => _mapType; | 13634 InterfaceType get mapType => _mapType; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13685 _listType = _getType(coreNamespace, "List"); | 13697 _listType = _getType(coreNamespace, "List"); |
| 13686 _mapType = _getType(coreNamespace, "Map"); | 13698 _mapType = _getType(coreNamespace, "Map"); |
| 13687 _nullType = _getType(coreNamespace, "Null"); | 13699 _nullType = _getType(coreNamespace, "Null"); |
| 13688 _numType = _getType(coreNamespace, "num"); | 13700 _numType = _getType(coreNamespace, "num"); |
| 13689 _objectType = _getType(coreNamespace, "Object"); | 13701 _objectType = _getType(coreNamespace, "Object"); |
| 13690 _stackTraceType = _getType(coreNamespace, "StackTrace"); | 13702 _stackTraceType = _getType(coreNamespace, "StackTrace"); |
| 13691 _stringType = _getType(coreNamespace, "String"); | 13703 _stringType = _getType(coreNamespace, "String"); |
| 13692 _symbolType = _getType(coreNamespace, "Symbol"); | 13704 _symbolType = _getType(coreNamespace, "Symbol"); |
| 13693 _typeType = _getType(coreNamespace, "Type"); | 13705 _typeType = _getType(coreNamespace, "Type"); |
| 13694 _undefinedType = UndefinedTypeImpl.instance; | 13706 _undefinedType = UndefinedTypeImpl.instance; |
| 13707 _futureNullType = _futureType.substitute4(<DartType>[_nullType]); |
| 13695 } | 13708 } |
| 13696 } | 13709 } |
| 13697 | 13710 |
| 13698 /** | 13711 /** |
| 13699 * Instances of the class `TypeResolverVisitor` are used to resolve the types as
sociated with | 13712 * Instances of the class `TypeResolverVisitor` are used to resolve the types as
sociated with |
| 13700 * the elements in the element model. This includes the types of superclasses, m
ixins, interfaces, | 13713 * the elements in the element model. This includes the types of superclasses, m
ixins, interfaces, |
| 13701 * fields, methods, parameters, and local variables. As a side-effect, this also
finishes building | 13714 * fields, methods, parameters, and local variables. As a side-effect, this also
finishes building |
| 13702 * the type hierarchy. | 13715 * the type hierarchy. |
| 13703 */ | 13716 */ |
| 13704 class TypeResolverVisitor extends ScopedVisitor { | 13717 class TypeResolverVisitor extends ScopedVisitor { |
| (...skipping 1879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15584 * library. | 15597 * library. |
| 15585 */ | 15598 */ |
| 15586 final HashSet<String> members = new HashSet<String>(); | 15599 final HashSet<String> members = new HashSet<String>(); |
| 15587 | 15600 |
| 15588 /** | 15601 /** |
| 15589 * Names of resolved or unresolved class members that are read in the | 15602 * Names of resolved or unresolved class members that are read in the |
| 15590 * library. | 15603 * library. |
| 15591 */ | 15604 */ |
| 15592 final HashSet<String> readMembers = new HashSet<String>(); | 15605 final HashSet<String> readMembers = new HashSet<String>(); |
| 15593 } | 15606 } |
| OLD | NEW |