| 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 7318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7329 super('_${setter.variable.name}', setter.variable.nameOffset) { | 7329 super('_${setter.variable.name}', setter.variable.nameOffset) { |
| 7330 enclosingElement = setter; | 7330 enclosingElement = setter; |
| 7331 synthetic = true; | 7331 synthetic = true; |
| 7332 parameterKind = ParameterKind.REQUIRED; | 7332 parameterKind = ParameterKind.REQUIRED; |
| 7333 } | 7333 } |
| 7334 | 7334 |
| 7335 @override | 7335 @override |
| 7336 DartType get type => setter.variable.type; | 7336 DartType get type => setter.variable.type; |
| 7337 | 7337 |
| 7338 @override | 7338 @override |
| 7339 void set type(FunctionType type) { | 7339 void set type(DartType type) { |
| 7340 assert(false); // Should never be called. | 7340 assert(false); // Should never be called. |
| 7341 } | 7341 } |
| 7342 } | 7342 } |
| 7343 | 7343 |
| 7344 /** | 7344 /** |
| 7345 * A mixin that provides a common implementation for methods defined in | 7345 * A mixin that provides a common implementation for methods defined in |
| 7346 * [ParameterElement]. | 7346 * [ParameterElement]. |
| 7347 */ | 7347 */ |
| 7348 abstract class ParameterElementMixin implements ParameterElement { | 7348 abstract class ParameterElementMixin implements ParameterElement { |
| 7349 @override | 7349 @override |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7649 | 7649 |
| 7650 @override | 7650 @override |
| 7651 DartType get returnType => variable.type; | 7651 DartType get returnType => variable.type; |
| 7652 | 7652 |
| 7653 @override | 7653 @override |
| 7654 void set returnType(DartType returnType) { | 7654 void set returnType(DartType returnType) { |
| 7655 assert(false); // Should never be called. | 7655 assert(false); // Should never be called. |
| 7656 } | 7656 } |
| 7657 | 7657 |
| 7658 @override | 7658 @override |
| 7659 DartType get type { | 7659 FunctionType get type { |
| 7660 return _type ??= new FunctionTypeImpl(this); | 7660 return _type ??= new FunctionTypeImpl(this); |
| 7661 } | 7661 } |
| 7662 | 7662 |
| 7663 @override | 7663 @override |
| 7664 void set type(FunctionType type) { | 7664 void set type(FunctionType type) { |
| 7665 assert(false); // Should never be called. | 7665 assert(false); // Should never be called. |
| 7666 } | 7666 } |
| 7667 } | 7667 } |
| 7668 | 7668 |
| 7669 /** | 7669 /** |
| (...skipping 22 matching lines...) Expand all Loading... |
| 7692 | 7692 |
| 7693 @override | 7693 @override |
| 7694 DartType get returnType => VoidTypeImpl.instance; | 7694 DartType get returnType => VoidTypeImpl.instance; |
| 7695 | 7695 |
| 7696 @override | 7696 @override |
| 7697 void set returnType(DartType returnType) { | 7697 void set returnType(DartType returnType) { |
| 7698 assert(false); // Should never be called. | 7698 assert(false); // Should never be called. |
| 7699 } | 7699 } |
| 7700 | 7700 |
| 7701 @override | 7701 @override |
| 7702 DartType get type { | 7702 FunctionType get type { |
| 7703 return _type ??= new FunctionTypeImpl(this); | 7703 return _type ??= new FunctionTypeImpl(this); |
| 7704 } | 7704 } |
| 7705 | 7705 |
| 7706 @override | 7706 @override |
| 7707 void set type(FunctionType type) { | 7707 void set type(FunctionType type) { |
| 7708 assert(false); // Should never be called. | 7708 assert(false); // Should never be called. |
| 7709 } | 7709 } |
| 7710 } | 7710 } |
| 7711 | 7711 |
| 7712 /** | 7712 /** |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8253 ? new List<TopLevelVariableElementImpl>(numberOfVariables) | 8253 ? new List<TopLevelVariableElementImpl>(numberOfVariables) |
| 8254 : const <TopLevelVariableElementImpl>[]; | 8254 : const <TopLevelVariableElementImpl>[]; |
| 8255 } | 8255 } |
| 8256 | 8256 |
| 8257 /** | 8257 /** |
| 8258 * A concrete implementation of a [UriReferencedElement]. | 8258 * A concrete implementation of a [UriReferencedElement]. |
| 8259 */ | 8259 */ |
| 8260 abstract class UriReferencedElementImpl extends ElementImpl | 8260 abstract class UriReferencedElementImpl extends ElementImpl |
| 8261 implements UriReferencedElement { | 8261 implements UriReferencedElement { |
| 8262 /** | 8262 /** |
| 8263 * The offset of the URI in the file, may be `-1` if synthetic. | 8263 * The offset of the URI in the file, or `-1` if this node is synthetic. |
| 8264 */ | 8264 */ |
| 8265 int uriOffset = -1; | 8265 int _uriOffset = -1; |
| 8266 | 8266 |
| 8267 /** | 8267 /** |
| 8268 * The offset of the character immediately following the last character of | 8268 * The offset of the character immediately following the last character of |
| 8269 * this node's URI, may be `-1` if synthetic. | 8269 * this node's URI, or `-1` if this node is synthetic. |
| 8270 */ | 8270 */ |
| 8271 int uriEnd = -1; | 8271 int _uriEnd = -1; |
| 8272 | 8272 |
| 8273 /** | 8273 /** |
| 8274 * The URI that is specified by this directive. | 8274 * The URI that is specified by this directive. |
| 8275 */ | 8275 */ |
| 8276 String uri; | 8276 String _uri; |
| 8277 | 8277 |
| 8278 /** | 8278 /** |
| 8279 * Initialize a newly created import element to have the given [name] and | 8279 * Initialize a newly created import element to have the given [name] and |
| 8280 * [offset]. The offset may be `-1` if the element is synthetic. | 8280 * [offset]. The offset may be `-1` if the element is synthetic. |
| 8281 */ | 8281 */ |
| 8282 UriReferencedElementImpl(String name, int offset) : super(name, offset); | 8282 UriReferencedElementImpl(String name, int offset) : super(name, offset); |
| 8283 | 8283 |
| 8284 /** | 8284 /** |
| 8285 * Initialize using the given serialized information. | 8285 * Initialize using the given serialized information. |
| 8286 */ | 8286 */ |
| 8287 UriReferencedElementImpl.forSerialized(ElementImpl enclosingElement) | 8287 UriReferencedElementImpl.forSerialized(ElementImpl enclosingElement) |
| 8288 : super.forSerialized(enclosingElement); | 8288 : super.forSerialized(enclosingElement); |
| 8289 |
| 8290 /** |
| 8291 * Return the URI that is specified by this directive. |
| 8292 */ |
| 8293 String get uri => _uri; |
| 8294 |
| 8295 /** |
| 8296 * Set the URI that is specified by this directive to be the given [uri]. |
| 8297 */ |
| 8298 void set uri(String uri) { |
| 8299 _uri = uri; |
| 8300 } |
| 8301 |
| 8302 /** |
| 8303 * Return the offset of the character immediately following the last character |
| 8304 * of this node's URI, or `-1` if this node is synthetic. |
| 8305 */ |
| 8306 int get uriEnd => _uriEnd; |
| 8307 |
| 8308 /** |
| 8309 * Set the offset of the character immediately following the last character of |
| 8310 * this node's URI to the given [offset]. |
| 8311 */ |
| 8312 void set uriEnd(int offset) { |
| 8313 _uriEnd = offset; |
| 8314 } |
| 8315 |
| 8316 /** |
| 8317 * Return the offset of the URI in the file, or `-1` if this node is synthetic
. |
| 8318 */ |
| 8319 int get uriOffset => _uriOffset; |
| 8320 |
| 8321 /** |
| 8322 * Set the offset of the URI in the file to the given [offset]. |
| 8323 */ |
| 8324 void set uriOffset(int offset) { |
| 8325 _uriOffset = offset; |
| 8326 } |
| 8289 } | 8327 } |
| 8290 | 8328 |
| 8291 /** | 8329 /** |
| 8292 * A concrete implementation of a [VariableElement]. | 8330 * A concrete implementation of a [VariableElement]. |
| 8293 */ | 8331 */ |
| 8294 abstract class VariableElementImpl extends ElementImpl | 8332 abstract class VariableElementImpl extends ElementImpl |
| 8295 implements VariableElement { | 8333 implements VariableElement { |
| 8296 /** | 8334 /** |
| 8297 * The declared type of this variable. | 8335 * The declared type of this variable. |
| 8298 */ | 8336 */ |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8448 | 8486 |
| 8449 @override | 8487 @override |
| 8450 void visitElement(Element element) { | 8488 void visitElement(Element element) { |
| 8451 int offset = element.nameOffset; | 8489 int offset = element.nameOffset; |
| 8452 if (offset != -1) { | 8490 if (offset != -1) { |
| 8453 map[offset] = element; | 8491 map[offset] = element; |
| 8454 } | 8492 } |
| 8455 super.visitElement(element); | 8493 super.visitElement(element); |
| 8456 } | 8494 } |
| 8457 } | 8495 } |
| OLD | NEW |