| OLD | NEW |
| 1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
| 2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
| 3 library engine.element; | 3 library engine.element; |
| 4 import 'dart:collection'; | 4 import 'dart:collection'; |
| 5 import 'java_core.dart'; | 5 import 'java_core.dart'; |
| 6 import 'java_engine.dart'; | 6 import 'java_engine.dart'; |
| 7 import 'utilities_collection.dart'; | 7 import 'utilities_collection.dart'; |
| 8 import 'source.dart'; | 8 import 'source.dart'; |
| 9 import 'scanner.dart' show Keyword; | 9 import 'scanner.dart' show Keyword; |
| 10 import 'ast.dart' show Identifier, LibraryIdentifier; | 10 import 'ast.dart' show Identifier, LibraryIdentifier; |
| (...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1312 | 1312 |
| 1313 /** | 1313 /** |
| 1314 * Return `true` if this accessor is abstract. Accessors are abstract if they
are not | 1314 * Return `true` if this accessor is abstract. Accessors are abstract if they
are not |
| 1315 * external and have no body. | 1315 * external and have no body. |
| 1316 * | 1316 * |
| 1317 * @return `true` if this accessor is abstract | 1317 * @return `true` if this accessor is abstract |
| 1318 */ | 1318 */ |
| 1319 bool get isAbstract; | 1319 bool get isAbstract; |
| 1320 | 1320 |
| 1321 /** | 1321 /** |
| 1322 * Return `true` if this setter for final variable, so it causes warning when
used. | |
| 1323 * | |
| 1324 * @return `true` if this accessor is excluded setter | |
| 1325 */ | |
| 1326 bool get isExcludedSetter; | |
| 1327 | |
| 1328 /** | |
| 1329 * Return `true` if this accessor represents a getter. | 1322 * Return `true` if this accessor represents a getter. |
| 1330 * | 1323 * |
| 1331 * @return `true` if this accessor represents a getter | 1324 * @return `true` if this accessor represents a getter |
| 1332 */ | 1325 */ |
| 1333 bool get isGetter; | 1326 bool get isGetter; |
| 1334 | 1327 |
| 1335 /** | 1328 /** |
| 1336 * Return `true` if this accessor represents a setter. | 1329 * Return `true` if this accessor represents a setter. |
| 1337 * | 1330 * |
| 1338 * @return `true` if this accessor represents a setter | 1331 * @return `true` if this accessor represents a setter |
| (...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2329 for (ClassElement type in _types) { | 2322 for (ClassElement type in _types) { |
| 2330 if (((type as ClassElementImpl)).identifier == identifier) { | 2323 if (((type as ClassElementImpl)).identifier == identifier) { |
| 2331 return type as ClassElementImpl; | 2324 return type as ClassElementImpl; |
| 2332 } | 2325 } |
| 2333 } | 2326 } |
| 2334 return null; | 2327 return null; |
| 2335 } | 2328 } |
| 2336 LibraryElement get enclosingElement => super.enclosingElement as LibraryElemen
t; | 2329 LibraryElement get enclosingElement => super.enclosingElement as LibraryElemen
t; |
| 2337 List<FunctionElement> get functions => _functions; | 2330 List<FunctionElement> get functions => _functions; |
| 2338 List<FunctionTypeAliasElement> get functionTypeAliases => _typeAliases; | 2331 List<FunctionTypeAliasElement> get functionTypeAliases => _typeAliases; |
| 2339 String get identifier => source.encoding; | |
| 2340 ElementKind get kind => ElementKind.COMPILATION_UNIT; | 2332 ElementKind get kind => ElementKind.COMPILATION_UNIT; |
| 2341 Source get source => _source; | 2333 Source get source => _source; |
| 2342 List<TopLevelVariableElement> get topLevelVariables => _variables; | 2334 List<TopLevelVariableElement> get topLevelVariables => _variables; |
| 2343 ClassElement getType(String className) { | 2335 ClassElement getType(String className) { |
| 2344 for (ClassElement type in _types) { | 2336 for (ClassElement type in _types) { |
| 2345 if (type.name == className) { | 2337 if (type.name == className) { |
| 2346 return type; | 2338 return type; |
| 2347 } | 2339 } |
| 2348 } | 2340 } |
| 2349 return null; | 2341 return null; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2438 safelyVisitChildren(_types, visitor); | 2430 safelyVisitChildren(_types, visitor); |
| 2439 safelyVisitChildren(_variables, visitor); | 2431 safelyVisitChildren(_variables, visitor); |
| 2440 } | 2432 } |
| 2441 void appendTo(JavaStringBuilder builder) { | 2433 void appendTo(JavaStringBuilder builder) { |
| 2442 if (_source == null) { | 2434 if (_source == null) { |
| 2443 builder.append("{compilation unit}"); | 2435 builder.append("{compilation unit}"); |
| 2444 } else { | 2436 } else { |
| 2445 builder.append(_source.fullName); | 2437 builder.append(_source.fullName); |
| 2446 } | 2438 } |
| 2447 } | 2439 } |
| 2440 String get identifier => source.encoding; |
| 2448 } | 2441 } |
| 2449 /** | 2442 /** |
| 2450 * Instances of the class `ConstFieldElementImpl` implement a `FieldElement` for
a | 2443 * Instances of the class `ConstFieldElementImpl` implement a `FieldElement` for
a |
| 2451 * 'const' field that has an initializer. | 2444 * 'const' field that has an initializer. |
| 2452 */ | 2445 */ |
| 2453 class ConstFieldElementImpl extends FieldElementImpl { | 2446 class ConstFieldElementImpl extends FieldElementImpl { |
| 2454 | 2447 |
| 2455 /** | 2448 /** |
| 2456 * The result of evaluating this variable's initializer. | 2449 * The result of evaluating this variable's initializer. |
| 2457 */ | 2450 */ |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2759 this._name = StringUtilities.intern(name); | 2752 this._name = StringUtilities.intern(name); |
| 2760 this._nameOffset = nameOffset; | 2753 this._nameOffset = nameOffset; |
| 2761 } | 2754 } |
| 2762 String computeDocumentationComment() { | 2755 String computeDocumentationComment() { |
| 2763 AnalysisContext context = this.context; | 2756 AnalysisContext context = this.context; |
| 2764 if (context == null) { | 2757 if (context == null) { |
| 2765 return null; | 2758 return null; |
| 2766 } | 2759 } |
| 2767 return context.computeDocumentationComment(this); | 2760 return context.computeDocumentationComment(this); |
| 2768 } | 2761 } |
| 2769 bool operator ==(Object object) => object != null && object.runtimeType == run
timeType && ((object as Element)).location == location; | 2762 bool operator ==(Object object) { |
| 2763 if (identical(this, object)) { |
| 2764 return true; |
| 2765 } |
| 2766 if (object == null || hashCode != object.hashCode) { |
| 2767 return false; |
| 2768 } |
| 2769 return object.runtimeType == runtimeType && ((object as Element)).location =
= location; |
| 2770 } |
| 2770 Element getAncestor(Type elementClass) { | 2771 Element getAncestor(Type elementClass) { |
| 2771 Element ancestor = _enclosingElement; | 2772 Element ancestor = _enclosingElement; |
| 2772 while (ancestor != null && !isInstanceOf(ancestor, elementClass)) { | 2773 while (ancestor != null && !isInstanceOf(ancestor, elementClass)) { |
| 2773 ancestor = ancestor.enclosingElement; | 2774 ancestor = ancestor.enclosingElement; |
| 2774 } | 2775 } |
| 2775 return ancestor as Element; | 2776 return ancestor as Element; |
| 2776 } | 2777 } |
| 2777 | 2778 |
| 2778 /** | 2779 /** |
| 2779 * Return the child of this element that is uniquely identified by the given i
dentifier, or | 2780 * Return the child of this element that is uniquely identified by the given i
dentifier, or |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2907 child.accept(visitor); | 2908 child.accept(visitor); |
| 2908 } | 2909 } |
| 2909 } | 2910 } |
| 2910 } | 2911 } |
| 2911 | 2912 |
| 2912 /** | 2913 /** |
| 2913 * Set the enclosing element of this element to the given element. | 2914 * Set the enclosing element of this element to the given element. |
| 2914 * | 2915 * |
| 2915 * @param element the enclosing element of this element | 2916 * @param element the enclosing element of this element |
| 2916 */ | 2917 */ |
| 2917 void set enclosingElement(ElementImpl element) { | 2918 void set enclosingElement(Element element) { |
| 2918 _enclosingElement = element; | 2919 _enclosingElement = element as ElementImpl; |
| 2919 } | 2920 } |
| 2920 | 2921 |
| 2921 /** | 2922 /** |
| 2922 * Set whether the given modifier is associated with this element to correspon
d to the given | 2923 * Set whether the given modifier is associated with this element to correspon
d to the given |
| 2923 * value. | 2924 * value. |
| 2924 * | 2925 * |
| 2925 * @param modifier the modifier to be set | 2926 * @param modifier the modifier to be set |
| 2926 * @param value `true` if the modifier is to be associated with this element | 2927 * @param value `true` if the modifier is to be associated with this element |
| 2927 */ | 2928 */ |
| 2928 void setModifier(Modifier modifier, bool value) { | 2929 void setModifier(Modifier modifier, bool value) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2963 | 2964 |
| 2964 /** | 2965 /** |
| 2965 * Initialize a newly created location from the given encoded form. | 2966 * Initialize a newly created location from the given encoded form. |
| 2966 * | 2967 * |
| 2967 * @param encoding the encoded form of a location | 2968 * @param encoding the encoded form of a location |
| 2968 */ | 2969 */ |
| 2969 ElementLocationImpl.con2(String encoding) { | 2970 ElementLocationImpl.con2(String encoding) { |
| 2970 this.components = decode(encoding); | 2971 this.components = decode(encoding); |
| 2971 } | 2972 } |
| 2972 bool operator ==(Object object) { | 2973 bool operator ==(Object object) { |
| 2974 if (identical(this, object)) { |
| 2975 return true; |
| 2976 } |
| 2973 if (object is! ElementLocationImpl) { | 2977 if (object is! ElementLocationImpl) { |
| 2974 return false; | 2978 return false; |
| 2975 } | 2979 } |
| 2976 ElementLocationImpl location = object as ElementLocationImpl; | 2980 ElementLocationImpl location = object as ElementLocationImpl; |
| 2977 List<String> otherComponents = location.components; | 2981 List<String> otherComponents = location.components; |
| 2978 int length = components.length; | 2982 int length = components.length; |
| 2979 if (otherComponents.length != length) { | 2983 if (otherComponents.length != length) { |
| 2980 return false; | 2984 return false; |
| 2981 } | 2985 } |
| 2986 for (int i = length - 1; i >= 2; i--) { |
| 2987 if (components[i] != otherComponents[i]) { |
| 2988 return false; |
| 2989 } |
| 2990 } |
| 2991 if (length > 1 && !equalSourceComponents(components[1], otherComponents[1]))
{ |
| 2992 return false; |
| 2993 } |
| 2982 if (length > 0 && !equalSourceComponents(components[0], otherComponents[0]))
{ | 2994 if (length > 0 && !equalSourceComponents(components[0], otherComponents[0]))
{ |
| 2983 return false; | 2995 return false; |
| 2984 } | 2996 } |
| 2985 if (length > 1 && !equalSourceComponents(components[1], otherComponents[1]))
{ | |
| 2986 return false; | |
| 2987 } | |
| 2988 for (int i = 2; i < length; i++) { | |
| 2989 if (components[i] != otherComponents[i]) { | |
| 2990 return false; | |
| 2991 } | |
| 2992 } | |
| 2993 return true; | 2997 return true; |
| 2994 } | 2998 } |
| 2995 String get encoding { | 2999 String get encoding { |
| 2996 JavaStringBuilder builder = new JavaStringBuilder(); | 3000 JavaStringBuilder builder = new JavaStringBuilder(); |
| 2997 int length = components.length; | 3001 int length = components.length; |
| 2998 for (int i = 0; i < length; i++) { | 3002 for (int i = 0; i < length; i++) { |
| 2999 if (i > 0) { | 3003 if (i > 0) { |
| 3000 builder.appendChar(_SEPARATOR_CHAR); | 3004 builder.appendChar(_SEPARATOR_CHAR); |
| 3001 } | 3005 } |
| 3002 encode(builder, components[i]); | 3006 encode(builder, components[i]); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3076 * @param left the left component being compared | 3080 * @param left the left component being compared |
| 3077 * @param right the right component being compared | 3081 * @param right the right component being compared |
| 3078 * @return `true` if the given components are equal when the source type's are
ignored | 3082 * @return `true` if the given components are equal when the source type's are
ignored |
| 3079 */ | 3083 */ |
| 3080 bool equalSourceComponents(String left, String right) { | 3084 bool equalSourceComponents(String left, String right) { |
| 3081 if (left == null) { | 3085 if (left == null) { |
| 3082 return right == null; | 3086 return right == null; |
| 3083 } else if (right == null) { | 3087 } else if (right == null) { |
| 3084 return false; | 3088 return false; |
| 3085 } | 3089 } |
| 3086 if (left.length <= 1 || right.length <= 1) { | 3090 int leftLength = left.length; |
| 3091 int rightLength = right.length; |
| 3092 if (leftLength != rightLength) { |
| 3093 return false; |
| 3094 } else if (leftLength <= 1 || rightLength <= 1) { |
| 3087 return left == right; | 3095 return left == right; |
| 3088 } | 3096 } |
| 3089 return left.substring(1) == right.substring(1); | 3097 return javaStringRegionMatches(left, 1, right, 1, leftLength - 1); |
| 3090 } | 3098 } |
| 3091 | 3099 |
| 3092 /** | 3100 /** |
| 3093 * Return the hash code of the given encoded source component, ignoring the so
urce type indicator. | 3101 * Return the hash code of the given encoded source component, ignoring the so
urce type indicator. |
| 3094 * | 3102 * |
| 3095 * @param sourceComponent the component to compute a hash code | 3103 * @param sourceComponent the component to compute a hash code |
| 3096 * @return the hash code of the given encoded source component | 3104 * @return the hash code of the given encoded source component |
| 3097 */ | 3105 */ |
| 3098 int hashSourceComponent(String sourceComponent) { | 3106 int hashSourceComponent(String sourceComponent) { |
| 3099 if (sourceComponent.length <= 1) { | 3107 if (sourceComponent.length <= 1) { |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3525 | 3533 |
| 3526 /** | 3534 /** |
| 3527 * Initialize a newly created function element to have no name and the given o
ffset. This is used | 3535 * Initialize a newly created function element to have no name and the given o
ffset. This is used |
| 3528 * for function expressions, which have no name. | 3536 * for function expressions, which have no name. |
| 3529 * | 3537 * |
| 3530 * @param nameOffset the offset of the name of this element in the file that c
ontains the | 3538 * @param nameOffset the offset of the name of this element in the file that c
ontains the |
| 3531 * declaration of this element | 3539 * declaration of this element |
| 3532 */ | 3540 */ |
| 3533 FunctionElementImpl.con2(int nameOffset) : super.con2("", nameOffset); | 3541 FunctionElementImpl.con2(int nameOffset) : super.con2("", nameOffset); |
| 3534 accept(ElementVisitor visitor) => visitor.visitFunctionElement(this); | 3542 accept(ElementVisitor visitor) => visitor.visitFunctionElement(this); |
| 3535 String get identifier => "${name}@${nameOffset}"; | |
| 3536 ElementKind get kind => ElementKind.FUNCTION; | 3543 ElementKind get kind => ElementKind.FUNCTION; |
| 3537 SourceRange get visibleRange { | 3544 SourceRange get visibleRange { |
| 3538 if (_visibleRangeLength < 0) { | 3545 if (_visibleRangeLength < 0) { |
| 3539 return null; | 3546 return null; |
| 3540 } | 3547 } |
| 3541 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); | 3548 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); |
| 3542 } | 3549 } |
| 3543 bool get isStatic => enclosingElement is CompilationUnitElement; | 3550 bool get isStatic => enclosingElement is CompilationUnitElement; |
| 3544 | 3551 |
| 3545 /** | 3552 /** |
| 3546 * Set the visible range for this element to the range starting at the given o
ffset with the given | 3553 * Set the visible range for this element to the range starting at the given o
ffset with the given |
| 3547 * length. | 3554 * length. |
| 3548 * | 3555 * |
| 3549 * @param offset the offset to the beginning of the visible range for this ele
ment | 3556 * @param offset the offset to the beginning of the visible range for this ele
ment |
| 3550 * @param length the length of the visible range for this element, or `-1` if
this element | 3557 * @param length the length of the visible range for this element, or `-1` if
this element |
| 3551 * does not have a visible range | 3558 * does not have a visible range |
| 3552 */ | 3559 */ |
| 3553 void setVisibleRange(int offset, int length) { | 3560 void setVisibleRange(int offset, int length) { |
| 3554 _visibleRangeOffset = offset; | 3561 _visibleRangeOffset = offset; |
| 3555 _visibleRangeLength = length; | 3562 _visibleRangeLength = length; |
| 3556 } | 3563 } |
| 3557 void appendTo(JavaStringBuilder builder) { | 3564 void appendTo(JavaStringBuilder builder) { |
| 3558 String name = displayName; | 3565 String name = displayName; |
| 3559 if (name != null) { | 3566 if (name != null) { |
| 3560 builder.append(name); | 3567 builder.append(name); |
| 3561 } | 3568 } |
| 3562 super.appendTo(builder); | 3569 super.appendTo(builder); |
| 3563 } | 3570 } |
| 3571 String get identifier => "${name}@${nameOffset}"; |
| 3564 } | 3572 } |
| 3565 /** | 3573 /** |
| 3566 * Instances of the class `FunctionTypeAliasElementImpl` implement a | 3574 * Instances of the class `FunctionTypeAliasElementImpl` implement a |
| 3567 * `FunctionTypeAliasElement`. | 3575 * `FunctionTypeAliasElement`. |
| 3568 * | 3576 * |
| 3569 * @coverage dart.engine.element | 3577 * @coverage dart.engine.element |
| 3570 */ | 3578 */ |
| 3571 class FunctionTypeAliasElementImpl extends ElementImpl implements FunctionTypeAl
iasElement { | 3579 class FunctionTypeAliasElementImpl extends ElementImpl implements FunctionTypeAl
iasElement { |
| 3572 | 3580 |
| 3573 /** | 3581 /** |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4138 Set<LibraryElement> libraries = new Set<LibraryElement>(); | 4146 Set<LibraryElement> libraries = new Set<LibraryElement>(); |
| 4139 for (ExportElement element in _exports) { | 4147 for (ExportElement element in _exports) { |
| 4140 LibraryElement library = element.exportedLibrary; | 4148 LibraryElement library = element.exportedLibrary; |
| 4141 if (library != null) { | 4149 if (library != null) { |
| 4142 javaSetAdd(libraries, library); | 4150 javaSetAdd(libraries, library); |
| 4143 } | 4151 } |
| 4144 } | 4152 } |
| 4145 return new List.from(libraries); | 4153 return new List.from(libraries); |
| 4146 } | 4154 } |
| 4147 List<ExportElement> get exports => _exports; | 4155 List<ExportElement> get exports => _exports; |
| 4148 String get identifier => _definingCompilationUnit.source.encoding; | |
| 4149 List<LibraryElement> get importedLibraries { | 4156 List<LibraryElement> get importedLibraries { |
| 4150 Set<LibraryElement> libraries = new Set<LibraryElement>(); | 4157 Set<LibraryElement> libraries = new Set<LibraryElement>(); |
| 4151 for (ImportElement element in _imports) { | 4158 for (ImportElement element in _imports) { |
| 4152 LibraryElement library = element.importedLibrary; | 4159 LibraryElement library = element.importedLibrary; |
| 4153 if (library != null) { | 4160 if (library != null) { |
| 4154 javaSetAdd(libraries, library); | 4161 javaSetAdd(libraries, library); |
| 4155 } | 4162 } |
| 4156 } | 4163 } |
| 4157 return new List.from(libraries); | 4164 return new List.from(libraries); |
| 4158 } | 4165 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4257 } | 4264 } |
| 4258 this._parts = parts; | 4265 this._parts = parts; |
| 4259 } | 4266 } |
| 4260 void visitChildren(ElementVisitor visitor) { | 4267 void visitChildren(ElementVisitor visitor) { |
| 4261 super.visitChildren(visitor); | 4268 super.visitChildren(visitor); |
| 4262 safelyVisitChild(_definingCompilationUnit, visitor); | 4269 safelyVisitChild(_definingCompilationUnit, visitor); |
| 4263 safelyVisitChildren(_exports, visitor); | 4270 safelyVisitChildren(_exports, visitor); |
| 4264 safelyVisitChildren(_imports, visitor); | 4271 safelyVisitChildren(_imports, visitor); |
| 4265 safelyVisitChildren(_parts, visitor); | 4272 safelyVisitChildren(_parts, visitor); |
| 4266 } | 4273 } |
| 4274 String get identifier => _definingCompilationUnit.source.encoding; |
| 4267 | 4275 |
| 4268 /** | 4276 /** |
| 4269 * Answer `true` if the receiver directly or indirectly imports the dart:html
libraries. | 4277 * Answer `true` if the receiver directly or indirectly imports the dart:html
libraries. |
| 4270 * | 4278 * |
| 4271 * @return `true` if the receiver directly or indirectly imports the dart:html
libraries | 4279 * @return `true` if the receiver directly or indirectly imports the dart:html
libraries |
| 4272 */ | 4280 */ |
| 4273 bool get isOrImportsBrowserLibrary { | 4281 bool get isOrImportsBrowserLibrary { |
| 4274 List<LibraryElement> visited = new List<LibraryElement>(); | 4282 List<LibraryElement> visited = new List<LibraryElement>(); |
| 4275 Source htmlLibSource = _context.sourceFactory.forUri(DartSdk.DART_HTML); | 4283 Source htmlLibSource = _context.sourceFactory.forUri(DartSdk.DART_HTML); |
| 4276 visited.add(this); | 4284 visited.add(this); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 4295 } | 4303 } |
| 4296 } | 4304 } |
| 4297 /** | 4305 /** |
| 4298 * Instances of the class `LocalVariableElementImpl` implement a `LocalVariableE
lement`. | 4306 * Instances of the class `LocalVariableElementImpl` implement a `LocalVariableE
lement`. |
| 4299 * | 4307 * |
| 4300 * @coverage dart.engine.element | 4308 * @coverage dart.engine.element |
| 4301 */ | 4309 */ |
| 4302 class LocalVariableElementImpl extends VariableElementImpl implements LocalVaria
bleElement { | 4310 class LocalVariableElementImpl extends VariableElementImpl implements LocalVaria
bleElement { |
| 4303 | 4311 |
| 4304 /** | 4312 /** |
| 4313 * Is `true` if this variable is potentially mutated somewhere in its scope. |
| 4314 */ |
| 4315 bool _isPotentiallyMutated2 = false; |
| 4316 |
| 4317 /** |
| 4305 * The offset to the beginning of the visible range for this element. | 4318 * The offset to the beginning of the visible range for this element. |
| 4306 */ | 4319 */ |
| 4307 int _visibleRangeOffset = 0; | 4320 int _visibleRangeOffset = 0; |
| 4308 | 4321 |
| 4309 /** | 4322 /** |
| 4310 * The length of the visible range for this element, or `-1` if this element d
oes not have a | 4323 * The length of the visible range for this element, or `-1` if this element d
oes not have a |
| 4311 * visible range. | 4324 * visible range. |
| 4312 */ | 4325 */ |
| 4313 int _visibleRangeLength = -1; | 4326 int _visibleRangeLength = -1; |
| 4314 | 4327 |
| 4315 /** | 4328 /** |
| 4316 * An empty array of field elements. | 4329 * An empty array of field elements. |
| 4317 */ | 4330 */ |
| 4318 static List<LocalVariableElement> EMPTY_ARRAY = new List<LocalVariableElement>
(0); | 4331 static List<LocalVariableElement> EMPTY_ARRAY = new List<LocalVariableElement>
(0); |
| 4319 | 4332 |
| 4320 /** | 4333 /** |
| 4321 * Initialize a newly created local variable element to have the given name. | 4334 * Initialize a newly created local variable element to have the given name. |
| 4322 * | 4335 * |
| 4323 * @param name the name of this element | 4336 * @param name the name of this element |
| 4324 */ | 4337 */ |
| 4325 LocalVariableElementImpl(Identifier name) : super.con1(name); | 4338 LocalVariableElementImpl(Identifier name) : super.con1(name); |
| 4326 accept(ElementVisitor visitor) => visitor.visitLocalVariableElement(this); | 4339 accept(ElementVisitor visitor) => visitor.visitLocalVariableElement(this); |
| 4327 ElementKind get kind => ElementKind.LOCAL_VARIABLE; | 4340 ElementKind get kind => ElementKind.LOCAL_VARIABLE; |
| 4328 SourceRange get visibleRange { | 4341 SourceRange get visibleRange { |
| 4329 if (_visibleRangeLength < 0) { | 4342 if (_visibleRangeLength < 0) { |
| 4330 return null; | 4343 return null; |
| 4331 } | 4344 } |
| 4332 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); | 4345 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); |
| 4333 } | 4346 } |
| 4347 bool get isPotentiallyMutated => _isPotentiallyMutated2; |
| 4348 |
| 4349 /** |
| 4350 * Specifies that this variable is potentially mutated somewhere in its scope. |
| 4351 */ |
| 4352 void markPotentiallyMutated() { |
| 4353 _isPotentiallyMutated2 = true; |
| 4354 } |
| 4334 | 4355 |
| 4335 /** | 4356 /** |
| 4336 * Set the visible range for this element to the range starting at the given o
ffset with the given | 4357 * Set the visible range for this element to the range starting at the given o
ffset with the given |
| 4337 * length. | 4358 * length. |
| 4338 * | 4359 * |
| 4339 * @param offset the offset to the beginning of the visible range for this ele
ment | 4360 * @param offset the offset to the beginning of the visible range for this ele
ment |
| 4340 * @param length the length of the visible range for this element, or `-1` if
this element | 4361 * @param length the length of the visible range for this element, or `-1` if
this element |
| 4341 * does not have a visible range | 4362 * does not have a visible range |
| 4342 */ | 4363 */ |
| 4343 void setVisibleRange(int offset, int length) { | 4364 void setVisibleRange(int offset, int length) { |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4583 } | 4604 } |
| 4584 } | 4605 } |
| 4585 /** | 4606 /** |
| 4586 * Instances of the class `ParameterElementImpl` implement a `ParameterElement`. | 4607 * Instances of the class `ParameterElementImpl` implement a `ParameterElement`. |
| 4587 * | 4608 * |
| 4588 * @coverage dart.engine.element | 4609 * @coverage dart.engine.element |
| 4589 */ | 4610 */ |
| 4590 class ParameterElementImpl extends VariableElementImpl implements ParameterEleme
nt { | 4611 class ParameterElementImpl extends VariableElementImpl implements ParameterEleme
nt { |
| 4591 | 4612 |
| 4592 /** | 4613 /** |
| 4614 * Is `true` if this variable is potentially mutated somewhere in its scope. |
| 4615 */ |
| 4616 bool _isPotentiallyMutated3 = false; |
| 4617 |
| 4618 /** |
| 4593 * An array containing all of the parameters defined by this parameter element
. There will only be | 4619 * An array containing all of the parameters defined by this parameter element
. There will only be |
| 4594 * parameters if this parameter is a function typed parameter. | 4620 * parameters if this parameter is a function typed parameter. |
| 4595 */ | 4621 */ |
| 4596 List<ParameterElement> _parameters = ParameterElementImpl.EMPTY_ARRAY; | 4622 List<ParameterElement> _parameters = ParameterElementImpl.EMPTY_ARRAY; |
| 4597 | 4623 |
| 4598 /** | 4624 /** |
| 4599 * The kind of this parameter. | 4625 * The kind of this parameter. |
| 4600 */ | 4626 */ |
| 4601 ParameterKind _parameterKind; | 4627 ParameterKind _parameterKind; |
| 4602 | 4628 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4652 ElementKind get kind => ElementKind.PARAMETER; | 4678 ElementKind get kind => ElementKind.PARAMETER; |
| 4653 ParameterKind get parameterKind => _parameterKind; | 4679 ParameterKind get parameterKind => _parameterKind; |
| 4654 List<ParameterElement> get parameters => _parameters; | 4680 List<ParameterElement> get parameters => _parameters; |
| 4655 SourceRange get visibleRange { | 4681 SourceRange get visibleRange { |
| 4656 if (_visibleRangeLength < 0) { | 4682 if (_visibleRangeLength < 0) { |
| 4657 return null; | 4683 return null; |
| 4658 } | 4684 } |
| 4659 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); | 4685 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); |
| 4660 } | 4686 } |
| 4661 bool get isInitializingFormal => false; | 4687 bool get isInitializingFormal => false; |
| 4688 bool get isPotentiallyMutated => _isPotentiallyMutated3; |
| 4689 |
| 4690 /** |
| 4691 * Specifies that this variable is potentially mutated somewhere in its scope. |
| 4692 */ |
| 4693 void markPotentiallyMutated() { |
| 4694 _isPotentiallyMutated3 = true; |
| 4695 } |
| 4662 | 4696 |
| 4663 /** | 4697 /** |
| 4664 * Set the range of the default value for this parameter to the range starting
at the given offset | 4698 * Set the range of the default value for this parameter to the range starting
at the given offset |
| 4665 * with the given length. | 4699 * with the given length. |
| 4666 * | 4700 * |
| 4667 * @param offset the offset to the beginning of the default value range for th
is element | 4701 * @param offset the offset to the beginning of the default value range for th
is element |
| 4668 * @param length the length of the default value range for this element, or `-
1` if this | 4702 * @param length the length of the default value range for this element, or `-
1` if this |
| 4669 * element does not have a default value | 4703 * element does not have a default value |
| 4670 */ | 4704 */ |
| 4671 void setDefaultValueRange(int offset, int length) { | 4705 void setDefaultValueRange(int offset, int length) { |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4831 return ElementKind.SETTER; | 4865 return ElementKind.SETTER; |
| 4832 } | 4866 } |
| 4833 String get name { | 4867 String get name { |
| 4834 if (isSetter) { | 4868 if (isSetter) { |
| 4835 return "${super.name}="; | 4869 return "${super.name}="; |
| 4836 } | 4870 } |
| 4837 return super.name; | 4871 return super.name; |
| 4838 } | 4872 } |
| 4839 PropertyInducingElement get variable => _variable; | 4873 PropertyInducingElement get variable => _variable; |
| 4840 bool get isAbstract => hasModifier(Modifier.ABSTRACT); | 4874 bool get isAbstract => hasModifier(Modifier.ABSTRACT); |
| 4841 bool get isExcludedSetter => isSetter && _variable.isFinal; | |
| 4842 bool get isGetter => hasModifier(Modifier.GETTER); | 4875 bool get isGetter => hasModifier(Modifier.GETTER); |
| 4843 bool get isSetter => hasModifier(Modifier.SETTER); | 4876 bool get isSetter => hasModifier(Modifier.SETTER); |
| 4844 bool get isStatic => hasModifier(Modifier.STATIC); | 4877 bool get isStatic => hasModifier(Modifier.STATIC); |
| 4845 | 4878 |
| 4846 /** | 4879 /** |
| 4847 * Set whether this accessor is abstract to correspond to the given value. | 4880 * Set whether this accessor is abstract to correspond to the given value. |
| 4848 * | 4881 * |
| 4849 * @param isAbstract `true` if the accessor is abstract | 4882 * @param isAbstract `true` if the accessor is abstract |
| 4850 */ | 4883 */ |
| 4851 void set abstract(bool isAbstract) { | 4884 void set abstract(bool isAbstract) { |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5151 * | 5184 * |
| 5152 * @return the result of evaluating this variable's initializer | 5185 * @return the result of evaluating this variable's initializer |
| 5153 */ | 5186 */ |
| 5154 EvaluationResultImpl get evaluationResult => null; | 5187 EvaluationResultImpl get evaluationResult => null; |
| 5155 FunctionElement get initializer => _initializer; | 5188 FunctionElement get initializer => _initializer; |
| 5156 Type2 get type => _type; | 5189 Type2 get type => _type; |
| 5157 bool get isConst => hasModifier(Modifier.CONST); | 5190 bool get isConst => hasModifier(Modifier.CONST); |
| 5158 bool get isFinal => hasModifier(Modifier.FINAL); | 5191 bool get isFinal => hasModifier(Modifier.FINAL); |
| 5159 | 5192 |
| 5160 /** | 5193 /** |
| 5194 * Return `true` if this variable is potentially mutated somewhere in its scop
e. This |
| 5195 * information is only available for local variables (including parameters). |
| 5196 * |
| 5197 * @return `true` if this variable is potentially mutated somewhere in its sco
pe |
| 5198 */ |
| 5199 bool get isPotentiallyMutated => false; |
| 5200 |
| 5201 /** |
| 5161 * Set whether this variable is const to correspond to the given value. | 5202 * Set whether this variable is const to correspond to the given value. |
| 5162 * | 5203 * |
| 5163 * @param isConst `true` if the variable is const | 5204 * @param isConst `true` if the variable is const |
| 5164 */ | 5205 */ |
| 5165 void set const3(bool isConst) { | 5206 void set const3(bool isConst) { |
| 5166 setModifier(Modifier.CONST, isConst); | 5207 setModifier(Modifier.CONST, isConst); |
| 5167 } | 5208 } |
| 5168 | 5209 |
| 5169 /** | 5210 /** |
| 5170 * Set the result of evaluating this variable's initializer as a compile-time
constant expression | 5211 * Set the result of evaluating this variable's initializer as a compile-time
constant expression |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5710 PropertyAccessorElement get correspondingSetter => from(baseElement.correspond
ingSetter, definingType); | 5751 PropertyAccessorElement get correspondingSetter => from(baseElement.correspond
ingSetter, definingType); |
| 5711 Element get enclosingElement => baseElement.enclosingElement; | 5752 Element get enclosingElement => baseElement.enclosingElement; |
| 5712 PropertyInducingElement get variable { | 5753 PropertyInducingElement get variable { |
| 5713 PropertyInducingElement variable = baseElement.variable; | 5754 PropertyInducingElement variable = baseElement.variable; |
| 5714 if (variable is FieldElement) { | 5755 if (variable is FieldElement) { |
| 5715 return FieldMember.from(variable as FieldElement, definingType); | 5756 return FieldMember.from(variable as FieldElement, definingType); |
| 5716 } | 5757 } |
| 5717 return variable; | 5758 return variable; |
| 5718 } | 5759 } |
| 5719 bool get isAbstract => baseElement.isAbstract; | 5760 bool get isAbstract => baseElement.isAbstract; |
| 5720 bool get isExcludedSetter => baseElement.isExcludedSetter; | |
| 5721 bool get isGetter => baseElement.isGetter; | 5761 bool get isGetter => baseElement.isGetter; |
| 5722 bool get isSetter => baseElement.isSetter; | 5762 bool get isSetter => baseElement.isSetter; |
| 5723 String toString() { | 5763 String toString() { |
| 5724 PropertyAccessorElement baseElement = this.baseElement; | 5764 PropertyAccessorElement baseElement = this.baseElement; |
| 5725 List<ParameterElement> parameters = this.parameters; | 5765 List<ParameterElement> parameters = this.parameters; |
| 5726 FunctionType type = this.type; | 5766 FunctionType type = this.type; |
| 5727 JavaStringBuilder builder = new JavaStringBuilder(); | 5767 JavaStringBuilder builder = new JavaStringBuilder(); |
| 5728 if (isGetter) { | 5768 if (isGetter) { |
| 5729 builder.append("get "); | 5769 builder.append("get "); |
| 5730 } else { | 5770 } else { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5813 static final DynamicTypeImpl instance = new DynamicTypeImpl(); | 5853 static final DynamicTypeImpl instance = new DynamicTypeImpl(); |
| 5814 | 5854 |
| 5815 /** | 5855 /** |
| 5816 * Prevent the creation of instances of this class. | 5856 * Prevent the creation of instances of this class. |
| 5817 */ | 5857 */ |
| 5818 DynamicTypeImpl() : super(new DynamicElementImpl(), Keyword.DYNAMIC.syntax) { | 5858 DynamicTypeImpl() : super(new DynamicElementImpl(), Keyword.DYNAMIC.syntax) { |
| 5819 ((element as DynamicElementImpl)).type = this; | 5859 ((element as DynamicElementImpl)).type = this; |
| 5820 } | 5860 } |
| 5821 bool operator ==(Object object) => object is DynamicTypeImpl; | 5861 bool operator ==(Object object) => object is DynamicTypeImpl; |
| 5822 bool get isDynamic => true; | 5862 bool get isDynamic => true; |
| 5823 bool isMoreSpecificThan(Type2 type) => false; | 5863 bool isMoreSpecificThan(Type2 type) { |
| 5864 if (identical(this, type)) { |
| 5865 return true; |
| 5866 } |
| 5867 return false; |
| 5868 } |
| 5824 bool isSubtypeOf(Type2 type) => true; | 5869 bool isSubtypeOf(Type2 type) => true; |
| 5825 bool isSupertypeOf(Type2 type) => true; | 5870 bool isSupertypeOf(Type2 type) => true; |
| 5826 Type2 substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes) { | 5871 Type2 substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes) { |
| 5827 int length = parameterTypes.length; | 5872 int length = parameterTypes.length; |
| 5828 for (int i = 0; i < length; i++) { | 5873 for (int i = 0; i < length; i++) { |
| 5829 if (parameterTypes[i] == this) { | 5874 if (parameterTypes[i] == this) { |
| 5830 return argumentTypes[i]; | 5875 return argumentTypes[i]; |
| 5831 } | 5876 } |
| 5832 } | 5877 } |
| 5833 return this; | 5878 return this; |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6034 return TypeParameterElementImpl.EMPTY_ARRAY; | 6079 return TypeParameterElementImpl.EMPTY_ARRAY; |
| 6035 } | 6080 } |
| 6036 int get hashCode { | 6081 int get hashCode { |
| 6037 Element element = this.element; | 6082 Element element = this.element; |
| 6038 if (element == null) { | 6083 if (element == null) { |
| 6039 return 0; | 6084 return 0; |
| 6040 } | 6085 } |
| 6041 return element.hashCode; | 6086 return element.hashCode; |
| 6042 } | 6087 } |
| 6043 bool isAssignableTo(Type2 type) => this.isSubtypeOf(type); | 6088 bool isAssignableTo(Type2 type) => this.isSubtypeOf(type); |
| 6089 bool isMoreSpecificThan(Type2 type) { |
| 6090 if (type == null) { |
| 6091 return false; |
| 6092 } else if (identical(this, type) || type.isDynamic || type.isDartCoreFunctio
n || type.isObject) { |
| 6093 return true; |
| 6094 } else if (type is! FunctionType) { |
| 6095 return false; |
| 6096 } else if (this == type) { |
| 6097 return true; |
| 6098 } |
| 6099 FunctionType t = this; |
| 6100 FunctionType s = type as FunctionType; |
| 6101 List<Type2> tTypes = t.normalParameterTypes; |
| 6102 List<Type2> tOpTypes = t.optionalParameterTypes; |
| 6103 List<Type2> sTypes = s.normalParameterTypes; |
| 6104 List<Type2> sOpTypes = s.optionalParameterTypes; |
| 6105 if ((sOpTypes.length > 0 && t.namedParameterTypes.length > 0) || (tOpTypes.l
ength > 0 && s.namedParameterTypes.length > 0)) { |
| 6106 return false; |
| 6107 } |
| 6108 if (t.namedParameterTypes.length > 0) { |
| 6109 if (t.normalParameterTypes.length != s.normalParameterTypes.length) { |
| 6110 return false; |
| 6111 } else if (t.normalParameterTypes.length > 0) { |
| 6112 for (int i = 0; i < tTypes.length; i++) { |
| 6113 if (!tTypes[i].isMoreSpecificThan(sTypes[i])) { |
| 6114 return false; |
| 6115 } |
| 6116 } |
| 6117 } |
| 6118 Map<String, Type2> namedTypesT = t.namedParameterTypes; |
| 6119 Map<String, Type2> namedTypesS = s.namedParameterTypes; |
| 6120 if (namedTypesT.length < namedTypesS.length) { |
| 6121 return false; |
| 6122 } |
| 6123 JavaIterator<MapEntry<String, Type2>> iteratorS = new JavaIterator(getMapE
ntrySet(namedTypesS)); |
| 6124 while (iteratorS.hasNext) { |
| 6125 MapEntry<String, Type2> entryS = iteratorS.next(); |
| 6126 Type2 typeT = namedTypesT[entryS.getKey()]; |
| 6127 if (typeT == null) { |
| 6128 return false; |
| 6129 } |
| 6130 if (!typeT.isMoreSpecificThan(entryS.getValue())) { |
| 6131 return false; |
| 6132 } |
| 6133 } |
| 6134 } else if (s.namedParameterTypes.length > 0) { |
| 6135 return false; |
| 6136 } else { |
| 6137 int tArgLength = tTypes.length + tOpTypes.length; |
| 6138 int sArgLength = sTypes.length + sOpTypes.length; |
| 6139 if (tArgLength < sArgLength || sTypes.length < tTypes.length) { |
| 6140 return false; |
| 6141 } |
| 6142 if (tOpTypes.length == 0 && sOpTypes.length == 0) { |
| 6143 for (int i = 0; i < sTypes.length; i++) { |
| 6144 if (!tTypes[i].isMoreSpecificThan(sTypes[i])) { |
| 6145 return false; |
| 6146 } |
| 6147 } |
| 6148 } else { |
| 6149 List<Type2> tAllTypes = new List<Type2>(sArgLength); |
| 6150 for (int i = 0; i < tTypes.length; i++) { |
| 6151 tAllTypes[i] = tTypes[i]; |
| 6152 } |
| 6153 for (int i = tTypes.length, j = 0; i < sArgLength; i++, j++) { |
| 6154 tAllTypes[i] = tOpTypes[j]; |
| 6155 } |
| 6156 List<Type2> sAllTypes = new List<Type2>(sArgLength); |
| 6157 for (int i = 0; i < sTypes.length; i++) { |
| 6158 sAllTypes[i] = sTypes[i]; |
| 6159 } |
| 6160 for (int i = sTypes.length, j = 0; i < sArgLength; i++, j++) { |
| 6161 sAllTypes[i] = sOpTypes[j]; |
| 6162 } |
| 6163 for (int i = 0; i < sAllTypes.length; i++) { |
| 6164 if (!tAllTypes[i].isMoreSpecificThan(sAllTypes[i])) { |
| 6165 return false; |
| 6166 } |
| 6167 } |
| 6168 } |
| 6169 } |
| 6170 Type2 tRetType = t.returnType; |
| 6171 Type2 sRetType = s.returnType; |
| 6172 return sRetType.isVoid || tRetType.isMoreSpecificThan(sRetType); |
| 6173 } |
| 6044 bool isSubtypeOf(Type2 type) { | 6174 bool isSubtypeOf(Type2 type) { |
| 6045 if (type == null) { | 6175 if (type == null) { |
| 6046 return false; | 6176 return false; |
| 6047 } else if (identical(this, type) || type.isDynamic || type.isDartCoreFunctio
n || type.isObject) { | 6177 } else if (identical(this, type) || type.isDynamic || type.isDartCoreFunctio
n || type.isObject) { |
| 6048 return true; | 6178 return true; |
| 6049 } else if (type is! FunctionType) { | 6179 } else if (type is! FunctionType) { |
| 6050 return false; | 6180 return false; |
| 6051 } else if (this == type) { | 6181 } else if (this == type) { |
| 6052 return true; | 6182 return true; |
| 6053 } | 6183 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 6075 if (namedTypesT.length < namedTypesS.length) { | 6205 if (namedTypesT.length < namedTypesS.length) { |
| 6076 return false; | 6206 return false; |
| 6077 } | 6207 } |
| 6078 JavaIterator<MapEntry<String, Type2>> iteratorS = new JavaIterator(getMapE
ntrySet(namedTypesS)); | 6208 JavaIterator<MapEntry<String, Type2>> iteratorS = new JavaIterator(getMapE
ntrySet(namedTypesS)); |
| 6079 while (iteratorS.hasNext) { | 6209 while (iteratorS.hasNext) { |
| 6080 MapEntry<String, Type2> entryS = iteratorS.next(); | 6210 MapEntry<String, Type2> entryS = iteratorS.next(); |
| 6081 Type2 typeT = namedTypesT[entryS.getKey()]; | 6211 Type2 typeT = namedTypesT[entryS.getKey()]; |
| 6082 if (typeT == null) { | 6212 if (typeT == null) { |
| 6083 return false; | 6213 return false; |
| 6084 } | 6214 } |
| 6085 if (!entryS.getValue().isAssignableTo(typeT)) { | 6215 if (!typeT.isAssignableTo(entryS.getValue())) { |
| 6086 return false; | 6216 return false; |
| 6087 } | 6217 } |
| 6088 } | 6218 } |
| 6089 } else if (s.namedParameterTypes.length > 0) { | 6219 } else if (s.namedParameterTypes.length > 0) { |
| 6090 return false; | 6220 return false; |
| 6091 } else { | 6221 } else { |
| 6092 int tArgLength = tTypes.length + tOpTypes.length; | 6222 int tArgLength = tTypes.length + tOpTypes.length; |
| 6093 int sArgLength = sTypes.length + sOpTypes.length; | 6223 int sArgLength = sTypes.length + sOpTypes.length; |
| 6094 if (tArgLength < sArgLength || sTypes.length < tTypes.length) { | 6224 if (tArgLength < sArgLength || sTypes.length < tTypes.length) { |
| 6095 return false; | 6225 return false; |
| 6096 } | 6226 } |
| 6097 if (tOpTypes.length == 0 && sOpTypes.length == 0) { | 6227 if (tOpTypes.length == 0 && sOpTypes.length == 0) { |
| 6098 for (int i = 0; i < sTypes.length; i++) { | 6228 for (int i = 0; i < sTypes.length; i++) { |
| 6099 if (!sTypes[i].isAssignableTo(tTypes[i])) { | 6229 if (!tTypes[i].isAssignableTo(sTypes[i])) { |
| 6100 return false; | 6230 return false; |
| 6101 } | 6231 } |
| 6102 } | 6232 } |
| 6103 } else { | 6233 } else { |
| 6104 List<Type2> tAllTypes = new List<Type2>(sArgLength); | 6234 List<Type2> tAllTypes = new List<Type2>(sArgLength); |
| 6105 for (int i = 0; i < tTypes.length; i++) { | 6235 for (int i = 0; i < tTypes.length; i++) { |
| 6106 tAllTypes[i] = tTypes[i]; | 6236 tAllTypes[i] = tTypes[i]; |
| 6107 } | 6237 } |
| 6108 for (int i = tTypes.length, j = 0; i < sArgLength; i++, j++) { | 6238 for (int i = tTypes.length, j = 0; i < sArgLength; i++, j++) { |
| 6109 tAllTypes[i] = tOpTypes[j]; | 6239 tAllTypes[i] = tOpTypes[j]; |
| 6110 } | 6240 } |
| 6111 List<Type2> sAllTypes = new List<Type2>(sArgLength); | 6241 List<Type2> sAllTypes = new List<Type2>(sArgLength); |
| 6112 for (int i = 0; i < sTypes.length; i++) { | 6242 for (int i = 0; i < sTypes.length; i++) { |
| 6113 sAllTypes[i] = sTypes[i]; | 6243 sAllTypes[i] = sTypes[i]; |
| 6114 } | 6244 } |
| 6115 for (int i = sTypes.length, j = 0; i < sArgLength; i++, j++) { | 6245 for (int i = sTypes.length, j = 0; i < sArgLength; i++, j++) { |
| 6116 sAllTypes[i] = sOpTypes[j]; | 6246 sAllTypes[i] = sOpTypes[j]; |
| 6117 } | 6247 } |
| 6118 for (int i = 0; i < sAllTypes.length; i++) { | 6248 for (int i = 0; i < sAllTypes.length; i++) { |
| 6119 if (!sAllTypes[i].isAssignableTo(tAllTypes[i])) { | 6249 if (!tAllTypes[i].isAssignableTo(sAllTypes[i])) { |
| 6120 return false; | 6250 return false; |
| 6121 } | 6251 } |
| 6122 } | 6252 } |
| 6123 } | 6253 } |
| 6124 } | 6254 } |
| 6125 return s.returnType == VoidTypeImpl.instance || t.returnType.isAssignableTo(
s.returnType); | 6255 Type2 tRetType = t.returnType; |
| 6256 Type2 sRetType = s.returnType; |
| 6257 return sRetType.isVoid || tRetType.isAssignableTo(sRetType); |
| 6126 } | 6258 } |
| 6127 | 6259 |
| 6128 /** | 6260 /** |
| 6129 * Set the actual types of the type arguments to the given types. | 6261 * Set the actual types of the type arguments to the given types. |
| 6130 * | 6262 * |
| 6131 * @param typeArguments the actual types of the type arguments | 6263 * @param typeArguments the actual types of the type arguments |
| 6132 */ | 6264 */ |
| 6133 void set typeArguments(List<Type2> typeArguments) { | 6265 void set typeArguments(List<Type2> typeArguments) { |
| 6134 this._typeArguments = typeArguments; | 6266 this._typeArguments = typeArguments; |
| 6135 } | 6267 } |
| (...skipping 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7656 } | 7788 } |
| 7657 /** | 7789 /** |
| 7658 * The interface `VoidType` defines the behavior of the unique object representi
ng the type | 7790 * The interface `VoidType` defines the behavior of the unique object representi
ng the type |
| 7659 * `void`. | 7791 * `void`. |
| 7660 * | 7792 * |
| 7661 * @coverage dart.engine.type | 7793 * @coverage dart.engine.type |
| 7662 */ | 7794 */ |
| 7663 abstract class VoidType implements Type2 { | 7795 abstract class VoidType implements Type2 { |
| 7664 VoidType substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes); | 7796 VoidType substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes); |
| 7665 } | 7797 } |
| OLD | NEW |