| 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.error_verifier; | 5 library engine.resolver.error_verifier; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import "dart:math" as math; | 8 import "dart:math" as math; |
| 9 | 9 |
| 10 import 'java_engine.dart'; | 10 import 'java_engine.dart'; |
| (...skipping 5239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5250 } else if (type is FunctionType || type.isDartCoreFunction) { | 5250 } else if (type is FunctionType || type.isDartCoreFunction) { |
| 5251 return true; | 5251 return true; |
| 5252 } else if (type is InterfaceType) { | 5252 } else if (type is InterfaceType) { |
| 5253 MethodElement callMethod = type.lookUpMethod(FunctionElement.CALL_METHOD_N
AME, _currentLibrary); | 5253 MethodElement callMethod = type.lookUpMethod(FunctionElement.CALL_METHOD_N
AME, _currentLibrary); |
| 5254 return callMethod != null; | 5254 return callMethod != null; |
| 5255 } | 5255 } |
| 5256 return false; | 5256 return false; |
| 5257 } | 5257 } |
| 5258 | 5258 |
| 5259 /** | 5259 /** |
| 5260 * Return `true` if the given type represents the class `Future` from the | |
| 5261 * `dart:async` library. | |
| 5262 * | |
| 5263 * @param type the type to be tested | |
| 5264 * @return `true` if the given type represents the class `Future` from the | |
| 5265 * `dart:async` library | |
| 5266 */ | |
| 5267 bool _isFuture(DartType type) { | |
| 5268 if (type is InterfaceType) { | |
| 5269 InterfaceType interfaceType = type; | |
| 5270 if (interfaceType.name == "Future") { | |
| 5271 ClassElement element = interfaceType.element; | |
| 5272 if (element != null) { | |
| 5273 LibraryElement library = element.library; | |
| 5274 if (library.name == "dart.async") { | |
| 5275 return true; | |
| 5276 } | |
| 5277 } | |
| 5278 } | |
| 5279 } | |
| 5280 return false; | |
| 5281 } | |
| 5282 | |
| 5283 /** | |
| 5284 * Return `true` iff the passed [ClassElement] has a method, getter or setter
that | 5260 * Return `true` iff the passed [ClassElement] has a method, getter or setter
that |
| 5285 * matches the name of the passed [ExecutableElement] in either the class itse
lf, or one of | 5261 * matches the name of the passed [ExecutableElement] in either the class itse
lf, or one of |
| 5286 * its' mixins that is concrete. | 5262 * its' mixins that is concrete. |
| 5287 * | 5263 * |
| 5288 * By "match", only the name of the member is tested to match, it does not hav
e to equal or be a | 5264 * By "match", only the name of the member is tested to match, it does not hav
e to equal or be a |
| 5289 * subtype of the passed executable element, this is due to the specific use w
here this method is | 5265 * subtype of the passed executable element, this is due to the specific use w
here this method is |
| 5290 * used in [checkForNonAbstractClassInheritsAbstractMember]. | 5266 * used in [checkForNonAbstractClassInheritsAbstractMember]. |
| 5291 * | 5267 * |
| 5292 * @param executableElt the executable to search for in the passed class eleme
nt | 5268 * @param executableElt the executable to search for in the passed class eleme
nt |
| 5293 * @param classElt the class method to search through the members of | 5269 * @param classElt the class method to search through the members of |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5491 toCheck.add(type.element); | 5467 toCheck.add(type.element); |
| 5492 // type arguments | 5468 // type arguments |
| 5493 if (type is InterfaceType) { | 5469 if (type is InterfaceType) { |
| 5494 InterfaceType interfaceType = type; | 5470 InterfaceType interfaceType = type; |
| 5495 for (DartType typeArgument in interfaceType.typeArguments) { | 5471 for (DartType typeArgument in interfaceType.typeArguments) { |
| 5496 _addTypeToCheck(typeArgument); | 5472 _addTypeToCheck(typeArgument); |
| 5497 } | 5473 } |
| 5498 } | 5474 } |
| 5499 } | 5475 } |
| 5500 } | 5476 } |
| OLD | NEW |