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

Side by Side Diff: pkg/analyzer/lib/src/dart/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 library analyzer.src.generated.element_handle; 5 library analyzer.src.generated.element_handle;
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/element/element.dart'; 8 import 'package:analyzer/dart/element/element.dart';
9 import 'package:analyzer/dart/element/type.dart'; 9 import 'package:analyzer/dart/element/type.dart';
10 import 'package:analyzer/src/dart/element/element.dart'; 10 import 'package:analyzer/src/dart/element/element.dart';
11 import 'package:analyzer/src/generated/constant.dart'; 11 import 'package:analyzer/src/generated/constant.dart';
12 import 'package:analyzer/src/generated/engine.dart'; 12 import 'package:analyzer/src/generated/engine.dart';
13 import 'package:analyzer/src/generated/java_engine.dart'; 13 import 'package:analyzer/src/generated/java_engine.dart';
14 import 'package:analyzer/src/generated/resolver.dart'; 14 import 'package:analyzer/src/generated/resolver.dart';
15 import 'package:analyzer/src/generated/source.dart'; 15 import 'package:analyzer/src/generated/source.dart';
16 import 'package:analyzer/src/generated/utilities_dart.dart'; 16 import 'package:analyzer/src/generated/utilities_dart.dart';
17 17
18 /** 18 /**
19 * Instances of the class `ClassElementHandle` implement a handle to a `ClassEle ment`. 19 * A handle to a [ClassElement].
20 */ 20 */
21 class ClassElementHandle extends ElementHandle implements ClassElement { 21 class ClassElementHandle extends ElementHandle implements ClassElement {
22 /** 22 /**
23 * Initialize a newly created element handle to represent the given element. 23 * Initialize a newly created element handle to represent the element at the
24 * 24 * given [_location]. The [_resynthesizer] will be used to resynthesize the
25 * @param element the element being represented 25 * element when needed.
26 */ 26 */
27 ClassElementHandle( 27 ClassElementHandle(
28 ElementResynthesizer resynthesizer, ElementLocation location) 28 ElementResynthesizer resynthesizer, ElementLocation location)
29 : super(resynthesizer, location); 29 : super(resynthesizer, location);
30 30
31 @override 31 @override
32 List<PropertyAccessorElement> get accessors => actualElement.accessors; 32 List<PropertyAccessorElement> get accessors => actualElement.accessors;
33 33
34 @override 34 @override
35 ClassElement get actualElement => super.actualElement as ClassElement; 35 ClassElement get actualElement => super.actualElement as ClassElement;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 MethodElement lookUpMethod(String methodName, LibraryElement library) => 151 MethodElement lookUpMethod(String methodName, LibraryElement library) =>
152 actualElement.lookUpMethod(methodName, library); 152 actualElement.lookUpMethod(methodName, library);
153 153
154 @override 154 @override
155 PropertyAccessorElement lookUpSetter( 155 PropertyAccessorElement lookUpSetter(
156 String setterName, LibraryElement library) => 156 String setterName, LibraryElement library) =>
157 actualElement.lookUpSetter(setterName, library); 157 actualElement.lookUpSetter(setterName, library);
158 } 158 }
159 159
160 /** 160 /**
161 * Instances of the class `CompilationUnitElementHandle` implements a handle to a 161 * A handle to a [CompilationUnitElement].
162 * [CompilationUnitElement].
163 */ 162 */
164 class CompilationUnitElementHandle extends ElementHandle 163 class CompilationUnitElementHandle extends ElementHandle
165 implements CompilationUnitElement { 164 implements CompilationUnitElement {
166 /** 165 /**
167 * Initialize a newly created element handle to represent the given element. 166 * Initialize a newly created element handle to represent the element at the
168 * 167 * given [_location]. The [_resynthesizer] will be used to resynthesize the
169 * @param element the element being represented 168 * element when needed.
170 */ 169 */
171 CompilationUnitElementHandle( 170 CompilationUnitElementHandle(
172 ElementResynthesizer resynthesizer, ElementLocation location) 171 ElementResynthesizer resynthesizer, ElementLocation location)
173 : super(resynthesizer, location); 172 : super(resynthesizer, location);
174 173
175 @override 174 @override
176 List<PropertyAccessorElement> get accessors => actualElement.accessors; 175 List<PropertyAccessorElement> get accessors => actualElement.accessors;
177 176
178 @override 177 @override
179 CompilationUnitElement get actualElement => 178 CompilationUnitElement get actualElement =>
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 } 226 }
228 227
229 @override 228 @override
230 ClassElement getEnum(String enumName) => actualElement.getEnum(enumName); 229 ClassElement getEnum(String enumName) => actualElement.getEnum(enumName);
231 230
232 @override 231 @override
233 ClassElement getType(String className) => actualElement.getType(className); 232 ClassElement getType(String className) => actualElement.getType(className);
234 } 233 }
235 234
236 /** 235 /**
237 * Instances of the class `ConstructorElementHandle` implement a handle to a 236 * A handle to a [ConstructorElement].
238 * `ConstructorElement`.
239 */ 237 */
240 class ConstructorElementHandle extends ExecutableElementHandle 238 class ConstructorElementHandle extends ExecutableElementHandle
241 implements ConstructorElement { 239 implements ConstructorElement {
242 /** 240 /**
243 * Initialize a newly created element handle to represent the given element. 241 * Initialize a newly created element handle to represent the element at the
244 * 242 * given [_location]. The [_resynthesizer] will be used to resynthesize the
245 * @param element the element being represented 243 * element when needed.
246 */ 244 */
247 ConstructorElementHandle( 245 ConstructorElementHandle(
248 ElementResynthesizer resynthesizer, ElementLocation location) 246 ElementResynthesizer resynthesizer, ElementLocation location)
249 : super(resynthesizer, location); 247 : super(resynthesizer, location);
250 248
251 @override 249 @override
252 ConstructorElement get actualElement => 250 ConstructorElement get actualElement =>
253 super.actualElement as ConstructorElement; 251 super.actualElement as ConstructorElement;
254 252
255 @override 253 @override
(...skipping 19 matching lines...) Expand all
275 273
276 @override 274 @override
277 ConstructorElement get redirectedConstructor => 275 ConstructorElement get redirectedConstructor =>
278 actualElement.redirectedConstructor; 276 actualElement.redirectedConstructor;
279 277
280 @override 278 @override
281 ConstructorDeclaration computeNode() => actualElement.computeNode(); 279 ConstructorDeclaration computeNode() => actualElement.computeNode();
282 } 280 }
283 281
284 /** 282 /**
285 * The abstract class `ElementHandle` implements the behavior common to objects that implement 283 * A handle to an [Element].
286 * a handle to an [Element].
287 */ 284 */
288 abstract class ElementHandle implements Element { 285 abstract class ElementHandle implements Element {
289 /** 286 /**
290 * The unique integer identifier of this element. 287 * The unique integer identifier of this element.
291 */ 288 */
292 final int id = 0; 289 final int id = 0;
293 290
294 /** 291 /**
295 * The [ElementResynthesizer] which will be used to resynthesize elements on 292 * The [ElementResynthesizer] which will be used to resynthesize elements on
296 * demand. 293 * demand.
297 */ 294 */
298 final ElementResynthesizer _resynthesizer; 295 final ElementResynthesizer _resynthesizer;
299 296
300 /** 297 /**
301 * The location of this element, used to reconstitute the element if it has be en garbage 298 * The location of this element, used to reconstitute the element if it has
302 * collected. 299 * not yet been resynthesized.
303 */ 300 */
304 final ElementLocation _location; 301 final ElementLocation _location;
305 302
306 /** 303 /**
307 * A reference to the element being referenced by this handle, or `null` if th e element has 304 * A reference to the element being referenced by this handle, or `null` if
308 * been garbage collected. 305 * the element has not yet been resynthesized.
309 */ 306 */
310 Element _elementReference; 307 Element _elementReference;
311 308
312 /** 309 /**
313 * Initialize a newly created element handle to represent the element at the 310 * Initialize a newly created element handle to represent the element at the
314 * given [_location]. [_resynthesizer] will be used to resynthesize the 311 * given [_location]. The [_resynthesizer] will be used to resynthesize the
315 * element when needed. 312 * element when needed.
316 */ 313 */
317 ElementHandle(this._resynthesizer, this._location); 314 ElementHandle(this._resynthesizer, this._location);
318 315
319 /** 316 /**
320 * Return the element being represented by this handle, reconstituting the ele ment if the 317 * Return the element being represented by this handle, reconstituting the
321 * reference has been set to `null`. 318 * element if the reference has been set to `null`.
322 *
323 * @return the element being represented by this handle
324 */ 319 */
325 Element get actualElement { 320 Element get actualElement {
326 if (_elementReference == null) { 321 if (_elementReference == null) {
327 _elementReference = _resynthesizer.getElement(_location); 322 _elementReference = _resynthesizer.getElement(_location);
328 } 323 }
329 return _elementReference; 324 return _elementReference;
330 } 325 }
331 326
332 @override 327 @override
333 AnalysisContext get context => _resynthesizer.context; 328 AnalysisContext get context => _resynthesizer.context;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 actualElement.visitChildren(visitor); 416 actualElement.visitChildren(visitor);
422 } 417 }
423 } 418 }
424 419
425 /** 420 /**
426 * Interface which allows an [Element] handle to be resynthesized based on an 421 * Interface which allows an [Element] handle to be resynthesized based on an
427 * [ElementLocation]. The concrete classes implementing element handles use 422 * [ElementLocation]. The concrete classes implementing element handles use
428 * this interface to retrieve the underlying elements when queried. 423 * this interface to retrieve the underlying elements when queried.
429 */ 424 */
430 abstract class ElementResynthesizer { 425 abstract class ElementResynthesizer {
426 /**
427 * The context that owns the element to be resynthesized.
428 */
431 final AnalysisContext context; 429 final AnalysisContext context;
432 430
431 /**
432 * Initialize a newly created resynthesizer to resynthesize elements in the
433 * given [context].
434 */
433 ElementResynthesizer(this.context); 435 ElementResynthesizer(this.context);
434 436
437 /**
438 * Return the element referenced by the given [location].
439 */
435 Element getElement(ElementLocation location); 440 Element getElement(ElementLocation location);
436 } 441 }
437 442
438 /** 443 /**
439 * The abstract class `ExecutableElementHandle` implements the behavior common t o objects that 444 * A handle to an [ExecutableElement].
440 * implement a handle to an [ExecutableElement].
441 */ 445 */
442 abstract class ExecutableElementHandle extends ElementHandle 446 abstract class ExecutableElementHandle extends ElementHandle
443 implements ExecutableElement { 447 implements ExecutableElement {
444 /** 448 /**
445 * Initialize a newly created element handle to represent the given element. 449 * Initialize a newly created element handle to represent the element at the
446 * 450 * given [_location]. The [_resynthesizer] will be used to resynthesize the
447 * @param element the element being represented 451 * element when needed.
448 */ 452 */
449 ExecutableElementHandle( 453 ExecutableElementHandle(
450 ElementResynthesizer resynthesizer, ElementLocation location) 454 ElementResynthesizer resynthesizer, ElementLocation location)
451 : super(resynthesizer, location); 455 : super(resynthesizer, location);
452 456
453 @override 457 @override
454 ExecutableElement get actualElement => 458 ExecutableElement get actualElement =>
455 super.actualElement as ExecutableElement; 459 super.actualElement as ExecutableElement;
456 460
457 @override 461 @override
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 DartType get returnType => actualElement.returnType; 498 DartType get returnType => actualElement.returnType;
495 499
496 @override 500 @override
497 FunctionType get type => actualElement.type; 501 FunctionType get type => actualElement.type;
498 502
499 @override 503 @override
500 List<TypeParameterElement> get typeParameters => actualElement.typeParameters; 504 List<TypeParameterElement> get typeParameters => actualElement.typeParameters;
501 } 505 }
502 506
503 /** 507 /**
504 * Instances of the class `ExportElementHandle` implement a handle to an `Export Element` 508 * A handle to an [ExportElement].
505 * .
506 */ 509 */
507 class ExportElementHandle extends ElementHandle implements ExportElement { 510 class ExportElementHandle extends ElementHandle implements ExportElement {
508 /** 511 /**
509 * Initialize a newly created element handle to represent the given element. 512 * Initialize a newly created element handle to represent the element at the
510 * 513 * given [_location]. The [_resynthesizer] will be used to resynthesize the
511 * @param element the element being represented 514 * element when needed.
512 */ 515 */
513 ExportElementHandle( 516 ExportElementHandle(
514 ElementResynthesizer resynthesizer, ElementLocation location) 517 ElementResynthesizer resynthesizer, ElementLocation location)
515 : super(resynthesizer, location); 518 : super(resynthesizer, location);
516 519
517 @override 520 @override
518 ExportElement get actualElement => super.actualElement as ExportElement; 521 ExportElement get actualElement => super.actualElement as ExportElement;
519 522
520 @override 523 @override
521 List<NamespaceCombinator> get combinators => actualElement.combinators; 524 List<NamespaceCombinator> get combinators => actualElement.combinators;
522 525
523 @override 526 @override
524 LibraryElement get exportedLibrary => actualElement.exportedLibrary; 527 LibraryElement get exportedLibrary => actualElement.exportedLibrary;
525 528
526 @override 529 @override
527 ElementKind get kind => ElementKind.EXPORT; 530 ElementKind get kind => ElementKind.EXPORT;
528 531
529 @override 532 @override
530 String get uri => actualElement.uri; 533 String get uri => actualElement.uri;
531 534
532 @override 535 @override
533 int get uriEnd => actualElement.uriEnd; 536 int get uriEnd => actualElement.uriEnd;
534 537
535 @override 538 @override
536 int get uriOffset => actualElement.uriOffset; 539 int get uriOffset => actualElement.uriOffset;
537 } 540 }
538 541
539 /** 542 /**
540 * Instances of the class `FieldElementHandle` implement a handle to a `FieldEle ment`. 543 * A handle to a [FieldElement].
541 */ 544 */
542 class FieldElementHandle extends PropertyInducingElementHandle 545 class FieldElementHandle extends PropertyInducingElementHandle
543 implements FieldElement { 546 implements FieldElement {
544 /** 547 /**
545 * Initialize a newly created element handle to represent the given element. 548 * Initialize a newly created element handle to represent the element at the
546 * 549 * given [_location]. The [_resynthesizer] will be used to resynthesize the
547 * @param element the element being represented 550 * element when needed.
548 */ 551 */
549 FieldElementHandle( 552 FieldElementHandle(
550 ElementResynthesizer resynthesizer, ElementLocation location) 553 ElementResynthesizer resynthesizer, ElementLocation location)
551 : super(resynthesizer, location); 554 : super(resynthesizer, location);
552 555
553 @override 556 @override
554 FieldElement get actualElement => super.actualElement as FieldElement; 557 FieldElement get actualElement => super.actualElement as FieldElement;
555 558
556 @override 559 @override
557 ClassElement get enclosingElement => actualElement.enclosingElement; 560 ClassElement get enclosingElement => actualElement.enclosingElement;
558 561
559 @override 562 @override
560 bool get isEnumConstant => actualElement.isEnumConstant; 563 bool get isEnumConstant => actualElement.isEnumConstant;
561 564
562 @override 565 @override
563 ElementKind get kind => ElementKind.FIELD; 566 ElementKind get kind => ElementKind.FIELD;
564 567
565 @override 568 @override
566 VariableDeclaration computeNode() => actualElement.computeNode(); 569 VariableDeclaration computeNode() => actualElement.computeNode();
567 } 570 }
568 571
569 /** 572 /**
570 * Instances of the class `FunctionElementHandle` implement a handle to a 573 * A handle to a [FunctionElement].
571 * `FunctionElement`.
572 */ 574 */
573 class FunctionElementHandle extends ExecutableElementHandle 575 class FunctionElementHandle extends ExecutableElementHandle
574 implements FunctionElement { 576 implements FunctionElement {
575 /** 577 /**
576 * Initialize a newly created element handle to represent the given element. 578 * Initialize a newly created element handle to represent the element at the
577 * 579 * given [_location]. The [_resynthesizer] will be used to resynthesize the
578 * @param element the element being represented 580 * element when needed.
579 */ 581 */
580 FunctionElementHandle( 582 FunctionElementHandle(
581 ElementResynthesizer resynthesizer, ElementLocation location) 583 ElementResynthesizer resynthesizer, ElementLocation location)
582 : super(resynthesizer, location); 584 : super(resynthesizer, location);
583 585
584 @override 586 @override
585 FunctionElement get actualElement => super.actualElement as FunctionElement; 587 FunctionElement get actualElement => super.actualElement as FunctionElement;
586 588
587 @override 589 @override
588 bool get isEntryPoint => actualElement.isEntryPoint; 590 bool get isEntryPoint => actualElement.isEntryPoint;
589 591
590 @override 592 @override
591 ElementKind get kind => ElementKind.FUNCTION; 593 ElementKind get kind => ElementKind.FUNCTION;
592 594
593 @override 595 @override
594 SourceRange get visibleRange => actualElement.visibleRange; 596 SourceRange get visibleRange => actualElement.visibleRange;
595 597
596 @override 598 @override
597 FunctionDeclaration computeNode() => actualElement.computeNode(); 599 FunctionDeclaration computeNode() => actualElement.computeNode();
598 } 600 }
599 601
600 /** 602 /**
601 * Instances of the class `FunctionTypeAliasElementHandle` implement a handle to a 603 * A handle to a [FunctionTypeAliasElement].
602 * `FunctionTypeAliasElement`.
603 */ 604 */
604 class FunctionTypeAliasElementHandle extends ElementHandle 605 class FunctionTypeAliasElementHandle extends ElementHandle
605 implements FunctionTypeAliasElement { 606 implements FunctionTypeAliasElement {
606 /** 607 /**
607 * Initialize a newly created element handle to represent the given element. 608 * Initialize a newly created element handle to represent the element at the
608 * 609 * given [_location]. The [_resynthesizer] will be used to resynthesize the
609 * @param element the element being represented 610 * element when needed.
610 */ 611 */
611 FunctionTypeAliasElementHandle( 612 FunctionTypeAliasElementHandle(
612 ElementResynthesizer resynthesizer, ElementLocation location) 613 ElementResynthesizer resynthesizer, ElementLocation location)
613 : super(resynthesizer, location); 614 : super(resynthesizer, location);
614 615
615 @override 616 @override
616 FunctionTypeAliasElement get actualElement => 617 FunctionTypeAliasElement get actualElement =>
617 super.actualElement as FunctionTypeAliasElement; 618 super.actualElement as FunctionTypeAliasElement;
618 619
619 @override 620 @override
(...skipping 13 matching lines...) Expand all
633 FunctionType get type => actualElement.type; 634 FunctionType get type => actualElement.type;
634 635
635 @override 636 @override
636 List<TypeParameterElement> get typeParameters => actualElement.typeParameters; 637 List<TypeParameterElement> get typeParameters => actualElement.typeParameters;
637 638
638 @override 639 @override
639 FunctionTypeAlias computeNode() => actualElement.computeNode(); 640 FunctionTypeAlias computeNode() => actualElement.computeNode();
640 } 641 }
641 642
642 /** 643 /**
643 * Instances of the class `ImportElementHandle` implement a handle to an `Import Element` 644 * A handle to an [ImportElement].
644 * .
645 */ 645 */
646 class ImportElementHandle extends ElementHandle implements ImportElement { 646 class ImportElementHandle extends ElementHandle implements ImportElement {
647 /** 647 /**
648 * Initialize a newly created element handle to represent the given element. 648 * Initialize a newly created element handle to represent the element at the
649 * 649 * given [_location]. The [_resynthesizer] will be used to resynthesize the
650 * @param element the element being represented 650 * element when needed.
651 */ 651 */
652 ImportElementHandle( 652 ImportElementHandle(
653 ElementResynthesizer resynthesizer, ElementLocation location) 653 ElementResynthesizer resynthesizer, ElementLocation location)
654 : super(resynthesizer, location); 654 : super(resynthesizer, location);
655 655
656 @override 656 @override
657 ImportElement get actualElement => super.actualElement as ImportElement; 657 ImportElement get actualElement => super.actualElement as ImportElement;
658 658
659 @override 659 @override
660 List<NamespaceCombinator> get combinators => actualElement.combinators; 660 List<NamespaceCombinator> get combinators => actualElement.combinators;
(...skipping 17 matching lines...) Expand all
678 String get uri => actualElement.uri; 678 String get uri => actualElement.uri;
679 679
680 @override 680 @override
681 int get uriEnd => actualElement.uriEnd; 681 int get uriEnd => actualElement.uriEnd;
682 682
683 @override 683 @override
684 int get uriOffset => actualElement.uriOffset; 684 int get uriOffset => actualElement.uriOffset;
685 } 685 }
686 686
687 /** 687 /**
688 * Instances of the class `LabelElementHandle` implement a handle to a `LabelEle ment`. 688 * A handle to a [LabelElement].
689 */ 689 */
690 class LabelElementHandle extends ElementHandle implements LabelElement { 690 class LabelElementHandle extends ElementHandle implements LabelElement {
691 /** 691 /**
692 * Initialize a newly created element handle to represent the given element. 692 * Initialize a newly created element handle to represent the element at the
693 * 693 * given [_location]. The [_resynthesizer] will be used to resynthesize the
694 * @param element the element being represented 694 * element when needed.
695 */ 695 */
696 LabelElementHandle( 696 LabelElementHandle(
697 ElementResynthesizer resynthesizer, ElementLocation location) 697 ElementResynthesizer resynthesizer, ElementLocation location)
698 : super(resynthesizer, location); 698 : super(resynthesizer, location);
699 699
700 @override 700 @override
701 ExecutableElement get enclosingElement => 701 ExecutableElement get enclosingElement =>
702 super.enclosingElement as ExecutableElement; 702 super.enclosingElement as ExecutableElement;
703 703
704 @override 704 @override
705 ElementKind get kind => ElementKind.LABEL; 705 ElementKind get kind => ElementKind.LABEL;
706 } 706 }
707 707
708 /** 708 /**
709 * Instances of the class `LibraryElementHandle` implement a handle to a 709 * A handle to a [LibraryElement].
710 * `LibraryElement`.
711 */ 710 */
712 class LibraryElementHandle extends ElementHandle implements LibraryElement { 711 class LibraryElementHandle extends ElementHandle implements LibraryElement {
713 /** 712 /**
714 * Initialize a newly created element handle to represent the given element. 713 * Initialize a newly created element handle to represent the element at the
715 * 714 * given [_location]. The [_resynthesizer] will be used to resynthesize the
716 * @param element the element being represented 715 * element when needed.
717 */ 716 */
718 LibraryElementHandle( 717 LibraryElementHandle(
719 ElementResynthesizer resynthesizer, ElementLocation location) 718 ElementResynthesizer resynthesizer, ElementLocation location)
720 : super(resynthesizer, location); 719 : super(resynthesizer, location);
721 720
722 @override 721 @override
723 LibraryElement get actualElement => super.actualElement as LibraryElement; 722 LibraryElement get actualElement => super.actualElement as LibraryElement;
724 723
725 @override 724 @override
726 CompilationUnitElement get definingCompilationUnit => 725 CompilationUnitElement get definingCompilationUnit =>
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 actualElement.getImportsWithPrefix(prefixElement); 793 actualElement.getImportsWithPrefix(prefixElement);
795 794
796 @override 795 @override
797 ClassElement getType(String className) => actualElement.getType(className); 796 ClassElement getType(String className) => actualElement.getType(className);
798 797
799 @override 798 @override
800 bool isUpToDate(int timeStamp) => actualElement.isUpToDate(timeStamp); 799 bool isUpToDate(int timeStamp) => actualElement.isUpToDate(timeStamp);
801 } 800 }
802 801
803 /** 802 /**
804 * Instances of the class `LocalVariableElementHandle` implement a handle to a 803 * A handle to a [LocalVariableElement].
805 * `LocalVariableElement`.
806 */ 804 */
807 class LocalVariableElementHandle extends VariableElementHandle 805 class LocalVariableElementHandle extends VariableElementHandle
808 implements LocalVariableElement { 806 implements LocalVariableElement {
809 /** 807 /**
810 * Initialize a newly created element handle to represent the given element. 808 * Initialize a newly created element handle to represent the element at the
811 * 809 * given [_location]. The [_resynthesizer] will be used to resynthesize the
812 * @param element the element being represented 810 * element when needed.
813 */ 811 */
814 LocalVariableElementHandle( 812 LocalVariableElementHandle(
815 ElementResynthesizer resynthesizer, ElementLocation location) 813 ElementResynthesizer resynthesizer, ElementLocation location)
816 : super(resynthesizer, location); 814 : super(resynthesizer, location);
817 815
818 @override 816 @override
819 LocalVariableElement get actualElement => 817 LocalVariableElement get actualElement =>
820 super.actualElement as LocalVariableElement; 818 super.actualElement as LocalVariableElement;
821 819
822 @override 820 @override
823 ElementKind get kind => ElementKind.LOCAL_VARIABLE; 821 ElementKind get kind => ElementKind.LOCAL_VARIABLE;
824 822
825 @override 823 @override
826 SourceRange get visibleRange => actualElement.visibleRange; 824 SourceRange get visibleRange => actualElement.visibleRange;
827 825
828 @override 826 @override
829 VariableDeclaration computeNode() => actualElement.computeNode(); 827 VariableDeclaration computeNode() => actualElement.computeNode();
830 } 828 }
831 829
832 /** 830 /**
833 * Instances of the class `MethodElementHandle` implement a handle to a `MethodE lement`. 831 * A handle to a [MethodElement].
834 */ 832 */
835 class MethodElementHandle extends ExecutableElementHandle 833 class MethodElementHandle extends ExecutableElementHandle
836 implements MethodElement { 834 implements MethodElement {
837 /** 835 /**
838 * Initialize a newly created element handle to represent the given element. 836 * Initialize a newly created element handle to represent the element at the
839 * 837 * given [_location]. The [_resynthesizer] will be used to resynthesize the
840 * @param element the element being represented 838 * element when needed.
841 */ 839 */
842 MethodElementHandle( 840 MethodElementHandle(
843 ElementResynthesizer resynthesizer, ElementLocation location) 841 ElementResynthesizer resynthesizer, ElementLocation location)
844 : super(resynthesizer, location); 842 : super(resynthesizer, location);
845 843
846 @override 844 @override
847 MethodElement get actualElement => super.actualElement as MethodElement; 845 MethodElement get actualElement => super.actualElement as MethodElement;
848 846
849 @override 847 @override
850 ClassElement get enclosingElement => super.enclosingElement as ClassElement; 848 ClassElement get enclosingElement => super.enclosingElement as ClassElement;
851 849
852 @override 850 @override
853 bool get isStatic => actualElement.isStatic; 851 bool get isStatic => actualElement.isStatic;
854 852
855 @override 853 @override
856 ElementKind get kind => ElementKind.METHOD; 854 ElementKind get kind => ElementKind.METHOD;
857 855
858 @override 856 @override
859 MethodDeclaration computeNode() => actualElement.computeNode(); 857 MethodDeclaration computeNode() => actualElement.computeNode();
860 } 858 }
861 859
862 /** 860 /**
863 * Instances of the class `ParameterElementHandle` implement a handle to a 861 * A handle to a [ParameterElement].
864 * `ParameterElement`.
865 */ 862 */
866 class ParameterElementHandle extends VariableElementHandle 863 class ParameterElementHandle extends VariableElementHandle
867 with ParameterElementMixin 864 with ParameterElementMixin
868 implements ParameterElement { 865 implements ParameterElement {
869 /** 866 /**
870 * Initialize a newly created element handle to represent the given element. 867 * Initialize a newly created element handle to represent the element at the
871 * 868 * given [_location]. The [_resynthesizer] will be used to resynthesize the
872 * @param element the element being represented 869 * element when needed.
873 */ 870 */
874 ParameterElementHandle( 871 ParameterElementHandle(
875 ElementResynthesizer resynthesizer, ElementLocation location) 872 ElementResynthesizer resynthesizer, ElementLocation location)
876 : super(resynthesizer, location); 873 : super(resynthesizer, location);
877 874
878 @override 875 @override
879 ParameterElement get actualElement => super.actualElement as ParameterElement; 876 ParameterElement get actualElement => super.actualElement as ParameterElement;
880 877
881 @override 878 @override
882 String get defaultValueCode => actualElement.defaultValueCode; 879 String get defaultValueCode => actualElement.defaultValueCode;
(...skipping 11 matching lines...) Expand all
894 List<ParameterElement> get parameters => actualElement.parameters; 891 List<ParameterElement> get parameters => actualElement.parameters;
895 892
896 @override 893 @override
897 List<TypeParameterElement> get typeParameters => actualElement.typeParameters; 894 List<TypeParameterElement> get typeParameters => actualElement.typeParameters;
898 895
899 @override 896 @override
900 SourceRange get visibleRange => actualElement.visibleRange; 897 SourceRange get visibleRange => actualElement.visibleRange;
901 } 898 }
902 899
903 /** 900 /**
904 * Instances of the class `PrefixElementHandle` implement a handle to a `PrefixE lement`. 901 * A handle to a [PrefixElement].
905 */ 902 */
906 class PrefixElementHandle extends ElementHandle implements PrefixElement { 903 class PrefixElementHandle extends ElementHandle implements PrefixElement {
907 /** 904 /**
908 * Initialize a newly created element handle to represent the given element. 905 * Initialize a newly created element handle to represent the element at the
909 * 906 * given [_location]. The [_resynthesizer] will be used to resynthesize the
910 * @param element the element being represented 907 * element when needed.
911 */ 908 */
912 PrefixElementHandle( 909 PrefixElementHandle(
913 ElementResynthesizer resynthesizer, ElementLocation location) 910 ElementResynthesizer resynthesizer, ElementLocation location)
914 : super(resynthesizer, location); 911 : super(resynthesizer, location);
915 912
916 @override 913 @override
917 PrefixElement get actualElement => super.actualElement as PrefixElement; 914 PrefixElement get actualElement => super.actualElement as PrefixElement;
918 915
919 @override 916 @override
920 LibraryElement get enclosingElement => 917 LibraryElement get enclosingElement =>
921 super.enclosingElement as LibraryElement; 918 super.enclosingElement as LibraryElement;
922 919
923 @override 920 @override
924 List<LibraryElement> get importedLibraries => LibraryElement.EMPTY_LIST; 921 List<LibraryElement> get importedLibraries => LibraryElement.EMPTY_LIST;
925 922
926 @override 923 @override
927 ElementKind get kind => ElementKind.PREFIX; 924 ElementKind get kind => ElementKind.PREFIX;
928 } 925 }
929 926
930 /** 927 /**
931 * Instances of the class `PropertyAccessorElementHandle` implement a handle to a 928 * A handle to a [PropertyAccessorElement].
932 * `PropertyAccessorElement`.
933 */ 929 */
934 class PropertyAccessorElementHandle extends ExecutableElementHandle 930 class PropertyAccessorElementHandle extends ExecutableElementHandle
935 implements PropertyAccessorElement { 931 implements PropertyAccessorElement {
936 /** 932 /**
937 * Initialize a newly created element handle to represent the given element. 933 * Initialize a newly created element handle to represent the element at the
938 * 934 * given [_location]. The [_resynthesizer] will be used to resynthesize the
939 * @param element the element being represented 935 * element when needed.
940 */ 936 */
941 PropertyAccessorElementHandle( 937 PropertyAccessorElementHandle(
942 ElementResynthesizer resynthesizer, ElementLocation location) 938 ElementResynthesizer resynthesizer, ElementLocation location)
943 : super(resynthesizer, location); 939 : super(resynthesizer, location);
944 940
945 @override 941 @override
946 PropertyAccessorElement get actualElement => 942 PropertyAccessorElement get actualElement =>
947 super.actualElement as PropertyAccessorElement; 943 super.actualElement as PropertyAccessorElement;
948 944
949 @override 945 @override
(...skipping 17 matching lines...) Expand all
967 } else { 963 } else {
968 return ElementKind.SETTER; 964 return ElementKind.SETTER;
969 } 965 }
970 } 966 }
971 967
972 @override 968 @override
973 PropertyInducingElement get variable => actualElement.variable; 969 PropertyInducingElement get variable => actualElement.variable;
974 } 970 }
975 971
976 /** 972 /**
977 * The abstract class `PropertyInducingElementHandle` implements the behavior co mmon to 973 * A handle to an [PropertyInducingElement].
978 * objects that implement a handle to an `PropertyInducingElement`.
979 */ 974 */
980 abstract class PropertyInducingElementHandle extends VariableElementHandle 975 abstract class PropertyInducingElementHandle extends VariableElementHandle
981 implements PropertyInducingElement { 976 implements PropertyInducingElement {
982 /** 977 /**
983 * Initialize a newly created element handle to represent the given element. 978 * Initialize a newly created element handle to represent the element at the
984 * 979 * given [_location]. The [_resynthesizer] will be used to resynthesize the
985 * @param element the element being represented 980 * element when needed.
986 */ 981 */
987 PropertyInducingElementHandle( 982 PropertyInducingElementHandle(
988 ElementResynthesizer resynthesizer, ElementLocation location) 983 ElementResynthesizer resynthesizer, ElementLocation location)
989 : super(resynthesizer, location); 984 : super(resynthesizer, location);
990 985
991 @override 986 @override
992 PropertyInducingElement get actualElement => 987 PropertyInducingElement get actualElement =>
993 super.actualElement as PropertyInducingElement; 988 super.actualElement as PropertyInducingElement;
994 989
995 @override 990 @override
996 PropertyAccessorElement get getter => actualElement.getter; 991 PropertyAccessorElement get getter => actualElement.getter;
997 992
998 @override 993 @override
999 DartType get propagatedType => actualElement.propagatedType; 994 DartType get propagatedType => actualElement.propagatedType;
1000 995
1001 @override 996 @override
1002 PropertyAccessorElement get setter => actualElement.setter; 997 PropertyAccessorElement get setter => actualElement.setter;
1003 } 998 }
1004 999
1005 /** 1000 /**
1006 * Instances of the class `TopLevelVariableElementHandle` implement a handle to a 1001 * A handle to a [TopLevelVariableElement].
1007 * `TopLevelVariableElement`.
1008 */ 1002 */
1009 class TopLevelVariableElementHandle extends PropertyInducingElementHandle 1003 class TopLevelVariableElementHandle extends PropertyInducingElementHandle
1010 implements TopLevelVariableElement { 1004 implements TopLevelVariableElement {
1011 /** 1005 /**
1012 * Initialize a newly created element handle to represent the given element. 1006 * Initialize a newly created element handle to represent the element at the
1013 * 1007 * given [_location]. The [_resynthesizer] will be used to resynthesize the
1014 * @param element the element being represented 1008 * element when needed.
1015 */ 1009 */
1016 TopLevelVariableElementHandle( 1010 TopLevelVariableElementHandle(
1017 ElementResynthesizer resynthesizer, ElementLocation location) 1011 ElementResynthesizer resynthesizer, ElementLocation location)
1018 : super(resynthesizer, location); 1012 : super(resynthesizer, location);
1019 1013
1020 @override 1014 @override
1021 ElementKind get kind => ElementKind.TOP_LEVEL_VARIABLE; 1015 ElementKind get kind => ElementKind.TOP_LEVEL_VARIABLE;
1022 } 1016 }
1023 1017
1024 /** 1018 /**
1025 * Instances of the class `TypeParameterElementHandle` implement a handle to a 1019 * A handle to a [TypeParameterElement].
1026 * [TypeParameterElement].
1027 */ 1020 */
1028 class TypeParameterElementHandle extends ElementHandle 1021 class TypeParameterElementHandle extends ElementHandle
1029 implements TypeParameterElement { 1022 implements TypeParameterElement {
1030 /** 1023 /**
1031 * Initialize a newly created element handle to represent the given element. 1024 * Initialize a newly created element handle to represent the element at the
1032 * 1025 * given [_location]. The [_resynthesizer] will be used to resynthesize the
1033 * @param element the element being represented 1026 * element when needed.
1034 */ 1027 */
1035 TypeParameterElementHandle( 1028 TypeParameterElementHandle(
1036 ElementResynthesizer resynthesizer, ElementLocation location) 1029 ElementResynthesizer resynthesizer, ElementLocation location)
1037 : super(resynthesizer, location); 1030 : super(resynthesizer, location);
1038 1031
1039 @override 1032 @override
1040 TypeParameterElement get actualElement => 1033 TypeParameterElement get actualElement =>
1041 super.actualElement as TypeParameterElement; 1034 super.actualElement as TypeParameterElement;
1042 1035
1043 @override 1036 @override
1044 DartType get bound => actualElement.bound; 1037 DartType get bound => actualElement.bound;
1045 1038
1046 @override 1039 @override
1047 ElementKind get kind => ElementKind.TYPE_PARAMETER; 1040 ElementKind get kind => ElementKind.TYPE_PARAMETER;
1048 1041
1049 @override 1042 @override
1050 TypeParameterType get type => actualElement.type; 1043 TypeParameterType get type => actualElement.type;
1051 } 1044 }
1052 1045
1053 /** 1046 /**
1054 * The abstract class `VariableElementHandle` implements the behavior common to objects that 1047 * A handle to an [VariableElement].
1055 * implement a handle to an `VariableElement`.
1056 */ 1048 */
1057 abstract class VariableElementHandle extends ElementHandle 1049 abstract class VariableElementHandle extends ElementHandle
1058 implements VariableElement { 1050 implements VariableElement {
1059 /** 1051 /**
1060 * Initialize a newly created element handle to represent the given element. 1052 * Initialize a newly created element handle to represent the element at the
1061 * 1053 * given [_location]. The [_resynthesizer] will be used to resynthesize the
1062 * @param element the element being represented 1054 * element when needed.
1063 */ 1055 */
1064 VariableElementHandle( 1056 VariableElementHandle(
1065 ElementResynthesizer resynthesizer, ElementLocation location) 1057 ElementResynthesizer resynthesizer, ElementLocation location)
1066 : super(resynthesizer, location); 1058 : super(resynthesizer, location);
1067 1059
1068 @override 1060 @override
1069 VariableElement get actualElement => super.actualElement as VariableElement; 1061 VariableElement get actualElement => super.actualElement as VariableElement;
1070 1062
1071 @override 1063 @override
1072 DartObject get constantValue => actualElement.constantValue; 1064 DartObject get constantValue => actualElement.constantValue;
(...skipping 17 matching lines...) Expand all
1090 @override 1082 @override
1091 bool get isPotentiallyMutatedInScope => 1083 bool get isPotentiallyMutatedInScope =>
1092 actualElement.isPotentiallyMutatedInScope; 1084 actualElement.isPotentiallyMutatedInScope;
1093 1085
1094 @override 1086 @override
1095 bool get isStatic => actualElement.isStatic; 1087 bool get isStatic => actualElement.isStatic;
1096 1088
1097 @override 1089 @override
1098 DartType get type => actualElement.type; 1090 DartType get type => actualElement.type;
1099 } 1091 }
1100
1101 /**
1102 * TODO(scheglov) invalid implementation
1103 */
1104 class WeakReference<T> {
1105 final T value;
1106 WeakReference(this.value);
1107 T get() => value;
1108 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/dart/element/element.dart ('k') | pkg/analyzer/lib/src/generated/constant.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698