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

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

Issue 564413005: Issue 17389. Analyzer snapshot and server tweaks to use new ParameterElement.defaultValueCode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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 | « pkg/analysis_server/pubspec.yaml ('k') | pkg/analyzer/lib/src/generated/element_handle.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 9085 matching lines...) Expand 10 before | Expand all | Expand 10 after
9096 */ 9096 */
9097 static final List<NamespaceCombinator> EMPTY_ARRAY = new List<NamespaceCombina tor>(0); 9097 static final List<NamespaceCombinator> EMPTY_ARRAY = new List<NamespaceCombina tor>(0);
9098 } 9098 }
9099 9099
9100 /** 9100 /**
9101 * The interface `ParameterElement` defines the behavior of elements representin g a parameter 9101 * The interface `ParameterElement` defines the behavior of elements representin g a parameter
9102 * defined within an executable element. 9102 * defined within an executable element.
9103 */ 9103 */
9104 abstract class ParameterElement implements LocalElement, VariableElement { 9104 abstract class ParameterElement implements LocalElement, VariableElement {
9105 /** 9105 /**
9106 * Return a source range that covers the portion of the source in which the de fault value for this 9106 * Return the Dart code of the default value, or `null` if no default value.
9107 * parameter is specified, or `null` if there is no default value.
9108 * 9107 *
9109 * @return the range of characters in which the default value of this paramete r is specified 9108 * @return the Dart code of the default value
9110 */ 9109 */
9111 SourceRange get defaultValueRange; 9110 String get defaultValueCode;
9112 9111
9113 /** 9112 /**
9114 * Return the kind of this parameter. 9113 * Return the kind of this parameter.
9115 * 9114 *
9116 * @return the kind of this parameter 9115 * @return the kind of this parameter
9117 */ 9116 */
9118 ParameterKind get parameterKind; 9117 ParameterKind get parameterKind;
9119 9118
9120 /** 9119 /**
9121 * Return an array containing all of the parameters defined by this parameter. A parameter will 9120 * Return an array containing all of the parameters defined by this parameter. A parameter will
(...skipping 20 matching lines...) Expand all
9142 * parameters if this parameter is a function typed parameter. 9141 * parameters if this parameter is a function typed parameter.
9143 */ 9142 */
9144 List<ParameterElement> _parameters = ParameterElementImpl.EMPTY_ARRAY; 9143 List<ParameterElement> _parameters = ParameterElementImpl.EMPTY_ARRAY;
9145 9144
9146 /** 9145 /**
9147 * The kind of this parameter. 9146 * The kind of this parameter.
9148 */ 9147 */
9149 ParameterKind parameterKind; 9148 ParameterKind parameterKind;
9150 9149
9151 /** 9150 /**
9152 * The offset to the beginning of the default value range for this element. 9151 * The Dart code of the default value.
9153 */ 9152 */
9154 int _defaultValueRangeOffset = 0; 9153 String _defaultValueCode;
9155
9156 /**
9157 * The length of the default value range for this element, or `-1` if this ele ment does not
9158 * have a default value.
9159 */
9160 int _defaultValueRangeLength = -1;
9161 9154
9162 /** 9155 /**
9163 * The offset to the beginning of the visible range for this element. 9156 * The offset to the beginning of the visible range for this element.
9164 */ 9157 */
9165 int _visibleRangeOffset = 0; 9158 int _visibleRangeOffset = 0;
9166 9159
9167 /** 9160 /**
9168 * The length of the visible range for this element, or `-1` if this element d oes not have a 9161 * The length of the visible range for this element, or `-1` if this element d oes not have a
9169 * visible range. 9162 * visible range.
9170 */ 9163 */
(...skipping 27 matching lines...) Expand all
9198 ElementImpl getChild(String identifier) { 9191 ElementImpl getChild(String identifier) {
9199 for (ParameterElement parameter in _parameters) { 9192 for (ParameterElement parameter in _parameters) {
9200 if ((parameter as ParameterElementImpl).identifier == identifier) { 9193 if ((parameter as ParameterElementImpl).identifier == identifier) {
9201 return parameter as ParameterElementImpl; 9194 return parameter as ParameterElementImpl;
9202 } 9195 }
9203 } 9196 }
9204 return null; 9197 return null;
9205 } 9198 }
9206 9199
9207 @override 9200 @override
9208 SourceRange get defaultValueRange { 9201 String get defaultValueCode => _defaultValueCode;
9209 if (_defaultValueRangeLength < 0) {
9210 return null;
9211 }
9212 return new SourceRange(_defaultValueRangeOffset, _defaultValueRangeLength);
9213 }
9214 9202
9215 @override 9203 @override
9216 ElementKind get kind => ElementKind.PARAMETER; 9204 ElementKind get kind => ElementKind.PARAMETER;
9217 9205
9218 @override 9206 @override
9219 List<ParameterElement> get parameters => _parameters; 9207 List<ParameterElement> get parameters => _parameters;
9220 9208
9221 @override 9209 @override
9222 SourceRange get visibleRange { 9210 SourceRange get visibleRange {
9223 if (_visibleRangeLength < 0) { 9211 if (_visibleRangeLength < 0) {
(...skipping 19 matching lines...) Expand all
9243 } 9231 }
9244 9232
9245 /** 9233 /**
9246 * Specifies that this variable is potentially mutated somewhere in its scope. 9234 * Specifies that this variable is potentially mutated somewhere in its scope.
9247 */ 9235 */
9248 void markPotentiallyMutatedInScope() { 9236 void markPotentiallyMutatedInScope() {
9249 setModifier(Modifier.POTENTIALLY_MUTATED_IN_SCOPE, true); 9237 setModifier(Modifier.POTENTIALLY_MUTATED_IN_SCOPE, true);
9250 } 9238 }
9251 9239
9252 /** 9240 /**
9253 * Set the range of the default value for this parameter to the range starting at the given offset 9241 * Set Dart code of the default value.
9254 * with the given length.
9255 *
9256 * @param offset the offset to the beginning of the default value range for th is element
9257 * @param length the length of the default value range for this element, or `- 1` if this
9258 * element does not have a default value
9259 */ 9242 */
9260 void setDefaultValueRange(int offset, int length) { 9243 void set defaultValueCode(String defaultValueCode) {
9261 _defaultValueRangeOffset = offset; 9244 this._defaultValueCode = StringUtilities.intern(defaultValueCode);
9262 _defaultValueRangeLength = length;
9263 } 9245 }
9264 9246
9265 /** 9247 /**
9266 * Set the parameters defined by this executable element to the given paramete rs. 9248 * Set the parameters defined by this executable element to the given paramete rs.
9267 * 9249 *
9268 * @param parameters the parameters defined by this executable element 9250 * @param parameters the parameters defined by this executable element
9269 */ 9251 */
9270 void set parameters(List<ParameterElement> parameters) { 9252 void set parameters(List<ParameterElement> parameters) {
9271 for (ParameterElement parameter in parameters) { 9253 for (ParameterElement parameter in parameters) {
9272 (parameter as ParameterElementImpl).enclosingElement = this; 9254 (parameter as ParameterElementImpl).enclosingElement = this;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
9315 9297
9316 /** 9298 /**
9317 * Append the type and name of this parameter to the given builder. 9299 * Append the type and name of this parameter to the given builder.
9318 * 9300 *
9319 * @param builder the builder to which the type and name are to be appended 9301 * @param builder the builder to which the type and name are to be appended
9320 */ 9302 */
9321 void appendToWithoutDelimiters(JavaStringBuilder builder) { 9303 void appendToWithoutDelimiters(JavaStringBuilder builder) {
9322 builder.append(type); 9304 builder.append(type);
9323 builder.append(" "); 9305 builder.append(" ");
9324 builder.append(displayName); 9306 builder.append(displayName);
9307 if (_defaultValueCode != null) {
9308 if (parameterKind == ParameterKind.NAMED) {
9309 builder.append(": ");
9310 }
9311 if (parameterKind == ParameterKind.POSITIONAL) {
9312 builder.append(" = ");
9313 }
9314 builder.append(_defaultValueCode);
9315 }
9325 } 9316 }
9326 } 9317 }
9327 9318
9328 /** 9319 /**
9329 * Instances of the class `ParameterMember` represent a parameter element define d in a 9320 * Instances of the class `ParameterMember` represent a parameter element define d in a
9330 * parameterized type where the values of the type parameters are known. 9321 * parameterized type where the values of the type parameters are known.
9331 */ 9322 */
9332 class ParameterMember extends VariableMember implements ParameterElement { 9323 class ParameterMember extends VariableMember implements ParameterElement {
9333 /** 9324 /**
9334 * If the given parameter's type is different when any type parameters from th e defining type's 9325 * If the given parameter's type is different when any type parameters from th e defining type's
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
9390 return PropertyAccessorMember.from(element, definingInterfaceType); 9381 return PropertyAccessorMember.from(element, definingInterfaceType);
9391 } 9382 }
9392 } 9383 }
9393 return element; 9384 return element;
9394 } 9385 }
9395 9386
9396 @override 9387 @override
9397 ParameterElement get baseElement => super.baseElement as ParameterElement; 9388 ParameterElement get baseElement => super.baseElement as ParameterElement;
9398 9389
9399 @override 9390 @override
9400 SourceRange get defaultValueRange => baseElement.defaultValueRange; 9391 String get defaultValueCode => baseElement.defaultValueCode;
9401 9392
9402 @override 9393 @override
9403 Element get enclosingElement => baseElement.enclosingElement; 9394 Element get enclosingElement => baseElement.enclosingElement;
9404 9395
9405 @override 9396 @override
9406 ParameterKind get parameterKind => baseElement.parameterKind; 9397 ParameterKind get parameterKind => baseElement.parameterKind;
9407 9398
9408 @override 9399 @override
9409 List<ParameterElement> get parameters { 9400 List<ParameterElement> get parameters {
9410 List<ParameterElement> baseParameters = baseElement.parameters; 9401 List<ParameterElement> baseParameters = baseElement.parameters;
(...skipping 2232 matching lines...) Expand 10 before | Expand all | Expand 10 after
11643 if (type is UnionType) { 11634 if (type is UnionType) {
11644 return (type as UnionTypeImpl).internalUnionTypeIsSuperTypeOf(this, visite dTypePairs); 11635 return (type as UnionTypeImpl).internalUnionTypeIsSuperTypeOf(this, visite dTypePairs);
11645 } 11636 }
11646 // The only subtype relations that pertain to void are therefore: 11637 // The only subtype relations that pertain to void are therefore:
11647 // void <: void (by reflexivity) 11638 // void <: void (by reflexivity)
11648 // bottom <: void (as bottom is a subtype of all types). 11639 // bottom <: void (as bottom is a subtype of all types).
11649 // void <: dynamic (as dynamic is a supertype of all types) 11640 // void <: dynamic (as dynamic is a supertype of all types)
11650 return identical(type, this) || identical(type, DynamicTypeImpl.instance); 11641 return identical(type, this) || identical(type, DynamicTypeImpl.instance);
11651 } 11642 }
11652 } 11643 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/pubspec.yaml ('k') | pkg/analyzer/lib/src/generated/element_handle.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698