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 analyzer.src.dart.element.element; | 5 library analyzer.src.dart.element.element; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 import 'dart:math' show min; | 8 import 'dart:math' show min; |
9 | 9 |
10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
(...skipping 5365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5376 | 5376 |
5377 /** | 5377 /** |
5378 * Set whether this method is abstract. | 5378 * Set whether this method is abstract. |
5379 */ | 5379 */ |
5380 void set abstract(bool isAbstract) { | 5380 void set abstract(bool isAbstract) { |
5381 assert(serializedExecutable == null); | 5381 assert(serializedExecutable == null); |
5382 setModifier(Modifier.ABSTRACT, isAbstract); | 5382 setModifier(Modifier.ABSTRACT, isAbstract); |
5383 } | 5383 } |
5384 | 5384 |
5385 @override | 5385 @override |
5386 List<DartType> get allEnclosingTypeParameterTypes { | 5386 List<TypeParameterType> get allEnclosingTypeParameterTypes { |
5387 if (isStatic) { | 5387 if (isStatic) { |
5388 return const <DartType>[]; | 5388 return const <TypeParameterType>[]; |
5389 } | 5389 } |
5390 return super.allEnclosingTypeParameterTypes; | 5390 return super.allEnclosingTypeParameterTypes; |
5391 } | 5391 } |
5392 | 5392 |
5393 @override | 5393 @override |
5394 String get displayName { | 5394 String get displayName { |
5395 String displayName = super.displayName; | 5395 String displayName = super.displayName; |
5396 if ("unary-" == displayName) { | 5396 if ("unary-" == displayName) { |
5397 return "-"; | 5397 return "-"; |
5398 } | 5398 } |
(...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6619 | 6619 |
6620 /** | 6620 /** |
6621 * Set whether this accessor is abstract. | 6621 * Set whether this accessor is abstract. |
6622 */ | 6622 */ |
6623 void set abstract(bool isAbstract) { | 6623 void set abstract(bool isAbstract) { |
6624 assert(serializedExecutable == null); | 6624 assert(serializedExecutable == null); |
6625 setModifier(Modifier.ABSTRACT, isAbstract); | 6625 setModifier(Modifier.ABSTRACT, isAbstract); |
6626 } | 6626 } |
6627 | 6627 |
6628 @override | 6628 @override |
6629 List<DartType> get allEnclosingTypeParameterTypes { | 6629 List<TypeParameterType> get allEnclosingTypeParameterTypes { |
6630 if (isStatic) { | 6630 if (isStatic) { |
6631 return const <DartType>[]; | 6631 return const <TypeParameterType>[]; |
6632 } | 6632 } |
6633 return super.allEnclosingTypeParameterTypes; | 6633 return super.allEnclosingTypeParameterTypes; |
6634 } | 6634 } |
6635 | 6635 |
6636 @override | 6636 @override |
6637 PropertyAccessorElement get correspondingGetter { | 6637 PropertyAccessorElement get correspondingGetter { |
6638 if (isGetter || variable == null) { | 6638 if (isGetter || variable == null) { |
6639 return null; | 6639 return null; |
6640 } | 6640 } |
6641 return variable.getter; | 6641 return variable.getter; |
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7262 } | 7262 } |
7263 } | 7263 } |
7264 | 7264 |
7265 /** | 7265 /** |
7266 * Mixin representing an element which can have type parameters. | 7266 * Mixin representing an element which can have type parameters. |
7267 */ | 7267 */ |
7268 abstract class TypeParameterizedElementMixin | 7268 abstract class TypeParameterizedElementMixin |
7269 implements TypeParameterizedElement, ElementImpl { | 7269 implements TypeParameterizedElement, ElementImpl { |
7270 int _nestingLevel; | 7270 int _nestingLevel; |
7271 List<TypeParameterElement> _typeParameterElements; | 7271 List<TypeParameterElement> _typeParameterElements; |
7272 List<DartType> _typeParameterTypes; | 7272 List<TypeParameterType> _typeParameterTypes; |
7273 List<DartType> _allTypeParameterTypes; | 7273 List<TypeParameterType> _allTypeParameterTypes; |
7274 | 7274 |
7275 /** | 7275 /** |
7276 * Return all type parameter types of the element that encloses element. | 7276 * Return all type parameter types of the element that encloses element. |
7277 * Not `null`, but might be empty for top-level and static class members. | 7277 * Not `null`, but might be empty for top-level and static class members. |
7278 */ | 7278 */ |
7279 List<DartType> get allEnclosingTypeParameterTypes { | 7279 List<TypeParameterType> get allEnclosingTypeParameterTypes { |
7280 return enclosingTypeParameterContext?.allTypeParameterTypes ?? | 7280 return enclosingTypeParameterContext?.allTypeParameterTypes ?? |
7281 const <DartType>[]; | 7281 const <TypeParameterType>[]; |
7282 } | 7282 } |
7283 | 7283 |
7284 /** | 7284 /** |
7285 * Return all type parameter types of this element. | 7285 * Return all type parameter types of this element. |
7286 */ | 7286 */ |
7287 List<DartType> get allTypeParameterTypes { | 7287 List<TypeParameterType> get allTypeParameterTypes { |
7288 if (_allTypeParameterTypes == null) { | 7288 if (_allTypeParameterTypes == null) { |
7289 _allTypeParameterTypes = <DartType>[]; | 7289 _allTypeParameterTypes = <TypeParameterType>[]; |
7290 // The most logical order would be (enclosing, this). | 7290 // The most logical order would be (enclosing, this). |
7291 // But we have to have it like this to be consistent with (inconsistent | 7291 // But we have to have it like this to be consistent with (inconsistent |
7292 // by itself) element builder for generic functions. | 7292 // by itself) element builder for generic functions. |
7293 _allTypeParameterTypes.addAll(typeParameterTypes); | 7293 _allTypeParameterTypes.addAll(typeParameterTypes); |
7294 _allTypeParameterTypes.addAll(allEnclosingTypeParameterTypes); | 7294 _allTypeParameterTypes.addAll(allEnclosingTypeParameterTypes); |
7295 } | 7295 } |
7296 return _allTypeParameterTypes; | 7296 return _allTypeParameterTypes; |
7297 } | 7297 } |
7298 | 7298 |
7299 /** | 7299 /** |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7613 | 7613 |
7614 @override | 7614 @override |
7615 void visitElement(Element element) { | 7615 void visitElement(Element element) { |
7616 int offset = element.nameOffset; | 7616 int offset = element.nameOffset; |
7617 if (offset != -1) { | 7617 if (offset != -1) { |
7618 map[offset] = element; | 7618 map[offset] = element; |
7619 } | 7619 } |
7620 super.visitElement(element); | 7620 super.visitElement(element); |
7621 } | 7621 } |
7622 } | 7622 } |
OLD | NEW |