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

Side by Side Diff: pkg/analyzer/lib/src/generated/element.dart

Issue 1001063002: Correctly compute whether a class subclasses Function (issue 22805) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/error_verifier.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.element; 8 library engine.element;
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
(...skipping 3283 matching lines...) Expand 10 before | Expand all | Expand 10 after
3294 } 3294 }
3295 3295
3296 /** 3296 /**
3297 * A base class for concrete implementations of an [ExecutableElement]. 3297 * A base class for concrete implementations of an [ExecutableElement].
3298 */ 3298 */
3299 abstract class ExecutableElementImpl extends ElementImpl 3299 abstract class ExecutableElementImpl extends ElementImpl
3300 implements ExecutableElement { 3300 implements ExecutableElement {
3301 /** 3301 /**
3302 * An empty list of executable elements. 3302 * An empty list of executable elements.
3303 */ 3303 */
3304 static const List<ExecutableElement> EMPTY_ARRAY = const <ExecutableElement>[ 3304 static const List<ExecutableElement> EMPTY_ARRAY =
3305 ]; 3305 const <ExecutableElement>[];
3306 3306
3307 /** 3307 /**
3308 * A list containing all of the functions defined within this executable 3308 * A list containing all of the functions defined within this executable
3309 * element. 3309 * element.
3310 */ 3310 */
3311 List<FunctionElement> _functions = FunctionElementImpl.EMPTY_ARRAY; 3311 List<FunctionElement> _functions = FunctionElementImpl.EMPTY_ARRAY;
3312 3312
3313 /** 3313 /**
3314 * A list containing all of the labels defined within this executable element. 3314 * A list containing all of the labels defined within this executable element.
3315 */ 3315 */
(...skipping 2035 matching lines...) Expand 10 before | Expand all | Expand 10 after
5351 abstract class HtmlScriptElement implements Element {} 5351 abstract class HtmlScriptElement implements Element {}
5352 5352
5353 /** 5353 /**
5354 * A concrete implementation of an [HtmlScriptElement]. 5354 * A concrete implementation of an [HtmlScriptElement].
5355 */ 5355 */
5356 abstract class HtmlScriptElementImpl extends ElementImpl 5356 abstract class HtmlScriptElementImpl extends ElementImpl
5357 implements HtmlScriptElement { 5357 implements HtmlScriptElement {
5358 /** 5358 /**
5359 * An empty list of HTML script elements. 5359 * An empty list of HTML script elements.
5360 */ 5360 */
5361 static const List<HtmlScriptElement> EMPTY_ARRAY = const <HtmlScriptElement>[ 5361 static const List<HtmlScriptElement> EMPTY_ARRAY =
5362 ]; 5362 const <HtmlScriptElement>[];
5363 5363
5364 /** 5364 /**
5365 * Initialize a newly created script element corresponding to the given 5365 * Initialize a newly created script element corresponding to the given
5366 * [node]. 5366 * [node].
5367 */ 5367 */
5368 HtmlScriptElementImpl(XmlTagNode node) 5368 HtmlScriptElementImpl(XmlTagNode node)
5369 : super(node.tag, node.tagToken.offset); 5369 : super(node.tag, node.tagToken.offset);
5370 } 5370 }
5371 5371
5372 /** 5372 /**
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after
6480 } 6480 }
6481 for (int i = 0; i < typeTArgs.length; i++) { 6481 for (int i = 0; i < typeTArgs.length; i++) {
6482 // Recursively call isSubtypeOf the type arguments and return false if 6482 // Recursively call isSubtypeOf the type arguments and return false if
6483 // the T argument is not a subtype of the S argument. 6483 // the T argument is not a subtype of the S argument.
6484 if (!(typeTArgs[i] as TypeImpl).isSubtypeOf2( 6484 if (!(typeTArgs[i] as TypeImpl).isSubtypeOf2(
6485 typeSArgs[i], visitedTypePairs)) { 6485 typeSArgs[i], visitedTypePairs)) {
6486 return false; 6486 return false;
6487 } 6487 }
6488 } 6488 }
6489 return true; 6489 return true;
6490 } else if (typeS.isDartCoreFunction && elementT.getMethod("call") != null) { 6490 } else if (typeS.isDartCoreFunction && _hasCallMethod(elementT)) {
6491 return true; 6491 return true;
6492 } 6492 }
6493 InterfaceType supertype = superclass; 6493 InterfaceType supertype = superclass;
6494 // The type is Object, return false. 6494 // The type is Object, return false.
6495 if (supertype != null && 6495 if (supertype != null &&
6496 (supertype as InterfaceTypeImpl)._isSubtypeOf( 6496 (supertype as InterfaceTypeImpl)._isSubtypeOf(
6497 typeS, visitedClasses, visitedTypePairs)) { 6497 typeS, visitedClasses, visitedTypePairs)) {
6498 return true; 6498 return true;
6499 } 6499 }
6500 List<InterfaceType> interfaceTypes = interfaces; 6500 List<InterfaceType> interfaceTypes = interfaces;
6501 for (InterfaceType interfaceType in interfaceTypes) { 6501 for (InterfaceType interfaceType in interfaceTypes) {
6502 if ((interfaceType as InterfaceTypeImpl)._isSubtypeOf( 6502 if ((interfaceType as InterfaceTypeImpl)._isSubtypeOf(
6503 typeS, visitedClasses, visitedTypePairs)) { 6503 typeS, visitedClasses, visitedTypePairs)) {
6504 return true; 6504 return true;
6505 } 6505 }
6506 } 6506 }
6507 List<InterfaceType> mixinTypes = mixins; 6507 List<InterfaceType> mixinTypes = mixins;
6508 for (InterfaceType mixinType in mixinTypes) { 6508 for (InterfaceType mixinType in mixinTypes) {
6509 if ((mixinType as InterfaceTypeImpl)._isSubtypeOf( 6509 if ((mixinType as InterfaceTypeImpl)._isSubtypeOf(
6510 typeS, visitedClasses, visitedTypePairs)) { 6510 typeS, visitedClasses, visitedTypePairs)) {
6511 return true; 6511 return true;
6512 } 6512 }
6513 } 6513 }
6514 return false; 6514 return false;
6515 } 6515 }
6516 6516
6517 /** 6517 /**
6518 * Return `true` if the given element has an instance method named 'call'.
6519 */
6520 bool _hasCallMethod(ClassElement elementT) {
6521 MethodElement method = elementT.lookUpMethod(
6522 FunctionElement.CALL_METHOD_NAME, elementT.library);
6523 return method != null && !method.isStatic;
6524 }
6525
6526 /**
6518 * Return the length of the longest inheritance path from the given [type] to 6527 * Return the length of the longest inheritance path from the given [type] to
6519 * Object. 6528 * Object.
6520 * 6529 *
6521 * See [InterfaceType.getLeastUpperBound]. 6530 * See [InterfaceType.getLeastUpperBound].
6522 */ 6531 */
6523 static int computeLongestInheritancePathToObject(InterfaceType type) => 6532 static int computeLongestInheritancePathToObject(InterfaceType type) =>
6524 _computeLongestInheritancePathToObject( 6533 _computeLongestInheritancePathToObject(
6525 type, 0, new HashSet<ClassElement>()); 6534 type, 0, new HashSet<ClassElement>());
6526 6535
6527 /** 6536 /**
(...skipping 3155 matching lines...) Expand 10 before | Expand all | Expand 10 after
9683 TypeParameterElement get element; 9692 TypeParameterElement get element;
9684 } 9693 }
9685 9694
9686 /** 9695 /**
9687 * A concrete implementation of a [TypeParameterType]. 9696 * A concrete implementation of a [TypeParameterType].
9688 */ 9697 */
9689 class TypeParameterTypeImpl extends TypeImpl implements TypeParameterType { 9698 class TypeParameterTypeImpl extends TypeImpl implements TypeParameterType {
9690 /** 9699 /**
9691 * An empty list of type parameter types. 9700 * An empty list of type parameter types.
9692 */ 9701 */
9693 static const List<TypeParameterType> EMPTY_ARRAY = const <TypeParameterType>[ 9702 static const List<TypeParameterType> EMPTY_ARRAY =
9694 ]; 9703 const <TypeParameterType>[];
9695 9704
9696 /** 9705 /**
9697 * Initialize a newly created type parameter type to be declared by the given 9706 * Initialize a newly created type parameter type to be declared by the given
9698 * [element] and to have the given name. 9707 * [element] and to have the given name.
9699 */ 9708 */
9700 TypeParameterTypeImpl(TypeParameterElement element) 9709 TypeParameterTypeImpl(TypeParameterElement element)
9701 : super(element, element.name); 9710 : super(element, element.name);
9702 9711
9703 @override 9712 @override
9704 TypeParameterElement get element => super.element as TypeParameterElement; 9713 TypeParameterElement get element => super.element as TypeParameterElement;
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
10423 // void <: void (by reflexivity) 10432 // void <: void (by reflexivity)
10424 // bottom <: void (as bottom is a subtype of all types). 10433 // bottom <: void (as bottom is a subtype of all types).
10425 // void <: dynamic (as dynamic is a supertype of all types) 10434 // void <: dynamic (as dynamic is a supertype of all types)
10426 return identical(type, this) || type.isDynamic; 10435 return identical(type, this) || type.isDynamic;
10427 } 10436 }
10428 10437
10429 @override 10438 @override
10430 VoidTypeImpl substitute2( 10439 VoidTypeImpl substitute2(
10431 List<DartType> argumentTypes, List<DartType> parameterTypes) => this; 10440 List<DartType> argumentTypes, List<DartType> parameterTypes) => this;
10432 } 10441 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/error_verifier.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698