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

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

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

Powered by Google App Engine
This is Rietveld 408576698