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

Side by Side Diff: packages/analyzer/lib/src/dart/element/handle.dart

Issue 2990843002: Removed fixed dependencies (Closed)
Patch Set: Created 3 years, 4 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
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 library engine.element_handle; 5 library analyzer.src.generated.element_handle;
6 6
7 import 'package:analyzer/src/generated/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/src/generated/constant.dart'; 8 import 'package:analyzer/dart/constant/value.dart';
9 import 'package:analyzer/src/generated/element.dart'; 9 import 'package:analyzer/dart/element/element.dart';
10 import 'package:analyzer/dart/element/type.dart';
11 import 'package:analyzer/src/dart/element/element.dart';
10 import 'package:analyzer/src/generated/engine.dart'; 12 import 'package:analyzer/src/generated/engine.dart';
11 import 'package:analyzer/src/generated/java_core.dart';
12 import 'package:analyzer/src/generated/java_engine.dart'; 13 import 'package:analyzer/src/generated/java_engine.dart';
13 import 'package:analyzer/src/generated/resolver.dart'; 14 import 'package:analyzer/src/generated/resolver.dart';
14 import 'package:analyzer/src/generated/source.dart'; 15 import 'package:analyzer/src/generated/source.dart';
15 import 'package:analyzer/src/generated/utilities_dart.dart'; 16 import 'package:analyzer/src/generated/utilities_dart.dart';
16 17
17 /** 18 /**
18 * Instances of the class `ClassElementHandle` implement a handle to a `ClassEle ment`. 19 * A handle to a [ClassElement].
19 */ 20 */
20 class ClassElementHandle extends ElementHandle implements ClassElement { 21 class ClassElementHandle extends ElementHandle implements ClassElement {
21 /** 22 /**
22 * Initialize a newly created element handle to represent the given element. 23 * Initialize a newly created element handle to represent the element at the
23 * 24 * given [_location]. The [_resynthesizer] will be used to resynthesize the
24 * @param element the element being represented 25 * element when needed.
25 */ 26 */
26 ClassElementHandle(ClassElement element) : super(element); 27 ClassElementHandle(
28 ElementResynthesizer resynthesizer, ElementLocation location)
29 : super(resynthesizer, location);
27 30
28 @override 31 @override
29 List<PropertyAccessorElement> get accessors => actualElement.accessors; 32 List<PropertyAccessorElement> get accessors => actualElement.accessors;
30 33
31 @override 34 @override
32 ClassElement get actualElement => super.actualElement as ClassElement; 35 ClassElement get actualElement => super.actualElement as ClassElement;
33 36
34 @override 37 @override
35 List<InterfaceType> get allSupertypes => actualElement.allSupertypes; 38 List<InterfaceType> get allSupertypes => actualElement.allSupertypes;
36 39
(...skipping 15 matching lines...) Expand all
52 @override 55 @override
53 List<InterfaceType> get interfaces => actualElement.interfaces; 56 List<InterfaceType> get interfaces => actualElement.interfaces;
54 57
55 @override 58 @override
56 bool get isAbstract => actualElement.isAbstract; 59 bool get isAbstract => actualElement.isAbstract;
57 60
58 @override 61 @override
59 bool get isEnum => actualElement.isEnum; 62 bool get isEnum => actualElement.isEnum;
60 63
61 @override 64 @override
65 bool get isJS => actualElement.isJS;
66
67 @override
62 bool get isMixinApplication => actualElement.isMixinApplication; 68 bool get isMixinApplication => actualElement.isMixinApplication;
63 69
64 @override 70 @override
65 bool get isOrInheritsProxy => actualElement.isOrInheritsProxy; 71 bool get isOrInheritsProxy => actualElement.isOrInheritsProxy;
66 72
67 @override 73 @override
68 bool get isProxy => actualElement.isProxy; 74 bool get isProxy => actualElement.isProxy;
69 75
70 @override 76 @override
71 @deprecated 77 bool get isRequired => actualElement.isRequired;
72 bool get isTypedef => actualElement.isMixinApplication;
73 78
74 @override 79 @override
75 bool get isValidMixin => actualElement.isValidMixin; 80 bool get isValidMixin => actualElement.isValidMixin;
76 81
77 @override 82 @override
78 ElementKind get kind => ElementKind.CLASS; 83 ElementKind get kind => ElementKind.CLASS;
79 84
80 @override 85 @override
81 List<MethodElement> get methods => actualElement.methods; 86 List<MethodElement> get methods => actualElement.methods;
82 87
83 @override 88 @override
84 List<InterfaceType> get mixins => actualElement.mixins; 89 List<InterfaceType> get mixins => actualElement.mixins;
85 90
86 @override 91 @override
87 InterfaceType get supertype => actualElement.supertype; 92 InterfaceType get supertype => actualElement.supertype;
88 93
89 @override 94 @override
90 InterfaceType get type => actualElement.type; 95 InterfaceType get type => actualElement.type;
91 96
92 @override 97 @override
93 List<TypeParameterElement> get typeParameters => actualElement.typeParameters; 98 List<TypeParameterElement> get typeParameters => actualElement.typeParameters;
94 99
95 @override 100 @override
96 ConstructorElement get unnamedConstructor => actualElement.unnamedConstructor; 101 ConstructorElement get unnamedConstructor => actualElement.unnamedConstructor;
97 102
98 @override 103 @override
104 NamedCompilationUnitMember computeNode() => super.computeNode();
105
106 @override
99 FieldElement getField(String fieldName) => actualElement.getField(fieldName); 107 FieldElement getField(String fieldName) => actualElement.getField(fieldName);
100 108
101 @override 109 @override
102 PropertyAccessorElement getGetter(String getterName) => 110 PropertyAccessorElement getGetter(String getterName) =>
103 actualElement.getGetter(getterName); 111 actualElement.getGetter(getterName);
104 112
105 @override 113 @override
106 MethodElement getMethod(String methodName) => 114 MethodElement getMethod(String methodName) =>
107 actualElement.getMethod(methodName); 115 actualElement.getMethod(methodName);
108 116
(...skipping 29 matching lines...) Expand all
138 String methodName, LibraryElement library) => 146 String methodName, LibraryElement library) =>
139 actualElement.lookUpInheritedConcreteMethod(methodName, library); 147 actualElement.lookUpInheritedConcreteMethod(methodName, library);
140 148
141 @override 149 @override
142 PropertyAccessorElement lookUpInheritedConcreteSetter( 150 PropertyAccessorElement lookUpInheritedConcreteSetter(
143 String methodName, LibraryElement library) => 151 String methodName, LibraryElement library) =>
144 actualElement.lookUpInheritedConcreteSetter(methodName, library); 152 actualElement.lookUpInheritedConcreteSetter(methodName, library);
145 153
146 @override 154 @override
147 MethodElement lookUpInheritedMethod( 155 MethodElement lookUpInheritedMethod(
148 String methodName, LibraryElement library) => 156 String methodName, LibraryElement library) {
149 actualElement.lookUpInheritedMethod(methodName, library); 157 return actualElement.lookUpInheritedMethod(methodName, library);
158 }
150 159
151 @override 160 @override
152 MethodElement lookUpMethod(String methodName, LibraryElement library) => 161 MethodElement lookUpMethod(String methodName, LibraryElement library) =>
153 actualElement.lookUpMethod(methodName, library); 162 actualElement.lookUpMethod(methodName, library);
154 163
155 @override 164 @override
156 PropertyAccessorElement lookUpSetter( 165 PropertyAccessorElement lookUpSetter(
157 String setterName, LibraryElement library) => 166 String setterName, LibraryElement library) =>
158 actualElement.lookUpSetter(setterName, library); 167 actualElement.lookUpSetter(setterName, library);
159 } 168 }
160 169
161 /** 170 /**
162 * Instances of the class `CompilationUnitElementHandle` implements a handle to a 171 * A handle to a [CompilationUnitElement].
163 * [CompilationUnitElement].
164 */ 172 */
165 class CompilationUnitElementHandle extends ElementHandle 173 class CompilationUnitElementHandle extends ElementHandle
166 implements CompilationUnitElement { 174 implements CompilationUnitElement {
167 /** 175 /**
168 * Initialize a newly created element handle to represent the given element. 176 * Initialize a newly created element handle to represent the element at the
169 * 177 * given [_location]. The [_resynthesizer] will be used to resynthesize the
170 * @param element the element being represented 178 * element when needed.
171 */ 179 */
172 CompilationUnitElementHandle(CompilationUnitElement element) : super(element); 180 CompilationUnitElementHandle(
181 ElementResynthesizer resynthesizer, ElementLocation location)
182 : super(resynthesizer, location);
173 183
174 @override 184 @override
175 List<PropertyAccessorElement> get accessors => actualElement.accessors; 185 List<PropertyAccessorElement> get accessors => actualElement.accessors;
176 186
177 @override 187 @override
178 CompilationUnitElement get actualElement => 188 CompilationUnitElement get actualElement =>
179 super.actualElement as CompilationUnitElement; 189 super.actualElement as CompilationUnitElement;
180 190
181 @override 191 @override
182 LibraryElement get enclosingElement => 192 LibraryElement get enclosingElement =>
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 } 236 }
227 237
228 @override 238 @override
229 ClassElement getEnum(String enumName) => actualElement.getEnum(enumName); 239 ClassElement getEnum(String enumName) => actualElement.getEnum(enumName);
230 240
231 @override 241 @override
232 ClassElement getType(String className) => actualElement.getType(className); 242 ClassElement getType(String className) => actualElement.getType(className);
233 } 243 }
234 244
235 /** 245 /**
236 * Instances of the class `ConstructorElementHandle` implement a handle to a 246 * A handle to a [ConstructorElement].
237 * `ConstructorElement`.
238 */ 247 */
239 class ConstructorElementHandle extends ExecutableElementHandle 248 class ConstructorElementHandle extends ExecutableElementHandle
240 implements ConstructorElement { 249 implements ConstructorElement {
241 /** 250 /**
242 * Initialize a newly created element handle to represent the given element. 251 * Initialize a newly created element handle to represent the element at the
243 * 252 * given [_location]. The [_resynthesizer] will be used to resynthesize the
244 * @param element the element being represented 253 * element when needed.
245 */ 254 */
246 ConstructorElementHandle(ConstructorElement element) : super(element); 255 ConstructorElementHandle(
256 ElementResynthesizer resynthesizer, ElementLocation location)
257 : super(resynthesizer, location);
247 258
248 @override 259 @override
249 ConstructorElement get actualElement => 260 ConstructorElement get actualElement =>
250 super.actualElement as ConstructorElement; 261 super.actualElement as ConstructorElement;
251 262
252 @override 263 @override
253 ClassElement get enclosingElement => actualElement.enclosingElement; 264 ClassElement get enclosingElement => actualElement.enclosingElement;
254 265
255 @override 266 @override
256 bool get isConst => actualElement.isConst; 267 bool get isConst => actualElement.isConst;
(...skipping 15 matching lines...) Expand all
272 283
273 @override 284 @override
274 ConstructorElement get redirectedConstructor => 285 ConstructorElement get redirectedConstructor =>
275 actualElement.redirectedConstructor; 286 actualElement.redirectedConstructor;
276 287
277 @override 288 @override
278 ConstructorDeclaration computeNode() => actualElement.computeNode(); 289 ConstructorDeclaration computeNode() => actualElement.computeNode();
279 } 290 }
280 291
281 /** 292 /**
282 * The abstract class `ElementHandle` implements the behavior common to objects that implement 293 * A handle to an [Element].
283 * a handle to an [Element].
284 */ 294 */
285 abstract class ElementHandle implements Element { 295 abstract class ElementHandle implements Element {
286 /** 296 /**
287 * The unique integer identifier of this element. 297 * The unique integer identifier of this element.
288 */ 298 */
289 final int id = 0; 299 final int id = 0;
290 300
291 /** 301 /**
292 * The context in which the element is defined. 302 * The [ElementResynthesizer] which will be used to resynthesize elements on
303 * demand.
293 */ 304 */
294 AnalysisContext _context; 305 final ElementResynthesizer _resynthesizer;
295 306
296 /** 307 /**
297 * The location of this element, used to reconstitute the element if it has be en garbage 308 * The location of this element, used to reconstitute the element if it has
298 * collected. 309 * not yet been resynthesized.
299 */ 310 */
300 ElementLocation _location; 311 final ElementLocation _location;
301 312
302 /** 313 /**
303 * A reference to the element being referenced by this handle, or `null` if th e element has 314 * A reference to the element being referenced by this handle, or `null` if
304 * been garbage collected. 315 * the element has not yet been resynthesized.
305 */ 316 */
306 WeakReference<Element> _elementReference; 317 Element _elementReference;
307 318
308 /** 319 /**
309 * Initialize a newly created element handle to represent the given element. 320 * Initialize a newly created element handle to represent the element at the
310 * 321 * given [_location]. The [_resynthesizer] will be used to resynthesize the
311 * @param element the element being represented 322 * element when needed.
312 */ 323 */
313 ElementHandle(Element element) { 324 ElementHandle(this._resynthesizer, this._location);
314 _context = element.context;
315 _location = element.location;
316 _elementReference = new WeakReference<Element>(element);
317 }
318 325
319 /** 326 /**
320 * Return the element being represented by this handle, reconstituting the ele ment if the 327 * Return the element being represented by this handle, reconstituting the
321 * reference has been set to `null`. 328 * element if the reference has been set to `null`.
322 *
323 * @return the element being represented by this handle
324 */ 329 */
325 Element get actualElement { 330 Element get actualElement {
326 Element element = _elementReference.get(); 331 if (_elementReference == null) {
327 if (element == null) { 332 _elementReference = _resynthesizer.getElement(_location);
328 element = _context.getElement(_location);
329 _elementReference = new WeakReference<Element>(element);
330 } 333 }
331 return element; 334 return _elementReference;
332 } 335 }
333 336
334 @override 337 @override
335 AnalysisContext get context => _context; 338 AnalysisContext get context => _resynthesizer.context;
336 339
337 @override 340 @override
338 String get displayName => actualElement.displayName; 341 String get displayName => actualElement.displayName;
339 342
340 @override 343 @override
341 SourceRange get docRange => actualElement.docRange; 344 String get documentationComment => actualElement.documentationComment;
342 345
343 @override 346 @override
344 Element get enclosingElement => actualElement.enclosingElement; 347 Element get enclosingElement => actualElement.enclosingElement;
345 348
346 @override 349 @override
347 int get hashCode => _location.hashCode; 350 int get hashCode => _location.hashCode;
348 351
349 @override 352 @override
350 bool get isDeprecated => actualElement.isDeprecated; 353 bool get isDeprecated => actualElement.isDeprecated;
351 354
352 @override 355 @override
356 bool get isFactory => actualElement.isFactory;
357
358 @override
359 bool get isJS => actualElement.isJS;
360
361 @override
353 bool get isOverride => actualElement.isOverride; 362 bool get isOverride => actualElement.isOverride;
354 363
355 @override 364 @override
356 bool get isPrivate => actualElement.isPrivate; 365 bool get isPrivate => actualElement.isPrivate;
357 366
358 @override 367 @override
368 bool get isProtected => actualElement.isProtected;
369
370 @override
359 bool get isPublic => actualElement.isPublic; 371 bool get isPublic => actualElement.isPublic;
360 372
361 @override 373 @override
374 bool get isRequired => actualElement.isRequired;
375
376 @override
362 bool get isSynthetic => actualElement.isSynthetic; 377 bool get isSynthetic => actualElement.isSynthetic;
363 378
364 @override 379 @override
365 LibraryElement get library => 380 LibraryElement get library =>
366 getAncestor((element) => element is LibraryElement); 381 getAncestor((element) => element is LibraryElement);
367 382
368 @override 383 @override
384 Source get librarySource => actualElement.librarySource;
385
386 @override
369 ElementLocation get location => _location; 387 ElementLocation get location => _location;
370 388
371 @override 389 @override
372 List<ElementAnnotation> get metadata => actualElement.metadata; 390 List<ElementAnnotation> get metadata => actualElement.metadata;
373 391
374 @override 392 @override
375 String get name => actualElement.name; 393 String get name => actualElement.name;
376 394
377 @override 395 @override
378 int get nameLength => actualElement.nameLength; 396 int get nameLength => actualElement.nameLength;
379 397
380 @override 398 @override
381 int get nameOffset => actualElement.nameOffset; 399 int get nameOffset => actualElement.nameOffset;
382 400
383 @deprecated
384 @override
385 AstNode get node => computeNode();
386
387 @override 401 @override
388 Source get source => actualElement.source; 402 Source get source => actualElement.source;
389 403
390 @override 404 @override
391 CompilationUnit get unit => actualElement.unit; 405 CompilationUnit get unit => actualElement.unit;
392 406
393 @override 407 @override
394 bool operator ==(Object object) => 408 bool operator ==(Object object) =>
395 object is Element && object.location == _location; 409 object is Element && object.location == _location;
396 410
397 @override 411 @override
398 accept(ElementVisitor visitor) => actualElement.accept(visitor); 412 accept(ElementVisitor visitor) => actualElement.accept(visitor);
399 413
400 @override 414 @override
401 String computeDocumentationComment() => 415 String computeDocumentationComment() => documentationComment;
402 actualElement.computeDocumentationComment();
403 416
404 @override 417 @override
405 AstNode computeNode() => actualElement.computeNode(); 418 AstNode computeNode() => actualElement.computeNode();
406 419
407 @override 420 @override
408 Element getAncestor(Predicate<Element> predicate) => 421 Element/*=E*/ getAncestor/*<E extends Element >*/(
422 Predicate<Element> predicate) =>
409 actualElement.getAncestor(predicate); 423 actualElement.getAncestor(predicate);
410 424
411 @override 425 @override
412 String getExtendedDisplayName(String shortName) => 426 String getExtendedDisplayName(String shortName) =>
413 actualElement.getExtendedDisplayName(shortName); 427 actualElement.getExtendedDisplayName(shortName);
414 428
415 @override 429 @override
416 bool isAccessibleIn(LibraryElement library) => 430 bool isAccessibleIn(LibraryElement library) =>
417 actualElement.isAccessibleIn(library); 431 actualElement.isAccessibleIn(library);
418 432
419 @override 433 @override
434 String toString() => actualElement.toString();
435
436 @override
420 void visitChildren(ElementVisitor visitor) { 437 void visitChildren(ElementVisitor visitor) {
421 actualElement.visitChildren(visitor); 438 actualElement.visitChildren(visitor);
422 } 439 }
423
424 /**
425 * Return a handle on the given element. If the element is already a handle, t hen it will be
426 * returned directly, otherwise a handle of the appropriate class will be cons tructed.
427 *
428 * @param element the element for which a handle is to be constructed
429 * @return a handle on the given element
430 */
431 static Element forElement(Element element) {
432 if (element is ElementHandle) {
433 return element;
434 }
435 while (true) {
436 if (element.kind == ElementKind.CLASS) {
437 return new ClassElementHandle(element as ClassElement);
438 } else if (element.kind == ElementKind.COMPILATION_UNIT) {
439 return new CompilationUnitElementHandle(
440 element as CompilationUnitElement);
441 } else if (element.kind == ElementKind.CONSTRUCTOR) {
442 return new ConstructorElementHandle(element as ConstructorElement);
443 } else if (element.kind == ElementKind.EXPORT) {
444 return new ExportElementHandle(element as ExportElement);
445 } else if (element.kind == ElementKind.FIELD) {
446 return new FieldElementHandle(element as FieldElement);
447 } else if (element.kind == ElementKind.FUNCTION) {
448 return new FunctionElementHandle(element as FunctionElement);
449 } else if (element.kind == ElementKind.GETTER) {
450 return new PropertyAccessorElementHandle(
451 element as PropertyAccessorElement);
452 } else if (element.kind == ElementKind.IMPORT) {
453 return new ImportElementHandle(element as ImportElement);
454 } else if (element.kind == ElementKind.LABEL) {
455 return new LabelElementHandle(element as LabelElement);
456 } else if (element.kind == ElementKind.LIBRARY) {
457 return new LibraryElementHandle(element as LibraryElement);
458 } else if (element.kind == ElementKind.LOCAL_VARIABLE) {
459 return new LocalVariableElementHandle(element as LocalVariableElement);
460 } else if (element.kind == ElementKind.METHOD) {
461 return new MethodElementHandle(element as MethodElement);
462 } else if (element.kind == ElementKind.PARAMETER) {
463 return new ParameterElementHandle(element as ParameterElement);
464 } else if (element.kind == ElementKind.PREFIX) {
465 return new PrefixElementHandle(element as PrefixElement);
466 } else if (element.kind == ElementKind.SETTER) {
467 return new PropertyAccessorElementHandle(
468 element as PropertyAccessorElement);
469 } else if (element.kind == ElementKind.TOP_LEVEL_VARIABLE) {
470 return new TopLevelVariableElementHandle(
471 element as TopLevelVariableElement);
472 } else if (element.kind == ElementKind.FUNCTION_TYPE_ALIAS) {
473 return new FunctionTypeAliasElementHandle(
474 element as FunctionTypeAliasElement);
475 } else if (element.kind == ElementKind.TYPE_PARAMETER) {
476 return new TypeParameterElementHandle(element as TypeParameterElement);
477 } else {
478 throw new UnsupportedOperationException();
479 }
480 break;
481 }
482 }
483
484 /**
485 * Return an array of the same size as the given array where each element of t he returned array is
486 * a handle for the corresponding element of the given array.
487 *
488 * @param elements the elements for which handles are to be created
489 * @return an array of handles to the given elements
490 */
491 static List<Element> forElements(List<Element> elements) {
492 int length = elements.length;
493 List<Element> handles = new List<Element>.from(elements);
494 for (int i = 0; i < length; i++) {
495 handles[i] = forElement(elements[i]);
496 }
497 return handles;
498 }
499 } 440 }
500 441
501 /** 442 /**
502 * The abstract class `ExecutableElementHandle` implements the behavior common t o objects that 443 * Interface which allows an [Element] handle to be resynthesized based on an
503 * implement a handle to an [ExecutableElement]. 444 * [ElementLocation]. The concrete classes implementing element handles use
445 * this interface to retrieve the underlying elements when queried.
446 */
447 abstract class ElementResynthesizer {
448 /**
449 * The context that owns the element to be resynthesized.
450 */
451 final AnalysisContext context;
452
453 /**
454 * Initialize a newly created resynthesizer to resynthesize elements in the
455 * given [context].
456 */
457 ElementResynthesizer(this.context);
458
459 /**
460 * Return the element referenced by the given [location].
461 */
462 Element getElement(ElementLocation location);
463 }
464
465 /**
466 * A handle to an [ExecutableElement].
504 */ 467 */
505 abstract class ExecutableElementHandle extends ElementHandle 468 abstract class ExecutableElementHandle extends ElementHandle
506 implements ExecutableElement { 469 implements ExecutableElement {
507 /** 470 /**
508 * Initialize a newly created element handle to represent the given element. 471 * Initialize a newly created element handle to represent the element at the
509 * 472 * given [_location]. The [_resynthesizer] will be used to resynthesize the
510 * @param element the element being represented 473 * element when needed.
511 */ 474 */
512 ExecutableElementHandle(ExecutableElement element) : super(element); 475 ExecutableElementHandle(
476 ElementResynthesizer resynthesizer, ElementLocation location)
477 : super(resynthesizer, location);
513 478
514 @override 479 @override
515 ExecutableElement get actualElement => 480 ExecutableElement get actualElement =>
516 super.actualElement as ExecutableElement; 481 super.actualElement as ExecutableElement;
517 482
518 @override 483 @override
519 List<FunctionElement> get functions => actualElement.functions; 484 List<FunctionElement> get functions => actualElement.functions;
520 485
521 @override 486 @override
522 bool get hasImplicitReturnType => actualElement.hasImplicitReturnType; 487 bool get hasImplicitReturnType => actualElement.hasImplicitReturnType;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 DartType get returnType => actualElement.returnType; 520 DartType get returnType => actualElement.returnType;
556 521
557 @override 522 @override
558 FunctionType get type => actualElement.type; 523 FunctionType get type => actualElement.type;
559 524
560 @override 525 @override
561 List<TypeParameterElement> get typeParameters => actualElement.typeParameters; 526 List<TypeParameterElement> get typeParameters => actualElement.typeParameters;
562 } 527 }
563 528
564 /** 529 /**
565 * Instances of the class `ExportElementHandle` implement a handle to an `Export Element` 530 * A handle to an [ExportElement].
566 * .
567 */ 531 */
568 class ExportElementHandle extends ElementHandle implements ExportElement { 532 class ExportElementHandle extends ElementHandle implements ExportElement {
569 /** 533 /**
570 * Initialize a newly created element handle to represent the given element. 534 * Initialize a newly created element handle to represent the element at the
571 * 535 * given [_location]. The [_resynthesizer] will be used to resynthesize the
572 * @param element the element being represented 536 * element when needed.
573 */ 537 */
574 ExportElementHandle(ExportElement element) : super(element); 538 ExportElementHandle(
539 ElementResynthesizer resynthesizer, ElementLocation location)
540 : super(resynthesizer, location);
575 541
576 @override 542 @override
577 ExportElement get actualElement => super.actualElement as ExportElement; 543 ExportElement get actualElement => super.actualElement as ExportElement;
578 544
579 @override 545 @override
580 List<NamespaceCombinator> get combinators => actualElement.combinators; 546 List<NamespaceCombinator> get combinators => actualElement.combinators;
581 547
582 @override 548 @override
583 LibraryElement get exportedLibrary => actualElement.exportedLibrary; 549 LibraryElement get exportedLibrary => actualElement.exportedLibrary;
584 550
585 @override 551 @override
586 ElementKind get kind => ElementKind.EXPORT; 552 ElementKind get kind => ElementKind.EXPORT;
587 553
588 @override 554 @override
589 String get uri => actualElement.uri; 555 String get uri => actualElement.uri;
590 556
591 @override 557 @override
592 int get uriEnd => actualElement.uriEnd; 558 int get uriEnd => actualElement.uriEnd;
593 559
594 @override 560 @override
595 int get uriOffset => actualElement.uriOffset; 561 int get uriOffset => actualElement.uriOffset;
596 } 562 }
597 563
598 /** 564 /**
599 * Instances of the class `FieldElementHandle` implement a handle to a `FieldEle ment`. 565 * A handle to a [FieldElement].
600 */ 566 */
601 class FieldElementHandle extends PropertyInducingElementHandle 567 class FieldElementHandle extends PropertyInducingElementHandle
602 implements FieldElement { 568 implements FieldElement {
603 /** 569 /**
604 * Initialize a newly created element handle to represent the given element. 570 * Initialize a newly created element handle to represent the element at the
605 * 571 * given [_location]. The [_resynthesizer] will be used to resynthesize the
606 * @param element the element being represented 572 * element when needed.
607 */ 573 */
608 FieldElementHandle(FieldElement element) : super(element); 574 FieldElementHandle(
575 ElementResynthesizer resynthesizer, ElementLocation location)
576 : super(resynthesizer, location);
609 577
610 @override 578 @override
611 FieldElement get actualElement => super.actualElement as FieldElement; 579 FieldElement get actualElement => super.actualElement as FieldElement;
612 580
613 @override 581 @override
614 ClassElement get enclosingElement => actualElement.enclosingElement; 582 ClassElement get enclosingElement => actualElement.enclosingElement;
615 583
616 @override 584 @override
617 bool get isEnumConstant => actualElement.isEnumConstant; 585 bool get isEnumConstant => actualElement.isEnumConstant;
618 586
619 @override 587 @override
588 bool get isVirtual => actualElement.isVirtual;
589
590 @override
620 ElementKind get kind => ElementKind.FIELD; 591 ElementKind get kind => ElementKind.FIELD;
621 592
622 @override 593 @override
623 VariableDeclaration computeNode() => actualElement.computeNode(); 594 VariableDeclaration computeNode() => actualElement.computeNode();
624 } 595 }
625 596
626 /** 597 /**
627 * Instances of the class `FunctionElementHandle` implement a handle to a 598 * A handle to a [FunctionElement].
628 * `FunctionElement`.
629 */ 599 */
630 class FunctionElementHandle extends ExecutableElementHandle 600 class FunctionElementHandle extends ExecutableElementHandle
631 implements FunctionElement { 601 implements FunctionElement {
632 /** 602 /**
633 * Initialize a newly created element handle to represent the given element. 603 * Initialize a newly created element handle to represent the element at the
634 * 604 * given [_location]. The [_resynthesizer] will be used to resynthesize the
635 * @param element the element being represented 605 * element when needed.
636 */ 606 */
637 FunctionElementHandle(FunctionElement element) : super(element); 607 FunctionElementHandle(
608 ElementResynthesizer resynthesizer, ElementLocation location)
609 : super(resynthesizer, location);
638 610
639 @override 611 @override
640 FunctionElement get actualElement => super.actualElement as FunctionElement; 612 FunctionElement get actualElement => super.actualElement as FunctionElement;
641 613
642 @override 614 @override
643 bool get isEntryPoint => actualElement.isEntryPoint; 615 bool get isEntryPoint => actualElement.isEntryPoint;
644 616
645 @override 617 @override
646 ElementKind get kind => ElementKind.FUNCTION; 618 ElementKind get kind => ElementKind.FUNCTION;
647 619
648 @override 620 @override
649 SourceRange get visibleRange => actualElement.visibleRange; 621 SourceRange get visibleRange => actualElement.visibleRange;
650 622
651 @override 623 @override
652 FunctionDeclaration computeNode() => actualElement.computeNode(); 624 FunctionDeclaration computeNode() => actualElement.computeNode();
653 } 625 }
654 626
655 /** 627 /**
656 * Instances of the class `FunctionTypeAliasElementHandle` implement a handle to a 628 * A handle to a [FunctionTypeAliasElement].
657 * `FunctionTypeAliasElement`.
658 */ 629 */
659 class FunctionTypeAliasElementHandle extends ElementHandle 630 class FunctionTypeAliasElementHandle extends ElementHandle
660 implements FunctionTypeAliasElement { 631 implements FunctionTypeAliasElement {
661 /** 632 /**
662 * Initialize a newly created element handle to represent the given element. 633 * Initialize a newly created element handle to represent the element at the
663 * 634 * given [_location]. The [_resynthesizer] will be used to resynthesize the
664 * @param element the element being represented 635 * element when needed.
665 */ 636 */
666 FunctionTypeAliasElementHandle(FunctionTypeAliasElement element) 637 FunctionTypeAliasElementHandle(
667 : super(element); 638 ElementResynthesizer resynthesizer, ElementLocation location)
639 : super(resynthesizer, location);
668 640
669 @override 641 @override
670 FunctionTypeAliasElement get actualElement => 642 FunctionTypeAliasElement get actualElement =>
671 super.actualElement as FunctionTypeAliasElement; 643 super.actualElement as FunctionTypeAliasElement;
672 644
673 @override 645 @override
674 CompilationUnitElement get enclosingElement => 646 CompilationUnitElement get enclosingElement =>
675 super.enclosingElement as CompilationUnitElement; 647 super.enclosingElement as CompilationUnitElement;
676 648
677 @override 649 @override
678 ElementKind get kind => ElementKind.FUNCTION_TYPE_ALIAS; 650 ElementKind get kind => ElementKind.FUNCTION_TYPE_ALIAS;
679 651
680 @override 652 @override
681 List<ParameterElement> get parameters => actualElement.parameters; 653 List<ParameterElement> get parameters => actualElement.parameters;
682 654
683 @override 655 @override
684 DartType get returnType => actualElement.returnType; 656 DartType get returnType => actualElement.returnType;
685 657
686 @override 658 @override
687 FunctionType get type => actualElement.type; 659 FunctionType get type => actualElement.type;
688 660
689 @override 661 @override
690 List<TypeParameterElement> get typeParameters => actualElement.typeParameters; 662 List<TypeParameterElement> get typeParameters => actualElement.typeParameters;
691 663
692 @override 664 @override
693 FunctionTypeAlias computeNode() => actualElement.computeNode(); 665 FunctionTypeAlias computeNode() => actualElement.computeNode();
694 } 666 }
695 667
696 /** 668 /**
697 * Instances of the class `ImportElementHandle` implement a handle to an `Import Element` 669 * A handle to an [ImportElement].
698 * .
699 */ 670 */
700 class ImportElementHandle extends ElementHandle implements ImportElement { 671 class ImportElementHandle extends ElementHandle implements ImportElement {
701 /** 672 /**
702 * Initialize a newly created element handle to represent the given element. 673 * Initialize a newly created element handle to represent the element at the
703 * 674 * given [_location]. The [_resynthesizer] will be used to resynthesize the
704 * @param element the element being represented 675 * element when needed.
705 */ 676 */
706 ImportElementHandle(ImportElement element) : super(element); 677 ImportElementHandle(
678 ElementResynthesizer resynthesizer, ElementLocation location)
679 : super(resynthesizer, location);
707 680
708 @override 681 @override
709 ImportElement get actualElement => super.actualElement as ImportElement; 682 ImportElement get actualElement => super.actualElement as ImportElement;
710 683
711 @override 684 @override
712 List<NamespaceCombinator> get combinators => actualElement.combinators; 685 List<NamespaceCombinator> get combinators => actualElement.combinators;
713 686
714 @override 687 @override
715 LibraryElement get importedLibrary => actualElement.importedLibrary; 688 LibraryElement get importedLibrary => actualElement.importedLibrary;
716 689
(...skipping 13 matching lines...) Expand all
730 String get uri => actualElement.uri; 703 String get uri => actualElement.uri;
731 704
732 @override 705 @override
733 int get uriEnd => actualElement.uriEnd; 706 int get uriEnd => actualElement.uriEnd;
734 707
735 @override 708 @override
736 int get uriOffset => actualElement.uriOffset; 709 int get uriOffset => actualElement.uriOffset;
737 } 710 }
738 711
739 /** 712 /**
740 * Instances of the class `LabelElementHandle` implement a handle to a `LabelEle ment`. 713 * A handle to a [LabelElement].
741 */ 714 */
742 class LabelElementHandle extends ElementHandle implements LabelElement { 715 class LabelElementHandle extends ElementHandle implements LabelElement {
743 /** 716 /**
744 * Initialize a newly created element handle to represent the given element. 717 * Initialize a newly created element handle to represent the element at the
745 * 718 * given [_location]. The [_resynthesizer] will be used to resynthesize the
746 * @param element the element being represented 719 * element when needed.
747 */ 720 */
748 LabelElementHandle(LabelElement element) : super(element); 721 LabelElementHandle(
722 ElementResynthesizer resynthesizer, ElementLocation location)
723 : super(resynthesizer, location);
749 724
750 @override 725 @override
751 ExecutableElement get enclosingElement => 726 ExecutableElement get enclosingElement =>
752 super.enclosingElement as ExecutableElement; 727 super.enclosingElement as ExecutableElement;
753 728
754 @override 729 @override
755 ElementKind get kind => ElementKind.LABEL; 730 ElementKind get kind => ElementKind.LABEL;
756 } 731 }
757 732
758 /** 733 /**
759 * Instances of the class `LibraryElementHandle` implement a handle to a 734 * A handle to a [LibraryElement].
760 * `LibraryElement`.
761 */ 735 */
762 class LibraryElementHandle extends ElementHandle implements LibraryElement { 736 class LibraryElementHandle extends ElementHandle implements LibraryElement {
763 /** 737 /**
764 * Initialize a newly created element handle to represent the given element. 738 * Initialize a newly created element handle to represent the element at the
765 * 739 * given [_location]. The [_resynthesizer] will be used to resynthesize the
766 * @param element the element being represented 740 * element when needed.
767 */ 741 */
768 LibraryElementHandle(LibraryElement element) : super(element); 742 LibraryElementHandle(
743 ElementResynthesizer resynthesizer, ElementLocation location)
744 : super(resynthesizer, location);
769 745
770 @override 746 @override
771 LibraryElement get actualElement => super.actualElement as LibraryElement; 747 LibraryElement get actualElement => super.actualElement as LibraryElement;
772 748
773 @override 749 @override
774 CompilationUnitElement get definingCompilationUnit => 750 CompilationUnitElement get definingCompilationUnit =>
775 actualElement.definingCompilationUnit; 751 actualElement.definingCompilationUnit;
776 752
777 @override 753 @override
778 FunctionElement get entryPoint => actualElement.entryPoint; 754 FunctionElement get entryPoint => actualElement.entryPoint;
779 755
780 @override 756 @override
781 List<LibraryElement> get exportedLibraries => actualElement.exportedLibraries; 757 List<LibraryElement> get exportedLibraries => actualElement.exportedLibraries;
782 758
783 @override 759 @override
784 Namespace get exportNamespace => actualElement.exportNamespace; 760 Namespace get exportNamespace => actualElement.exportNamespace;
785 761
786 @override 762 @override
787 List<ExportElement> get exports => actualElement.exports; 763 List<ExportElement> get exports => actualElement.exports;
788 764
789 @override 765 @override
790 bool get hasExtUri => actualElement.hasExtUri; 766 bool get hasExtUri => actualElement.hasExtUri;
791 767
792 @override 768 @override
793 bool get hasLoadLibraryFunction => actualElement.hasLoadLibraryFunction; 769 bool get hasLoadLibraryFunction => actualElement.hasLoadLibraryFunction;
794 770
795 @override 771 @override
772 String get identifier => location.components.last;
773
774 @override
796 List<LibraryElement> get importedLibraries => actualElement.importedLibraries; 775 List<LibraryElement> get importedLibraries => actualElement.importedLibraries;
797 776
798 @override 777 @override
799 List<ImportElement> get imports => actualElement.imports; 778 List<ImportElement> get imports => actualElement.imports;
800 779
801 @override 780 @override
802 bool get isBrowserApplication => actualElement.isBrowserApplication; 781 bool get isBrowserApplication => actualElement.isBrowserApplication;
803 782
804 @override 783 @override
784 bool get isDartAsync => actualElement.isDartAsync;
785
786 @override
805 bool get isDartCore => actualElement.isDartCore; 787 bool get isDartCore => actualElement.isDartCore;
806 788
807 @override 789 @override
808 bool get isInSdk => actualElement.isInSdk; 790 bool get isInSdk => actualElement.isInSdk;
809 791
810 @override 792 @override
811 ElementKind get kind => ElementKind.LIBRARY; 793 ElementKind get kind => ElementKind.LIBRARY;
812 794
813 @override 795 @override
796 List<LibraryElement> get libraryCycle => actualElement.libraryCycle;
797
798 @override
814 FunctionElement get loadLibraryFunction => actualElement.loadLibraryFunction; 799 FunctionElement get loadLibraryFunction => actualElement.loadLibraryFunction;
815 800
816 @override 801 @override
817 List<CompilationUnitElement> get parts => actualElement.parts; 802 List<CompilationUnitElement> get parts => actualElement.parts;
818 803
819 @override 804 @override
820 List<PrefixElement> get prefixes => actualElement.prefixes; 805 List<PrefixElement> get prefixes => actualElement.prefixes;
821 806
822 @override 807 @override
823 Namespace get publicNamespace => actualElement.publicNamespace; 808 Namespace get publicNamespace => actualElement.publicNamespace;
824 809
825 @override 810 @override
826 List<CompilationUnitElement> get units => actualElement.units; 811 List<CompilationUnitElement> get units => actualElement.units;
827 812
828 @override 813 @override
829 List<LibraryElement> get visibleLibraries => actualElement.visibleLibraries;
830
831 @override
832 List<ImportElement> getImportsWithPrefix(PrefixElement prefixElement) => 814 List<ImportElement> getImportsWithPrefix(PrefixElement prefixElement) =>
833 actualElement.getImportsWithPrefix(prefixElement); 815 actualElement.getImportsWithPrefix(prefixElement);
834 816
835 @override 817 @override
836 ClassElement getType(String className) => actualElement.getType(className); 818 ClassElement getType(String className) => actualElement.getType(className);
837
838 @override
839 bool isUpToDate(int timeStamp) => actualElement.isUpToDate(timeStamp);
840 } 819 }
841 820
842 /** 821 /**
843 * Instances of the class `LocalVariableElementHandle` implement a handle to a 822 * A handle to a [LocalVariableElement].
844 * `LocalVariableElement`.
845 */ 823 */
846 class LocalVariableElementHandle extends VariableElementHandle 824 class LocalVariableElementHandle extends VariableElementHandle
847 implements LocalVariableElement { 825 implements LocalVariableElement {
848 /** 826 /**
849 * Initialize a newly created element handle to represent the given element. 827 * Initialize a newly created element handle to represent the element at the
850 * 828 * given [_location]. The [_resynthesizer] will be used to resynthesize the
851 * @param element the element being represented 829 * element when needed.
852 */ 830 */
853 LocalVariableElementHandle(LocalVariableElement element) : super(element); 831 LocalVariableElementHandle(
832 ElementResynthesizer resynthesizer, ElementLocation location)
833 : super(resynthesizer, location);
854 834
855 @override 835 @override
856 LocalVariableElement get actualElement => 836 LocalVariableElement get actualElement =>
857 super.actualElement as LocalVariableElement; 837 super.actualElement as LocalVariableElement;
858 838
859 @override 839 @override
860 ElementKind get kind => ElementKind.LOCAL_VARIABLE; 840 ElementKind get kind => ElementKind.LOCAL_VARIABLE;
861 841
862 @override 842 @override
863 SourceRange get visibleRange => actualElement.visibleRange; 843 SourceRange get visibleRange => actualElement.visibleRange;
864 844
865 @override 845 @override
866 VariableDeclaration computeNode() => actualElement.computeNode(); 846 VariableDeclaration computeNode() => actualElement.computeNode();
867 } 847 }
868 848
869 /** 849 /**
870 * Instances of the class `MethodElementHandle` implement a handle to a `MethodE lement`. 850 * A handle to a [MethodElement].
871 */ 851 */
872 class MethodElementHandle extends ExecutableElementHandle 852 class MethodElementHandle extends ExecutableElementHandle
873 implements MethodElement { 853 implements MethodElement {
874 /** 854 /**
875 * Initialize a newly created element handle to represent the given element. 855 * Initialize a newly created element handle to represent the element at the
876 * 856 * given [_location]. The [_resynthesizer] will be used to resynthesize the
877 * @param element the element being represented 857 * element when needed.
878 */ 858 */
879 MethodElementHandle(MethodElement element) : super(element); 859 MethodElementHandle(
860 ElementResynthesizer resynthesizer, ElementLocation location)
861 : super(resynthesizer, location);
880 862
881 @override 863 @override
882 MethodElement get actualElement => super.actualElement as MethodElement; 864 MethodElement get actualElement => super.actualElement as MethodElement;
883 865
884 @override 866 @override
885 ClassElement get enclosingElement => super.enclosingElement as ClassElement; 867 ClassElement get enclosingElement => super.enclosingElement as ClassElement;
886 868
887 @override 869 @override
888 bool get isStatic => actualElement.isStatic; 870 bool get isStatic => actualElement.isStatic;
889 871
890 @override 872 @override
891 ElementKind get kind => ElementKind.METHOD; 873 ElementKind get kind => ElementKind.METHOD;
892 874
893 @override 875 @override
894 MethodDeclaration computeNode() => actualElement.computeNode(); 876 MethodDeclaration computeNode() => actualElement.computeNode();
895 } 877 }
896 878
897 /** 879 /**
898 * Instances of the class `ParameterElementHandle` implement a handle to a 880 * A handle to a [ParameterElement].
899 * `ParameterElement`.
900 */ 881 */
901 class ParameterElementHandle extends VariableElementHandle 882 class ParameterElementHandle extends VariableElementHandle
902 with ParameterElementMixin 883 with ParameterElementMixin
903 implements ParameterElement { 884 implements ParameterElement {
904 /** 885 /**
905 * Initialize a newly created element handle to represent the given element. 886 * Initialize a newly created element handle to represent the element at the
906 * 887 * given [_location]. The [_resynthesizer] will be used to resynthesize the
907 * @param element the element being represented 888 * element when needed.
908 */ 889 */
909 ParameterElementHandle(ParameterElement element) : super(element); 890 ParameterElementHandle(
891 ElementResynthesizer resynthesizer, ElementLocation location)
892 : super(resynthesizer, location);
910 893
911 @override 894 @override
912 ParameterElement get actualElement => super.actualElement as ParameterElement; 895 ParameterElement get actualElement => super.actualElement as ParameterElement;
913 896
914 @override 897 @override
915 String get defaultValueCode => actualElement.defaultValueCode; 898 String get defaultValueCode => actualElement.defaultValueCode;
916 899
917 @override 900 @override
901 bool get isCovariant => actualElement.isCovariant;
902
903 @override
918 bool get isInitializingFormal => actualElement.isInitializingFormal; 904 bool get isInitializingFormal => actualElement.isInitializingFormal;
919 905
920 @override 906 @override
921 ElementKind get kind => ElementKind.PARAMETER; 907 ElementKind get kind => ElementKind.PARAMETER;
922 908
923 @override 909 @override
924 ParameterKind get parameterKind => actualElement.parameterKind; 910 ParameterKind get parameterKind => actualElement.parameterKind;
925 911
926 @override 912 @override
927 List<ParameterElement> get parameters => actualElement.parameters; 913 List<ParameterElement> get parameters => actualElement.parameters;
928 914
929 @override 915 @override
930 List<TypeParameterElement> get typeParameters => actualElement.typeParameters; 916 List<TypeParameterElement> get typeParameters => actualElement.typeParameters;
931 917
932 @override 918 @override
933 SourceRange get visibleRange => actualElement.visibleRange; 919 SourceRange get visibleRange => actualElement.visibleRange;
920
921 @override
922 FormalParameter computeNode() => super.computeNode();
934 } 923 }
935 924
936 /** 925 /**
937 * Instances of the class `PrefixElementHandle` implement a handle to a `PrefixE lement`. 926 * A handle to a [PrefixElement].
938 */ 927 */
939 class PrefixElementHandle extends ElementHandle implements PrefixElement { 928 class PrefixElementHandle extends ElementHandle implements PrefixElement {
940 /** 929 /**
941 * Initialize a newly created element handle to represent the given element. 930 * Initialize a newly created element handle to represent the element at the
942 * 931 * given [_location]. The [_resynthesizer] will be used to resynthesize the
943 * @param element the element being represented 932 * element when needed.
944 */ 933 */
945 PrefixElementHandle(PrefixElement element) : super(element); 934 PrefixElementHandle(
935 ElementResynthesizer resynthesizer, ElementLocation location)
936 : super(resynthesizer, location);
946 937
947 @override 938 @override
948 PrefixElement get actualElement => super.actualElement as PrefixElement; 939 PrefixElement get actualElement => super.actualElement as PrefixElement;
949 940
950 @override 941 @override
951 LibraryElement get enclosingElement => 942 LibraryElement get enclosingElement =>
952 super.enclosingElement as LibraryElement; 943 super.enclosingElement as LibraryElement;
953 944
954 @override 945 @override
955 List<LibraryElement> get importedLibraries => actualElement.importedLibraries; 946 List<LibraryElement> get importedLibraries => LibraryElement.EMPTY_LIST;
956 947
957 @override 948 @override
958 ElementKind get kind => ElementKind.PREFIX; 949 ElementKind get kind => ElementKind.PREFIX;
959 } 950 }
960 951
961 /** 952 /**
962 * Instances of the class `PropertyAccessorElementHandle` implement a handle to a 953 * A handle to a [PropertyAccessorElement].
963 * `PropertyAccessorElement`.
964 */ 954 */
965 class PropertyAccessorElementHandle extends ExecutableElementHandle 955 class PropertyAccessorElementHandle extends ExecutableElementHandle
966 implements PropertyAccessorElement { 956 implements PropertyAccessorElement {
967 /** 957 /**
968 * Initialize a newly created element handle to represent the given element. 958 * Initialize a newly created element handle to represent the element at the
969 * 959 * given [_location]. The [_resynthesizer] will be used to resynthesize the
970 * @param element the element being represented 960 * element when needed.
971 */ 961 */
972 PropertyAccessorElementHandle(PropertyAccessorElement element) 962 PropertyAccessorElementHandle(
973 : super(element); 963 ElementResynthesizer resynthesizer, ElementLocation location)
964 : super(resynthesizer, location);
974 965
975 @override 966 @override
976 PropertyAccessorElement get actualElement => 967 PropertyAccessorElement get actualElement =>
977 super.actualElement as PropertyAccessorElement; 968 super.actualElement as PropertyAccessorElement;
978 969
979 @override 970 @override
980 PropertyAccessorElement get correspondingGetter => 971 PropertyAccessorElement get correspondingGetter =>
981 actualElement.correspondingGetter; 972 actualElement.correspondingGetter;
982 973
983 @override 974 @override
984 PropertyAccessorElement get correspondingSetter => 975 PropertyAccessorElement get correspondingSetter =>
985 actualElement.correspondingSetter; 976 actualElement.correspondingSetter;
986 977
987 @override 978 @override
988 bool get isGetter => actualElement.isGetter; 979 bool get isGetter => !isSetter;
989 980
990 @override 981 @override
991 bool get isSetter => actualElement.isSetter; 982 bool get isSetter => location.components.last.endsWith('=');
992 983
993 @override 984 @override
994 ElementKind get kind { 985 ElementKind get kind {
995 if (isGetter) { 986 if (isGetter) {
996 return ElementKind.GETTER; 987 return ElementKind.GETTER;
997 } else { 988 } else {
998 return ElementKind.SETTER; 989 return ElementKind.SETTER;
999 } 990 }
1000 } 991 }
1001 992
1002 @override 993 @override
1003 PropertyInducingElement get variable => actualElement.variable; 994 PropertyInducingElement get variable => actualElement.variable;
1004 } 995 }
1005 996
1006 /** 997 /**
1007 * The abstract class `PropertyInducingElementHandle` implements the behavior co mmon to 998 * A handle to an [PropertyInducingElement].
1008 * objects that implement a handle to an `PropertyInducingElement`.
1009 */ 999 */
1010 abstract class PropertyInducingElementHandle extends VariableElementHandle 1000 abstract class PropertyInducingElementHandle extends VariableElementHandle
1011 implements PropertyInducingElement { 1001 implements PropertyInducingElement {
1012 /** 1002 /**
1013 * Initialize a newly created element handle to represent the given element. 1003 * Initialize a newly created element handle to represent the element at the
1014 * 1004 * given [_location]. The [_resynthesizer] will be used to resynthesize the
1015 * @param element the element being represented 1005 * element when needed.
1016 */ 1006 */
1017 PropertyInducingElementHandle(PropertyInducingElement element) 1007 PropertyInducingElementHandle(
1018 : super(element); 1008 ElementResynthesizer resynthesizer, ElementLocation location)
1009 : super(resynthesizer, location);
1019 1010
1020 @override 1011 @override
1021 PropertyInducingElement get actualElement => 1012 PropertyInducingElement get actualElement =>
1022 super.actualElement as PropertyInducingElement; 1013 super.actualElement as PropertyInducingElement;
1023 1014
1024 @override 1015 @override
1025 PropertyAccessorElement get getter => actualElement.getter; 1016 PropertyAccessorElement get getter => actualElement.getter;
1026 1017
1027 @override 1018 @override
1028 DartType get propagatedType => actualElement.propagatedType; 1019 DartType get propagatedType => actualElement.propagatedType;
1029 1020
1030 @override 1021 @override
1031 PropertyAccessorElement get setter => actualElement.setter; 1022 PropertyAccessorElement get setter => actualElement.setter;
1032 } 1023 }
1033 1024
1034 /** 1025 /**
1035 * Instances of the class `TopLevelVariableElementHandle` implement a handle to a 1026 * A handle to a [TopLevelVariableElement].
1036 * `TopLevelVariableElement`.
1037 */ 1027 */
1038 class TopLevelVariableElementHandle extends PropertyInducingElementHandle 1028 class TopLevelVariableElementHandle extends PropertyInducingElementHandle
1039 implements TopLevelVariableElement { 1029 implements TopLevelVariableElement {
1040 /** 1030 /**
1041 * Initialize a newly created element handle to represent the given element. 1031 * Initialize a newly created element handle to represent the element at the
1042 * 1032 * given [_location]. The [_resynthesizer] will be used to resynthesize the
1043 * @param element the element being represented 1033 * element when needed.
1044 */ 1034 */
1045 TopLevelVariableElementHandle(TopLevelVariableElement element) 1035 TopLevelVariableElementHandle(
1046 : super(element); 1036 ElementResynthesizer resynthesizer, ElementLocation location)
1037 : super(resynthesizer, location);
1047 1038
1048 @override 1039 @override
1049 ElementKind get kind => ElementKind.TOP_LEVEL_VARIABLE; 1040 ElementKind get kind => ElementKind.TOP_LEVEL_VARIABLE;
1041
1042 @override
1043 VariableDeclaration computeNode() => super.computeNode();
1050 } 1044 }
1051 1045
1052 /** 1046 /**
1053 * Instances of the class `TypeParameterElementHandle` implement a handle to a 1047 * A handle to a [TypeParameterElement].
1054 * [TypeParameterElement].
1055 */ 1048 */
1056 class TypeParameterElementHandle extends ElementHandle 1049 class TypeParameterElementHandle extends ElementHandle
1057 implements TypeParameterElement { 1050 implements TypeParameterElement {
1058 /** 1051 /**
1059 * Initialize a newly created element handle to represent the given element. 1052 * Initialize a newly created element handle to represent the element at the
1060 * 1053 * given [_location]. The [_resynthesizer] will be used to resynthesize the
1061 * @param element the element being represented 1054 * element when needed.
1062 */ 1055 */
1063 TypeParameterElementHandle(TypeParameterElement element) : super(element); 1056 TypeParameterElementHandle(
1057 ElementResynthesizer resynthesizer, ElementLocation location)
1058 : super(resynthesizer, location);
1064 1059
1065 @override 1060 @override
1066 TypeParameterElement get actualElement => 1061 TypeParameterElement get actualElement =>
1067 super.actualElement as TypeParameterElement; 1062 super.actualElement as TypeParameterElement;
1068 1063
1069 @override 1064 @override
1070 DartType get bound => actualElement.bound; 1065 DartType get bound => actualElement.bound;
1071 1066
1072 @override 1067 @override
1073 ElementKind get kind => ElementKind.TYPE_PARAMETER; 1068 ElementKind get kind => ElementKind.TYPE_PARAMETER;
1074 1069
1075 @override 1070 @override
1076 TypeParameterType get type => actualElement.type; 1071 TypeParameterType get type => actualElement.type;
1077 } 1072 }
1078 1073
1079 /** 1074 /**
1080 * The abstract class `VariableElementHandle` implements the behavior common to objects that 1075 * A handle to an [VariableElement].
1081 * implement a handle to an `VariableElement`.
1082 */ 1076 */
1083 abstract class VariableElementHandle extends ElementHandle 1077 abstract class VariableElementHandle extends ElementHandle
1084 implements VariableElement { 1078 implements VariableElement {
1085 /** 1079 /**
1086 * Initialize a newly created element handle to represent the given element. 1080 * Initialize a newly created element handle to represent the element at the
1087 * 1081 * given [_location]. The [_resynthesizer] will be used to resynthesize the
1088 * @param element the element being represented 1082 * element when needed.
1089 */ 1083 */
1090 VariableElementHandle(VariableElement element) : super(element); 1084 VariableElementHandle(
1085 ElementResynthesizer resynthesizer, ElementLocation location)
1086 : super(resynthesizer, location);
1091 1087
1092 @override 1088 @override
1093 VariableElement get actualElement => super.actualElement as VariableElement; 1089 VariableElement get actualElement => super.actualElement as VariableElement;
1094 1090
1095 @override 1091 @override
1096 DartObject get constantValue => actualElement.constantValue; 1092 DartObject get constantValue => actualElement.constantValue;
1097 1093
1098 @override 1094 @override
1099 bool get hasImplicitType => actualElement.hasImplicitType; 1095 bool get hasImplicitType => actualElement.hasImplicitType;
1100 1096
1101 @override 1097 @override
1102 FunctionElement get initializer => actualElement.initializer; 1098 FunctionElement get initializer => actualElement.initializer;
1103 1099
1104 @override 1100 @override
1105 bool get isConst => actualElement.isConst; 1101 bool get isConst => actualElement.isConst;
1106 1102
1107 @override 1103 @override
1108 bool get isFinal => actualElement.isFinal; 1104 bool get isFinal => actualElement.isFinal;
1109 1105
1106 @deprecated
1110 @override 1107 @override
1111 bool get isPotentiallyMutatedInClosure => 1108 bool get isPotentiallyMutatedInClosure =>
1112 actualElement.isPotentiallyMutatedInClosure; 1109 actualElement.isPotentiallyMutatedInClosure;
1113 1110
1111 @deprecated
1114 @override 1112 @override
1115 bool get isPotentiallyMutatedInScope => 1113 bool get isPotentiallyMutatedInScope =>
1116 actualElement.isPotentiallyMutatedInScope; 1114 actualElement.isPotentiallyMutatedInScope;
1117 1115
1118 @override 1116 @override
1119 bool get isStatic => actualElement.isStatic; 1117 bool get isStatic => actualElement.isStatic;
1120 1118
1121 @override 1119 @override
1122 DartType get type => actualElement.type; 1120 DartType get type => actualElement.type;
1121
1122 @override
1123 DartObject computeConstantValue() => actualElement.computeConstantValue();
1123 } 1124 }
1124
1125 /**
1126 * TODO(scheglov) invalid implementation
1127 */
1128 class WeakReference<T> {
1129 final T value;
1130 WeakReference(this.value);
1131 T get() => value;
1132 }
OLDNEW
« no previous file with comments | « packages/analyzer/lib/src/dart/element/element.dart ('k') | packages/analyzer/lib/src/dart/element/member.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698