| 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.element; | 5 library engine.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/src/generated/utilities_general.dart'; | 10 import 'package:analyzer/src/generated/utilities_general.dart'; |
| (...skipping 4496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4507 getNodeMatching((node) => node is FunctionDeclaration); | 4507 getNodeMatching((node) => node is FunctionDeclaration); |
| 4508 | 4508 |
| 4509 /** | 4509 /** |
| 4510 * Set the visible range for this element to the range starting at the given | 4510 * Set the visible range for this element to the range starting at the given |
| 4511 * [offset] with the given [length]. | 4511 * [offset] with the given [length]. |
| 4512 */ | 4512 */ |
| 4513 void setVisibleRange(int offset, int length) { | 4513 void setVisibleRange(int offset, int length) { |
| 4514 _visibleRangeOffset = offset; | 4514 _visibleRangeOffset = offset; |
| 4515 _visibleRangeLength = length; | 4515 _visibleRangeLength = length; |
| 4516 } | 4516 } |
| 4517 |
| 4518 /** |
| 4519 * Set the parameters defined by this type alias to the given [parameters] |
| 4520 * without becoming the parent of the parameters. This should only be used by |
| 4521 * the [TypeResolverVisitor] when creating a synthetic type alias. |
| 4522 */ |
| 4523 void shareParameters(List<ParameterElement> parameters) { |
| 4524 this._parameters = parameters; |
| 4525 } |
| 4517 } | 4526 } |
| 4518 | 4527 |
| 4519 /** | 4528 /** |
| 4520 * The type of a function, method, constructor, getter, or setter. Function | 4529 * The type of a function, method, constructor, getter, or setter. Function |
| 4521 * types come in three variations: | 4530 * types come in three variations: |
| 4522 * | 4531 * |
| 4523 * * The types of functions that only have required parameters. These have the | 4532 * * The types of functions that only have required parameters. These have the |
| 4524 * general form <i>(T<sub>1</sub>, …, T<sub>n</sub>) → T</i>. | 4533 * general form <i>(T<sub>1</sub>, …, T<sub>n</sub>) → T</i>. |
| 4525 * * The types of functions with optional positional parameters. These have the | 4534 * * The types of functions with optional positional parameters. These have the |
| 4526 * general form <i>(T<sub>1</sub>, …, T<sub>n</sub>, [T<sub>n+1</sub> | 4535 * general form <i>(T<sub>1</sub>, …, T<sub>n</sub>, [T<sub>n+1</sub> |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4813 } | 4822 } |
| 4814 for (TypeParameterElement typeParameter in _typeParameters) { | 4823 for (TypeParameterElement typeParameter in _typeParameters) { |
| 4815 if ((typeParameter as TypeParameterElementImpl).identifier == | 4824 if ((typeParameter as TypeParameterElementImpl).identifier == |
| 4816 identifier) { | 4825 identifier) { |
| 4817 return typeParameter as TypeParameterElementImpl; | 4826 return typeParameter as TypeParameterElementImpl; |
| 4818 } | 4827 } |
| 4819 } | 4828 } |
| 4820 return null; | 4829 return null; |
| 4821 } | 4830 } |
| 4822 | 4831 |
| 4823 /** | |
| 4824 * Set the parameters defined by this type alias to the given [parameters] | |
| 4825 * without becoming the parent of the parameters. This should only be used by | |
| 4826 * the [TypeResolverVisitor] when creating a synthetic type alias. | |
| 4827 */ | |
| 4828 void shareParameters(List<ParameterElement> parameters) { | |
| 4829 this._parameters = parameters; | |
| 4830 } | |
| 4831 | |
| 4832 /** | |
| 4833 * Set the type parameters defined for this type to the given [typeParameters] | |
| 4834 * without becoming the parent of the parameters. This should only be used by | |
| 4835 * the [TypeResolverVisitor] when creating a synthetic type alias. | |
| 4836 */ | |
| 4837 void shareTypeParameters(List<TypeParameterElement> typeParameters) { | |
| 4838 this._typeParameters = typeParameters; | |
| 4839 } | |
| 4840 | |
| 4841 @override | 4832 @override |
| 4842 void visitChildren(ElementVisitor visitor) { | 4833 void visitChildren(ElementVisitor visitor) { |
| 4843 super.visitChildren(visitor); | 4834 super.visitChildren(visitor); |
| 4844 safelyVisitChildren(_parameters, visitor); | 4835 safelyVisitChildren(_parameters, visitor); |
| 4845 safelyVisitChildren(_typeParameters, visitor); | 4836 safelyVisitChildren(_typeParameters, visitor); |
| 4846 } | 4837 } |
| 4847 } | 4838 } |
| 4848 | 4839 |
| 4849 /** | 4840 /** |
| 4850 * The type of a function, method, constructor, getter, or setter. | 4841 * The type of a function, method, constructor, getter, or setter. |
| (...skipping 6303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11154 | 11145 |
| 11155 @override | 11146 @override |
| 11156 void visitElement(Element element) { | 11147 void visitElement(Element element) { |
| 11157 int offset = element.nameOffset; | 11148 int offset = element.nameOffset; |
| 11158 if (offset != -1) { | 11149 if (offset != -1) { |
| 11159 map[offset] = element; | 11150 map[offset] = element; |
| 11160 } | 11151 } |
| 11161 super.visitElement(element); | 11152 super.visitElement(element); |
| 11162 } | 11153 } |
| 11163 } | 11154 } |
| OLD | NEW |