| 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'; |
| 11 import 'package:analyzer/dart/ast/token.dart'; | 11 import 'package:analyzer/dart/ast/token.dart'; |
| 12 import 'package:analyzer/dart/constant/value.dart'; | 12 import 'package:analyzer/dart/constant/value.dart'; |
| 13 import 'package:analyzer/dart/element/element.dart'; | 13 import 'package:analyzer/dart/element/element.dart'; |
| 14 import 'package:analyzer/dart/element/type.dart'; | 14 import 'package:analyzer/dart/element/type.dart'; |
| 15 import 'package:analyzer/dart/element/visitor.dart'; | 15 import 'package:analyzer/dart/element/visitor.dart'; |
| 16 import 'package:analyzer/src/dart/ast/utilities.dart'; | 16 import 'package:analyzer/src/dart/ast/utilities.dart'; |
| 17 import 'package:analyzer/src/dart/element/handle.dart'; | 17 import 'package:analyzer/src/dart/element/handle.dart'; |
| 18 import 'package:analyzer/src/dart/element/type.dart'; | 18 import 'package:analyzer/src/dart/element/type.dart'; |
| 19 import 'package:analyzer/src/generated/constant.dart' show EvaluationResultImpl; | 19 import 'package:analyzer/src/generated/constant.dart' show EvaluationResultImpl; |
| 20 import 'package:analyzer/src/generated/engine.dart' | 20 import 'package:analyzer/src/generated/engine.dart' |
| 21 show AnalysisContext, AnalysisEngine; | 21 show AnalysisContext, AnalysisEngine; |
| 22 import 'package:analyzer/src/generated/error.dart' show CompileTimeErrorCode; |
| 22 import 'package:analyzer/src/generated/java_core.dart'; | 23 import 'package:analyzer/src/generated/java_core.dart'; |
| 23 import 'package:analyzer/src/generated/java_engine.dart'; | 24 import 'package:analyzer/src/generated/java_engine.dart'; |
| 24 import 'package:analyzer/src/generated/resolver.dart'; | 25 import 'package:analyzer/src/generated/resolver.dart'; |
| 25 import 'package:analyzer/src/generated/sdk.dart' show DartSdk; | 26 import 'package:analyzer/src/generated/sdk.dart' show DartSdk; |
| 26 import 'package:analyzer/src/generated/source.dart'; | 27 import 'package:analyzer/src/generated/source.dart'; |
| 27 import 'package:analyzer/src/generated/utilities_collection.dart'; | 28 import 'package:analyzer/src/generated/utilities_collection.dart'; |
| 28 import 'package:analyzer/src/generated/utilities_dart.dart'; | 29 import 'package:analyzer/src/generated/utilities_dart.dart'; |
| 29 import 'package:analyzer/src/generated/utilities_general.dart'; | 30 import 'package:analyzer/src/generated/utilities_general.dart'; |
| 30 import 'package:analyzer/src/summary/idl.dart'; | 31 import 'package:analyzer/src/summary/idl.dart'; |
| 31 import 'package:analyzer/src/task/dart.dart'; | 32 import 'package:analyzer/src/task/dart.dart'; |
| (...skipping 1726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1758 static DynamicElementImpl get instance => | 1759 static DynamicElementImpl get instance => |
| 1759 DynamicTypeImpl.instance.element as DynamicElementImpl; | 1760 DynamicTypeImpl.instance.element as DynamicElementImpl; |
| 1760 | 1761 |
| 1761 @override | 1762 @override |
| 1762 DynamicTypeImpl type; | 1763 DynamicTypeImpl type; |
| 1763 | 1764 |
| 1764 /** | 1765 /** |
| 1765 * Initialize a newly created instance of this class. Instances of this class | 1766 * Initialize a newly created instance of this class. Instances of this class |
| 1766 * should <b>not</b> be created except as part of creating the type associated | 1767 * should <b>not</b> be created except as part of creating the type associated |
| 1767 * with this element. The single instance of this class should be accessed | 1768 * with this element. The single instance of this class should be accessed |
| 1768 * through the method [getInstance]. | 1769 * through the method [instance]. |
| 1769 */ | 1770 */ |
| 1770 DynamicElementImpl() : super(Keyword.DYNAMIC.syntax, -1) { | 1771 DynamicElementImpl() : super(Keyword.DYNAMIC.syntax, -1) { |
| 1771 setModifier(Modifier.SYNTHETIC, true); | 1772 setModifier(Modifier.SYNTHETIC, true); |
| 1772 } | 1773 } |
| 1773 | 1774 |
| 1774 @override | 1775 @override |
| 1775 ElementKind get kind => ElementKind.DYNAMIC; | 1776 ElementKind get kind => ElementKind.DYNAMIC; |
| 1776 | 1777 |
| 1777 @override | 1778 @override |
| 1778 accept(ElementVisitor visitor) => null; | 1779 accept(ElementVisitor visitor) => null; |
| (...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3140 */ | 3141 */ |
| 3141 FunctionElementImpl(String name, int offset) : super(name, offset); | 3142 FunctionElementImpl(String name, int offset) : super(name, offset); |
| 3142 | 3143 |
| 3143 /** | 3144 /** |
| 3144 * Initialize a newly created function element to have the given [name]. | 3145 * Initialize a newly created function element to have the given [name]. |
| 3145 */ | 3146 */ |
| 3146 FunctionElementImpl.forNode(Identifier name) : super.forNode(name); | 3147 FunctionElementImpl.forNode(Identifier name) : super.forNode(name); |
| 3147 | 3148 |
| 3148 /** | 3149 /** |
| 3149 * Initialize a newly created function element to have no name and the given | 3150 * Initialize a newly created function element to have no name and the given |
| 3150 * [offset]. This is used for function expressions, that have no name. | 3151 * [nameOffset]. This is used for function expressions, that have no name. |
| 3151 */ | 3152 */ |
| 3152 FunctionElementImpl.forOffset(int nameOffset) : super("", nameOffset); | 3153 FunctionElementImpl.forOffset(int nameOffset) : super("", nameOffset); |
| 3153 | 3154 |
| 3154 /** | 3155 /** |
| 3155 * Initialize using the given serialized information. | 3156 * Initialize using the given serialized information. |
| 3156 */ | 3157 */ |
| 3157 FunctionElementImpl.forSerialized( | 3158 FunctionElementImpl.forSerialized( |
| 3158 UnlinkedExecutable serializedExecutable, ElementImpl enclosingElement) | 3159 UnlinkedExecutable serializedExecutable, ElementImpl enclosingElement) |
| 3159 : super.forSerialized(serializedExecutable, enclosingElement); | 3160 : super.forSerialized(serializedExecutable, enclosingElement); |
| 3160 | 3161 |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3598 * [onSwitchStatement] should be `true` if this label is associated with a | 3599 * [onSwitchStatement] should be `true` if this label is associated with a |
| 3599 * `switch` statement and [onSwitchMember] should be `true` if this label is | 3600 * `switch` statement and [onSwitchMember] should be `true` if this label is |
| 3600 * associated with a `switch` member. | 3601 * associated with a `switch` member. |
| 3601 */ | 3602 */ |
| 3602 LabelElementImpl(String name, int nameOffset, this._onSwitchStatement, | 3603 LabelElementImpl(String name, int nameOffset, this._onSwitchStatement, |
| 3603 this._onSwitchMember) | 3604 this._onSwitchMember) |
| 3604 : super(name, nameOffset); | 3605 : super(name, nameOffset); |
| 3605 | 3606 |
| 3606 /** | 3607 /** |
| 3607 * Initialize a newly created label element to have the given [name]. | 3608 * Initialize a newly created label element to have the given [name]. |
| 3608 * [onSwitchStatement] should be `true` if this label is associated with a | 3609 * [_onSwitchStatement] should be `true` if this label is associated with a |
| 3609 * `switch` statement and [onSwitchMember] should be `true` if this label is | 3610 * `switch` statement and [_onSwitchMember] should be `true` if this label is |
| 3610 * associated with a `switch` member. | 3611 * associated with a `switch` member. |
| 3611 */ | 3612 */ |
| 3612 LabelElementImpl.forNode( | 3613 LabelElementImpl.forNode( |
| 3613 Identifier name, this._onSwitchStatement, this._onSwitchMember) | 3614 Identifier name, this._onSwitchStatement, this._onSwitchMember) |
| 3614 : super.forNode(name); | 3615 : super.forNode(name); |
| 3615 | 3616 |
| 3616 @override | 3617 @override |
| 3617 ExecutableElement get enclosingElement => | 3618 ExecutableElement get enclosingElement => |
| 3618 super.enclosingElement as ExecutableElement; | 3619 super.enclosingElement as ExecutableElement; |
| 3619 | 3620 |
| (...skipping 1617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5237 } | 5238 } |
| 5238 } | 5239 } |
| 5239 } | 5240 } |
| 5240 | 5241 |
| 5241 /** | 5242 /** |
| 5242 * A concrete implementation of a [PrefixElement]. | 5243 * A concrete implementation of a [PrefixElement]. |
| 5243 */ | 5244 */ |
| 5244 class PrefixElementImpl extends ElementImpl implements PrefixElement { | 5245 class PrefixElementImpl extends ElementImpl implements PrefixElement { |
| 5245 /** | 5246 /** |
| 5246 * Initialize a newly created method element to have the given [name] and | 5247 * Initialize a newly created method element to have the given [name] and |
| 5247 * [offset]. | 5248 * [nameOffset]. |
| 5248 */ | 5249 */ |
| 5249 PrefixElementImpl(String name, int nameOffset) : super(name, nameOffset); | 5250 PrefixElementImpl(String name, int nameOffset) : super(name, nameOffset); |
| 5250 | 5251 |
| 5251 /** | 5252 /** |
| 5252 * Initialize a newly created prefix element to have the given [name]. | 5253 * Initialize a newly created prefix element to have the given [name]. |
| 5253 */ | 5254 */ |
| 5254 PrefixElementImpl.forNode(Identifier name) : super.forNode(name); | 5255 PrefixElementImpl.forNode(Identifier name) : super.forNode(name); |
| 5255 | 5256 |
| 5256 @override | 5257 @override |
| 5257 LibraryElement get enclosingElement => | 5258 LibraryElement get enclosingElement => |
| (...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6037 | 6038 |
| 6038 @override | 6039 @override |
| 6039 void visitElement(Element element) { | 6040 void visitElement(Element element) { |
| 6040 int offset = element.nameOffset; | 6041 int offset = element.nameOffset; |
| 6041 if (offset != -1) { | 6042 if (offset != -1) { |
| 6042 map[offset] = element; | 6043 map[offset] = element; |
| 6043 } | 6044 } |
| 6044 super.visitElement(element); | 6045 super.visitElement(element); |
| 6045 } | 6046 } |
| 6046 } | 6047 } |
| OLD | NEW |