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

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

Powered by Google App Engine
This is Rietveld 408576698