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

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

Issue 830893003: Remove the Polymer support from the analyzer and analysis_server packages. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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 | Annotate | Revision Log
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 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.element; 8 library engine.element;
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 * <b>Note:</b> Because the element model represents the state of the code, it is possible for it 261 * <b>Note:</b> Because the element model represents the state of the code, it is possible for it
262 * to be semantically invalid. In particular, it is not safe to assume that th e inheritance 262 * to be semantically invalid. In particular, it is not safe to assume that th e inheritance
263 * structure of a class does not contain a cycle. Clients that traverse the in heritance structure 263 * structure of a class does not contain a cycle. Clients that traverse the in heritance structure
264 * must explicitly guard against infinite loops. 264 * must explicitly guard against infinite loops.
265 * 265 *
266 * @return the superclass of this class 266 * @return the superclass of this class
267 */ 267 */
268 InterfaceType get supertype; 268 InterfaceType get supertype;
269 269
270 /** 270 /**
271 * Return an array containing all of the toolkit specific objects associated w ith this class. The
272 * array will be empty if the class does not have any toolkit specific objects or if the
273 * compilation unit containing the class has not yet had toolkit references re solved.
274 *
275 * @return the toolkit objects associated with this class
276 */
277 List<ToolkitObjectElement> get toolkitObjects;
278
279 /**
280 * Return the type defined by the class. 271 * Return the type defined by the class.
281 * 272 *
282 * @return the type defined by the class 273 * @return the type defined by the class
283 */ 274 */
284 InterfaceType get type; 275 InterfaceType get type;
285 276
286 /** 277 /**
287 * Return an array containing all of the type parameters declared for this cla ss. 278 * Return an array containing all of the type parameters declared for this cla ss.
288 * 279 *
289 * @return the type parameters declared for this class 280 * @return the type parameters declared for this class
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 * An array containing all of the methods contained in this class. 545 * An array containing all of the methods contained in this class.
555 */ 546 */
556 List<MethodElement> _methods = MethodElementImpl.EMPTY_ARRAY; 547 List<MethodElement> _methods = MethodElementImpl.EMPTY_ARRAY;
557 548
558 /** 549 /**
559 * The superclass of the class, or `null` if the class does not have an explic it superclass. 550 * The superclass of the class, or `null` if the class does not have an explic it superclass.
560 */ 551 */
561 InterfaceType supertype; 552 InterfaceType supertype;
562 553
563 /** 554 /**
564 * An array containing all of the toolkit objects attached to this class.
565 */
566 List<ToolkitObjectElement> _toolkitObjects = ToolkitObjectElement.EMPTY_ARRAY;
567
568 /**
569 * The type defined by the class. 555 * The type defined by the class.
570 */ 556 */
571 InterfaceType type; 557 InterfaceType type;
572 558
573 /** 559 /**
574 * An array containing all of the type parameters defined for this class. 560 * An array containing all of the type parameters defined for this class.
575 */ 561 */
576 List<TypeParameterElement> _typeParameters = 562 List<TypeParameterElement> _typeParameters =
577 TypeParameterElementImpl.EMPTY_ARRAY; 563 TypeParameterElementImpl.EMPTY_ARRAY;
578 564
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 * invalid mixin application. 762 * invalid mixin application.
777 */ 763 */
778 void set mixinErrorsReported(bool value) { 764 void set mixinErrorsReported(bool value) {
779 setModifier(Modifier.MIXIN_ERRORS_REPORTED, value); 765 setModifier(Modifier.MIXIN_ERRORS_REPORTED, value);
780 } 766 }
781 767
782 @override 768 @override
783 ClassDeclaration get node => 769 ClassDeclaration get node =>
784 getNodeMatching((node) => node is ClassDeclaration); 770 getNodeMatching((node) => node is ClassDeclaration);
785 771
786 @override
787 List<ToolkitObjectElement> get toolkitObjects => _toolkitObjects;
788
789 /** 772 /**
790 * Set whether this class is defined by a typedef construct to correspond to t he given value. 773 * Set whether this class is defined by a typedef construct to correspond to t he given value.
791 * 774 *
792 * @param isTypedef `true` if the class is defined by a typedef construct 775 * @param isTypedef `true` if the class is defined by a typedef construct
793 */ 776 */
794 void set typedef(bool isTypedef) { 777 void set typedef(bool isTypedef) {
795 setModifier(Modifier.TYPEDEF, isTypedef); 778 setModifier(Modifier.TYPEDEF, isTypedef);
796 } 779 }
797 780
798 @override 781 @override
(...skipping 27 matching lines...) Expand all
826 * 809 *
827 * @param isValidMixin `true` if this class can be used as a mixin 810 * @param isValidMixin `true` if this class can be used as a mixin
828 */ 811 */
829 void set validMixin(bool isValidMixin) { 812 void set validMixin(bool isValidMixin) {
830 setModifier(Modifier.MIXIN, isValidMixin); 813 setModifier(Modifier.MIXIN, isValidMixin);
831 } 814 }
832 815
833 @override 816 @override
834 accept(ElementVisitor visitor) => visitor.visitClassElement(this); 817 accept(ElementVisitor visitor) => visitor.visitClassElement(this);
835 818
836 /**
837 * Add the given [toolkitObject] to the list of toolkit specific information
838 * objects attached to this class.
839 */
840 void addToolkitObjects(ToolkitObjectElement toolkitObject) {
841 (toolkitObject as ToolkitObjectElementImpl).enclosingElement = this;
842 if (_toolkitObjects.isEmpty) {
843 // Convert from a non-growable list to a growable list.
844 _toolkitObjects = <ToolkitObjectElement>[];
845 }
846 _toolkitObjects.add(toolkitObject);
847 }
848
849 @override 819 @override
850 void appendTo(StringBuffer buffer) { 820 void appendTo(StringBuffer buffer) {
851 String name = displayName; 821 String name = displayName;
852 if (name == null) { 822 if (name == null) {
853 buffer.write("{unnamed class}"); 823 buffer.write("{unnamed class}");
854 } else { 824 } else {
855 buffer.write(name); 825 buffer.write(name);
856 } 826 }
857 int variableCount = _typeParameters.length; 827 int variableCount = _typeParameters.length;
858 if (variableCount > 0) { 828 if (variableCount > 0) {
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 LibraryElement library) => 986 LibraryElement library) =>
1017 _internalLookUpSetter(setterName, library, true); 987 _internalLookUpSetter(setterName, library, true);
1018 988
1019 @override 989 @override
1020 void visitChildren(ElementVisitor visitor) { 990 void visitChildren(ElementVisitor visitor) {
1021 super.visitChildren(visitor); 991 super.visitChildren(visitor);
1022 safelyVisitChildren(_accessors, visitor); 992 safelyVisitChildren(_accessors, visitor);
1023 safelyVisitChildren(_constructors, visitor); 993 safelyVisitChildren(_constructors, visitor);
1024 safelyVisitChildren(_fields, visitor); 994 safelyVisitChildren(_fields, visitor);
1025 safelyVisitChildren(_methods, visitor); 995 safelyVisitChildren(_methods, visitor);
1026 safelyVisitChildren(_toolkitObjects, visitor);
1027 safelyVisitChildren(_typeParameters, visitor); 996 safelyVisitChildren(_typeParameters, visitor);
1028 } 997 }
1029 998
1030 void _collectAllSupertypes(List<InterfaceType> supertypes) { 999 void _collectAllSupertypes(List<InterfaceType> supertypes) {
1031 List<InterfaceType> typesToVisit = new List<InterfaceType>(); 1000 List<InterfaceType> typesToVisit = new List<InterfaceType>();
1032 List<ClassElement> visitedClasses = new List<ClassElement>(); 1001 List<ClassElement> visitedClasses = new List<ClassElement>();
1033 typesToVisit.add(this.type); 1002 typesToVisit.add(this.type);
1034 while (!typesToVisit.isEmpty) { 1003 while (!typesToVisit.isEmpty) {
1035 InterfaceType currentType = typesToVisit.removeAt(0); 1004 InterfaceType currentType = typesToVisit.removeAt(0);
1036 ClassElement currentElement = currentType.element; 1005 ClassElement currentElement = currentType.element;
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
1377 * An array containing all of the enums contained in this compilation unit. 1346 * An array containing all of the enums contained in this compilation unit.
1378 */ 1347 */
1379 List<ClassElement> _enums = ClassElementImpl.EMPTY_ARRAY; 1348 List<ClassElement> _enums = ClassElementImpl.EMPTY_ARRAY;
1380 1349
1381 /** 1350 /**
1382 * An array containing all of the top-level functions contained in this compil ation unit. 1351 * An array containing all of the top-level functions contained in this compil ation unit.
1383 */ 1352 */
1384 List<FunctionElement> _functions = FunctionElementImpl.EMPTY_ARRAY; 1353 List<FunctionElement> _functions = FunctionElementImpl.EMPTY_ARRAY;
1385 1354
1386 /** 1355 /**
1387 * A table mapping elements to associated toolkit objects.
1388 */
1389 Map<Element, List<ToolkitObjectElement>> _toolkitObjects = {};
1390
1391 /**
1392 * An array containing all of the function type aliases contained in this comp ilation unit. 1356 * An array containing all of the function type aliases contained in this comp ilation unit.
1393 */ 1357 */
1394 List<FunctionTypeAliasElement> _typeAliases = 1358 List<FunctionTypeAliasElement> _typeAliases =
1395 FunctionTypeAliasElementImpl.EMPTY_ARRAY; 1359 FunctionTypeAliasElementImpl.EMPTY_ARRAY;
1396 1360
1397 /** 1361 /**
1398 * An array containing all of the types contained in this compilation unit. 1362 * An array containing all of the types contained in this compilation unit.
1399 */ 1363 */
1400 List<ClassElement> _types = ClassElementImpl.EMPTY_ARRAY; 1364 List<ClassElement> _types = ClassElementImpl.EMPTY_ARRAY;
1401 1365
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
1611 @override 1575 @override
1612 void visitChildren(ElementVisitor visitor) { 1576 void visitChildren(ElementVisitor visitor) {
1613 super.visitChildren(visitor); 1577 super.visitChildren(visitor);
1614 safelyVisitChildren(_accessors, visitor); 1578 safelyVisitChildren(_accessors, visitor);
1615 safelyVisitChildren(_enums, visitor); 1579 safelyVisitChildren(_enums, visitor);
1616 safelyVisitChildren(_functions, visitor); 1580 safelyVisitChildren(_functions, visitor);
1617 safelyVisitChildren(_typeAliases, visitor); 1581 safelyVisitChildren(_typeAliases, visitor);
1618 safelyVisitChildren(_types, visitor); 1582 safelyVisitChildren(_types, visitor);
1619 safelyVisitChildren(_variables, visitor); 1583 safelyVisitChildren(_variables, visitor);
1620 } 1584 }
1621
1622 /**
1623 * Returns the associated toolkit objects.
1624 *
1625 * @param element the [Element] to get toolkit objects for
1626 * @return the associated toolkit objects, may be empty, but not `null`
1627 */
1628 List<ToolkitObjectElement> _getToolkitObjects(Element element) {
1629 List<ToolkitObjectElement> objects = _toolkitObjects[element];
1630 if (objects != null) {
1631 return objects;
1632 }
1633 return ToolkitObjectElement.EMPTY_ARRAY;
1634 }
1635
1636 /**
1637 * Sets the toolkit objects that are associated with the given [Element].
1638 *
1639 * @param element the [Element] to associate toolkit objects with
1640 * @param objects the toolkit objects to associate
1641 */
1642 void _setToolkitObjects(Element element, List<ToolkitObjectElement> objects) {
1643 _toolkitObjects[element] = objects;
1644 }
1645 } 1585 }
1646 1586
1647 /** 1587 /**
1648 * Instances of the class `ConstFieldElementImpl` implement a `FieldElement` for a 1588 * Instances of the class `ConstFieldElementImpl` implement a `FieldElement` for a
1649 * 'const' field that has an initializer. 1589 * 'const' field that has an initializer.
1650 */ 1590 */
1651 class ConstFieldElementImpl extends FieldElementImpl { 1591 class ConstFieldElementImpl extends FieldElementImpl {
1652 /** 1592 /**
1653 * The result of evaluating this variable's initializer. 1593 * The result of evaluating this variable's initializer.
1654 */ 1594 */
(...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after
3075 static const ElementKind LOCAL_VARIABLE = 3015 static const ElementKind LOCAL_VARIABLE =
3076 const ElementKind('LOCAL_VARIABLE', 15, "local variable"); 3016 const ElementKind('LOCAL_VARIABLE', 15, "local variable");
3077 3017
3078 static const ElementKind METHOD = const ElementKind('METHOD', 16, "method"); 3018 static const ElementKind METHOD = const ElementKind('METHOD', 16, "method");
3079 3019
3080 static const ElementKind NAME = const ElementKind('NAME', 17, "<name>"); 3020 static const ElementKind NAME = const ElementKind('NAME', 17, "<name>");
3081 3021
3082 static const ElementKind PARAMETER = 3022 static const ElementKind PARAMETER =
3083 const ElementKind('PARAMETER', 18, "parameter"); 3023 const ElementKind('PARAMETER', 18, "parameter");
3084 3024
3085 static const ElementKind POLYMER_ATTRIBUTE = 3025 static const ElementKind PREFIX =
3086 const ElementKind('POLYMER_ATTRIBUTE', 19, "Polymer attribute"); 3026 const ElementKind('PREFIX', 19, "import prefix");
3087 3027
3088 static const ElementKind POLYMER_TAG_DART = 3028 static const ElementKind SETTER = const ElementKind('SETTER', 20, "setter");
3089 const ElementKind('POLYMER_TAG_DART', 20, "Polymer Dart tag");
3090
3091 static const ElementKind POLYMER_TAG_HTML =
3092 const ElementKind('POLYMER_TAG_HTML', 21, "Polymer HTML tag");
3093
3094 static const ElementKind PREFIX =
3095 const ElementKind('PREFIX', 22, "import prefix");
3096
3097 static const ElementKind SETTER = const ElementKind('SETTER', 23, "setter");
3098 3029
3099 static const ElementKind TOP_LEVEL_VARIABLE = 3030 static const ElementKind TOP_LEVEL_VARIABLE =
3100 const ElementKind('TOP_LEVEL_VARIABLE', 24, "top level variable"); 3031 const ElementKind('TOP_LEVEL_VARIABLE', 21, "top level variable");
3101 3032
3102 static const ElementKind FUNCTION_TYPE_ALIAS = 3033 static const ElementKind FUNCTION_TYPE_ALIAS =
3103 const ElementKind('FUNCTION_TYPE_ALIAS', 25, "function type alias"); 3034 const ElementKind('FUNCTION_TYPE_ALIAS', 22, "function type alias");
3104 3035
3105 static const ElementKind TYPE_PARAMETER = 3036 static const ElementKind TYPE_PARAMETER =
3106 const ElementKind('TYPE_PARAMETER', 26, "type parameter"); 3037 const ElementKind('TYPE_PARAMETER', 23, "type parameter");
3107 3038
3108 static const ElementKind UNIVERSE = 3039 static const ElementKind UNIVERSE =
3109 const ElementKind('UNIVERSE', 27, "<universe>"); 3040 const ElementKind('UNIVERSE', 24, "<universe>");
3110 3041
3111 static const List<ElementKind> values = const [ 3042 static const List<ElementKind> values = const [
3112 CLASS, 3043 CLASS,
3113 COMPILATION_UNIT, 3044 COMPILATION_UNIT,
3114 CONSTRUCTOR, 3045 CONSTRUCTOR,
3115 DYNAMIC, 3046 DYNAMIC,
3116 EMBEDDED_HTML_SCRIPT, 3047 EMBEDDED_HTML_SCRIPT,
3117 ERROR, 3048 ERROR,
3118 EXPORT, 3049 EXPORT,
3119 EXTERNAL_HTML_SCRIPT, 3050 EXTERNAL_HTML_SCRIPT,
3120 FIELD, 3051 FIELD,
3121 FUNCTION, 3052 FUNCTION,
3122 GETTER, 3053 GETTER,
3123 HTML, 3054 HTML,
3124 IMPORT, 3055 IMPORT,
3125 LABEL, 3056 LABEL,
3126 LIBRARY, 3057 LIBRARY,
3127 LOCAL_VARIABLE, 3058 LOCAL_VARIABLE,
3128 METHOD, 3059 METHOD,
3129 NAME, 3060 NAME,
3130 PARAMETER, 3061 PARAMETER,
3131 POLYMER_ATTRIBUTE,
3132 POLYMER_TAG_DART,
3133 POLYMER_TAG_HTML,
3134 PREFIX, 3062 PREFIX,
3135 SETTER, 3063 SETTER,
3136 TOP_LEVEL_VARIABLE, 3064 TOP_LEVEL_VARIABLE,
3137 FUNCTION_TYPE_ALIAS, 3065 FUNCTION_TYPE_ALIAS,
3138 TYPE_PARAMETER, 3066 TYPE_PARAMETER,
3139 UNIVERSE]; 3067 UNIVERSE];
3140 3068
3141 /** 3069 /**
3142 * The name displayed in the UI for this kind of element. 3070 * The name displayed in the UI for this kind of element.
3143 */ 3071 */
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
3439 R visitLibraryElement(LibraryElement element); 3367 R visitLibraryElement(LibraryElement element);
3440 3368
3441 R visitLocalVariableElement(LocalVariableElement element); 3369 R visitLocalVariableElement(LocalVariableElement element);
3442 3370
3443 R visitMethodElement(MethodElement element); 3371 R visitMethodElement(MethodElement element);
3444 3372
3445 R visitMultiplyDefinedElement(MultiplyDefinedElement element); 3373 R visitMultiplyDefinedElement(MultiplyDefinedElement element);
3446 3374
3447 R visitParameterElement(ParameterElement element); 3375 R visitParameterElement(ParameterElement element);
3448 3376
3449 R visitPolymerAttributeElement(PolymerAttributeElement element);
3450
3451 R visitPolymerTagDartElement(PolymerTagDartElement element);
3452
3453 R visitPolymerTagHtmlElement(PolymerTagHtmlElement element);
3454
3455 R visitPrefixElement(PrefixElement element); 3377 R visitPrefixElement(PrefixElement element);
3456 3378
3457 R visitPropertyAccessorElement(PropertyAccessorElement element); 3379 R visitPropertyAccessorElement(PropertyAccessorElement element);
3458 3380
3459 R visitTopLevelVariableElement(TopLevelVariableElement element); 3381 R visitTopLevelVariableElement(TopLevelVariableElement element);
3460 3382
3461 R visitTypeParameterElement(TypeParameterElement element); 3383 R visitTypeParameterElement(TypeParameterElement element);
3462 } 3384 }
3463 3385
3464 /** 3386 /**
(...skipping 2115 matching lines...) Expand 10 before | Expand all | Expand 10 after
5580 5502
5581 @override 5503 @override
5582 R visitMultiplyDefinedElement(MultiplyDefinedElement element) => 5504 R visitMultiplyDefinedElement(MultiplyDefinedElement element) =>
5583 visitElement(element); 5505 visitElement(element);
5584 5506
5585 @override 5507 @override
5586 R visitParameterElement(ParameterElement element) => 5508 R visitParameterElement(ParameterElement element) =>
5587 visitLocalElement(element); 5509 visitLocalElement(element);
5588 5510
5589 @override 5511 @override
5590 R visitPolymerAttributeElement(PolymerAttributeElement element) =>
5591 visitPolymerElement(element);
5592
5593 R visitPolymerElement(PolymerElement element) =>
5594 visitToolkitObjectElement(element);
5595
5596 @override
5597 R visitPolymerTagDartElement(PolymerTagDartElement element) =>
5598 visitPolymerElement(element);
5599
5600 @override
5601 R visitPolymerTagHtmlElement(PolymerTagHtmlElement element) =>
5602 visitPolymerElement(element);
5603
5604 @override
5605 R visitPrefixElement(PrefixElement element) => visitElement(element); 5512 R visitPrefixElement(PrefixElement element) => visitElement(element);
5606 5513
5607 @override 5514 @override
5608 R visitPropertyAccessorElement(PropertyAccessorElement element) => 5515 R visitPropertyAccessorElement(PropertyAccessorElement element) =>
5609 visitExecutableElement(element); 5516 visitExecutableElement(element);
5610 5517
5611 R visitPropertyInducingElement(PropertyInducingElement element) => 5518 R visitPropertyInducingElement(PropertyInducingElement element) =>
5612 visitVariableElement(element); 5519 visitVariableElement(element);
5613 5520
5614 R visitToolkitObjectElement(ToolkitObjectElement element) =>
5615 visitElement(element);
5616
5617 @override 5521 @override
5618 R visitTopLevelVariableElement(TopLevelVariableElement element) => 5522 R visitTopLevelVariableElement(TopLevelVariableElement element) =>
5619 visitPropertyInducingElement(element); 5523 visitPropertyInducingElement(element);
5620 5524
5621 @override 5525 @override
5622 R visitTypeParameterElement(TypeParameterElement element) => 5526 R visitTypeParameterElement(TypeParameterElement element) =>
5623 visitElement(element); 5527 visitElement(element);
5624 5528
5625 R visitVariableElement(VariableElement element) => visitElement(element); 5529 R visitVariableElement(VariableElement element) => visitElement(element);
5626 } 5530 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
5663 } 5567 }
5664 return buffer.toString(); 5568 return buffer.toString();
5665 } 5569 }
5666 } 5570 }
5667 5571
5668 /** 5572 /**
5669 * The interface `HtmlElement` defines the behavior of elements representing an HTML file. 5573 * The interface `HtmlElement` defines the behavior of elements representing an HTML file.
5670 */ 5574 */
5671 abstract class HtmlElement implements Element { 5575 abstract class HtmlElement implements Element {
5672 /** 5576 /**
5673 * Return an array containing all of the [PolymerTagHtmlElement]s defined in t he HTML file.
5674 *
5675 * @return the [PolymerTagHtmlElement]s elements in the HTML file (not `null`,
5676 * contains no `null`s)
5677 */
5678 List<PolymerTagHtmlElement> get polymerTags;
5679
5680 /**
5681 * Return an array containing all of the script elements contained in the HTML file. This includes 5577 * Return an array containing all of the script elements contained in the HTML file. This includes
5682 * scripts with libraries that are defined by the content of a script tag as w ell as libraries 5578 * scripts with libraries that are defined by the content of a script tag as w ell as libraries
5683 * that are referenced in the {@core source} attribute of a script tag. 5579 * that are referenced in the {@core source} attribute of a script tag.
5684 * 5580 *
5685 * @return the script elements in the HTML file (not `null`, contains no `null `s) 5581 * @return the script elements in the HTML file (not `null`, contains no `null `s)
5686 */ 5582 */
5687 List<HtmlScriptElement> get scripts; 5583 List<HtmlScriptElement> get scripts;
5688 } 5584 }
5689 5585
5690 /** 5586 /**
5691 * Instances of the class `HtmlElementImpl` implement an [HtmlElement]. 5587 * Instances of the class `HtmlElementImpl` implement an [HtmlElement].
5692 */ 5588 */
5693 class HtmlElementImpl extends ElementImpl implements HtmlElement { 5589 class HtmlElementImpl extends ElementImpl implements HtmlElement {
5694 /** 5590 /**
5695 * An empty list of HTML file elements. 5591 * An empty list of HTML file elements.
5696 */ 5592 */
5697 static const List<HtmlElement> EMPTY_ARRAY = const <HtmlElement>[]; 5593 static const List<HtmlElement> EMPTY_ARRAY = const <HtmlElement>[];
5698 5594
5699 /** 5595 /**
5700 * The analysis context in which this library is defined. 5596 * The analysis context in which this library is defined.
5701 */ 5597 */
5702 final AnalysisContext context; 5598 final AnalysisContext context;
5703 5599
5704 /** 5600 /**
5705 * The scripts contained in or referenced from script tags in the HTML file. 5601 * The scripts contained in or referenced from script tags in the HTML file.
5706 */ 5602 */
5707 List<HtmlScriptElement> _scripts = HtmlScriptElementImpl.EMPTY_ARRAY; 5603 List<HtmlScriptElement> _scripts = HtmlScriptElementImpl.EMPTY_ARRAY;
5708 5604
5709 /** 5605 /**
5710 * The [PolymerTagHtmlElement]s defined in the HTML file.
5711 */
5712 List<PolymerTagHtmlElement> _polymerTags = PolymerTagHtmlElement.EMPTY_ARRAY;
5713
5714 /**
5715 * The source that corresponds to this HTML file. 5606 * The source that corresponds to this HTML file.
5716 */ 5607 */
5717 Source source; 5608 Source source;
5718 5609
5719 /** 5610 /**
5720 * Initialize a newly created HTML element to have the given name. 5611 * Initialize a newly created HTML element to have the given name.
5721 * 5612 *
5722 * @param context the analysis context in which the HTML file is defined 5613 * @param context the analysis context in which the HTML file is defined
5723 * @param name the name of this element 5614 * @param name the name of this element
5724 */ 5615 */
5725 HtmlElementImpl(this.context, String name) : super(name, -1); 5616 HtmlElementImpl(this.context, String name) : super(name, -1);
5726 5617
5727 @override 5618 @override
5728 int get hashCode => source.hashCode; 5619 int get hashCode => source.hashCode;
5729 5620
5730 @override 5621 @override
5731 String get identifier => source.encoding; 5622 String get identifier => source.encoding;
5732 5623
5733 @override 5624 @override
5734 ElementKind get kind => ElementKind.HTML; 5625 ElementKind get kind => ElementKind.HTML;
5735 5626
5736 @override 5627 @override
5737 List<PolymerTagHtmlElement> get polymerTags => _polymerTags;
5738
5739 /**
5740 * Set the [PolymerTagHtmlElement]s defined in the HTML file.
5741 */
5742 void set polymerTags(List<PolymerTagHtmlElement> polymerTags) {
5743 if (polymerTags.length == 0) {
5744 this._polymerTags = PolymerTagHtmlElement.EMPTY_ARRAY;
5745 return;
5746 }
5747 for (PolymerTagHtmlElement tag in polymerTags) {
5748 (tag as PolymerTagHtmlElementImpl).enclosingElement = this;
5749 }
5750 this._polymerTags = polymerTags;
5751 }
5752
5753 @override
5754 List<HtmlScriptElement> get scripts => _scripts; 5628 List<HtmlScriptElement> get scripts => _scripts;
5755 5629
5756 /** 5630 /**
5757 * Set the scripts contained in the HTML file to the given scripts. 5631 * Set the scripts contained in the HTML file to the given scripts.
5758 * 5632 *
5759 * @param scripts the scripts 5633 * @param scripts the scripts
5760 */ 5634 */
5761 void set scripts(List<HtmlScriptElement> scripts) { 5635 void set scripts(List<HtmlScriptElement> scripts) {
5762 if (scripts.length == 0) { 5636 if (scripts.length == 0) {
5763 this._scripts = HtmlScriptElementImpl.EMPTY_ARRAY; 5637 this._scripts = HtmlScriptElementImpl.EMPTY_ARRAY;
(...skipping 26 matching lines...) Expand all
5790 buffer.write("{HTML file}"); 5664 buffer.write("{HTML file}");
5791 } else { 5665 } else {
5792 buffer.write(source.fullName); 5666 buffer.write(source.fullName);
5793 } 5667 }
5794 } 5668 }
5795 5669
5796 @override 5670 @override
5797 void visitChildren(ElementVisitor visitor) { 5671 void visitChildren(ElementVisitor visitor) {
5798 super.visitChildren(visitor); 5672 super.visitChildren(visitor);
5799 safelyVisitChildren(_scripts, visitor); 5673 safelyVisitChildren(_scripts, visitor);
5800 safelyVisitChildren(_polymerTags, visitor);
5801 } 5674 }
5802 } 5675 }
5803 5676
5804 /** 5677 /**
5805 * The interface `HtmlScriptElement` defines the behavior of elements representi ng a script 5678 * The interface `HtmlScriptElement` defines the behavior of elements representi ng a script
5806 * tag in an HTML file. 5679 * tag in an HTML file.
5807 * 5680 *
5808 * See [EmbeddedHtmlScriptElement], and [ExternalHtmlScriptElement], 5681 * See [EmbeddedHtmlScriptElement], and [ExternalHtmlScriptElement],
5809 */ 5682 */
5810 abstract class HtmlScriptElement implements Element { 5683 abstract class HtmlScriptElement implements Element {
(...skipping 2063 matching lines...) Expand 10 before | Expand all | Expand 10 after
7874 * @return the range of characters in which the name of this element is visibl e 7747 * @return the range of characters in which the name of this element is visibl e
7875 */ 7748 */
7876 SourceRange get visibleRange; 7749 SourceRange get visibleRange;
7877 } 7750 }
7878 7751
7879 /** 7752 /**
7880 * The interface `LocalVariableElement` defines the behavior common to elements that represent 7753 * The interface `LocalVariableElement` defines the behavior common to elements that represent
7881 * a local variable. 7754 * a local variable.
7882 */ 7755 */
7883 abstract class LocalVariableElement implements LocalElement, VariableElement { 7756 abstract class LocalVariableElement implements LocalElement, VariableElement {
7884 /**
7885 * Return an array containing all of the toolkit specific objects attached to this variable.
7886 *
7887 * @return the toolkit objects attached to this variable
7888 */
7889 List<ToolkitObjectElement> get toolkitObjects;
7890 } 7757 }
7891 7758
7892 /** 7759 /**
7893 * Instances of the class `LocalVariableElementImpl` implement a `LocalVariableE lement`. 7760 * Instances of the class `LocalVariableElementImpl` implement a `LocalVariableE lement`.
7894 */ 7761 */
7895 class LocalVariableElementImpl extends VariableElementImpl implements 7762 class LocalVariableElementImpl extends VariableElementImpl implements
7896 LocalVariableElement { 7763 LocalVariableElement {
7897 /** 7764 /**
7898 * An empty list of field elements. 7765 * An empty list of field elements.
7899 */ 7766 */
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
7942 hasModifier(Modifier.POTENTIALLY_MUTATED_IN_CONTEXT); 7809 hasModifier(Modifier.POTENTIALLY_MUTATED_IN_CONTEXT);
7943 7810
7944 @override 7811 @override
7945 bool get isPotentiallyMutatedInScope => 7812 bool get isPotentiallyMutatedInScope =>
7946 hasModifier(Modifier.POTENTIALLY_MUTATED_IN_SCOPE); 7813 hasModifier(Modifier.POTENTIALLY_MUTATED_IN_SCOPE);
7947 7814
7948 @override 7815 @override
7949 ElementKind get kind => ElementKind.LOCAL_VARIABLE; 7816 ElementKind get kind => ElementKind.LOCAL_VARIABLE;
7950 7817
7951 @override 7818 @override
7952 List<ToolkitObjectElement> get toolkitObjects {
7953 CompilationUnitElementImpl unit =
7954 getAncestor((element) => element is CompilationUnitElementImpl);
7955 if (unit == null) {
7956 return ToolkitObjectElement.EMPTY_ARRAY;
7957 }
7958 return unit._getToolkitObjects(this);
7959 }
7960
7961 /**
7962 * Set the toolkit specific information objects attached to this variable.
7963 *
7964 * @param toolkitObjects the toolkit objects attached to this variable
7965 */
7966 void set toolkitObjects(List<ToolkitObjectElement> toolkitObjects) {
7967 CompilationUnitElementImpl unit =
7968 getAncestor((element) => element is CompilationUnitElementImpl);
7969 if (unit == null) {
7970 return;
7971 }
7972 unit._setToolkitObjects(this, toolkitObjects);
7973 }
7974
7975 @override
7976 SourceRange get visibleRange { 7819 SourceRange get visibleRange {
7977 if (_visibleRangeLength < 0) { 7820 if (_visibleRangeLength < 0) {
7978 return null; 7821 return null;
7979 } 7822 }
7980 return new SourceRange(_visibleRangeOffset, _visibleRangeLength); 7823 return new SourceRange(_visibleRangeOffset, _visibleRangeLength);
7981 } 7824 }
7982 7825
7983 @override 7826 @override
7984 accept(ElementVisitor visitor) => visitor.visitLocalVariableElement(this); 7827 accept(ElementVisitor visitor) => visitor.visitLocalVariableElement(this);
7985 7828
(...skipping 1244 matching lines...) Expand 10 before | Expand all | Expand 10 after
9230 if (isFieldFormal) { 9073 if (isFieldFormal) {
9231 return new FieldFormalParameterMember( 9074 return new FieldFormalParameterMember(
9232 baseParameter as FieldFormalParameterElement, 9075 baseParameter as FieldFormalParameterElement,
9233 definingType); 9076 definingType);
9234 } 9077 }
9235 return new ParameterMember(baseParameter, definingType); 9078 return new ParameterMember(baseParameter, definingType);
9236 } 9079 }
9237 } 9080 }
9238 9081
9239 /** 9082 /**
9240 * The interface `PolymerAttributeElement` defines an attribute in
9241 * [PolymerTagHtmlElement].
9242 *
9243 * <pre>
9244 * <polymer-element name="my-example" attributes='attrA attrB'>
9245 * </polymer-element>
9246 * </pre>
9247 */
9248 abstract class PolymerAttributeElement implements PolymerElement {
9249 /**
9250 * An empty list of Polymer custom tag attributes.
9251 */
9252 static const List<PolymerAttributeElement> EMPTY_ARRAY = const
9253 <PolymerAttributeElement>[
9254 ];
9255
9256 /**
9257 * Return the [FieldElement] associated with this attribute. Maybe `null` if
9258 * [PolymerTagDartElement] does not have a field associated with it.
9259 */
9260 FieldElement get field;
9261 }
9262
9263 /**
9264 * Implementation of `PolymerAttributeElement`.
9265 */
9266 class PolymerAttributeElementImpl extends PolymerElementImpl implements
9267 PolymerAttributeElement {
9268 /**
9269 * The [FieldElement] associated with this attribute.
9270 */
9271 FieldElement field;
9272
9273 /**
9274 * Initialize a newly created Polymer attribute to have the given name.
9275 *
9276 * @param name the name of this element
9277 * @param nameOffset the offset of the name of this element in the file that c ontains the
9278 * declaration of this element
9279 */
9280 PolymerAttributeElementImpl(String name, int nameOffset)
9281 : super(name, nameOffset);
9282
9283 @override
9284 ElementKind get kind => ElementKind.POLYMER_ATTRIBUTE;
9285
9286 @override
9287 accept(ElementVisitor visitor) => visitor.visitPolymerAttributeElement(this);
9288 }
9289
9290 /**
9291 * The interface `PolymerElement` defines the behavior of objects representing i nformation
9292 * about a Polymer specific element.
9293 */
9294 abstract class PolymerElement implements ToolkitObjectElement {
9295 /**
9296 * An empty list of Polymer elements.
9297 */
9298 static const List<PolymerElement> EMPTY_ARRAY = const <PolymerElement>[];
9299 }
9300
9301 /**
9302 * Implementation of `PolymerElement`.
9303 */
9304 abstract class PolymerElementImpl extends ToolkitObjectElementImpl implements
9305 PolymerElement {
9306 /**
9307 * Initialize a newly created Polymer element to have the given name.
9308 *
9309 * @param name the name of this element
9310 * @param nameOffset the offset of the name of this element in the file that c ontains the
9311 * declaration of this element
9312 */
9313 PolymerElementImpl(String name, int nameOffset) : super(name, nameOffset);
9314 }
9315
9316 /**
9317 * The interface `PolymerTagDartElement` defines a Polymer custom tag in Dart.
9318 *
9319 * <pre>
9320 * @CustomTag('my-example')
9321 * </pre>
9322 */
9323 abstract class PolymerTagDartElement implements PolymerElement {
9324 /**
9325 * Return the [ClassElement] that is associated with this Polymer custom tag. Not
9326 * `null`, because [PolymerTagDartElement]s are created for [ClassElement]s
9327 * marked with the `@CustomTag` annotation.
9328 */
9329 ClassElement get classElement;
9330
9331 /**
9332 * Return the [PolymerTagHtmlElement] part of this Polymer custom tag. Maybe ` null` if
9333 * it has not been resolved yet or there are no corresponding Dart part define d.
9334 */
9335 PolymerTagHtmlElement get htmlElement;
9336 }
9337
9338 /**
9339 * Implementation of `PolymerTagDartElement`.
9340 */
9341 class PolymerTagDartElementImpl extends PolymerElementImpl implements
9342 PolymerTagDartElement {
9343 /**
9344 * The [ClassElement] that is associated with this Polymer custom tag.
9345 */
9346 final ClassElement classElement;
9347
9348 /**
9349 * The [PolymerTagHtmlElement] part of this Polymer custom tag. Maybe `null` i f it has
9350 * not been resolved yet or there are no corresponding Dart part defined.
9351 */
9352 PolymerTagHtmlElement htmlElement;
9353
9354 /**
9355 * Initialize a newly created Dart part of a Polymer tag to have the given nam e.
9356 *
9357 * @param name the name of this element
9358 * @param nameOffset the offset of the name of this element in the file that c ontains the
9359 * declaration of this element
9360 */
9361 PolymerTagDartElementImpl(String name, int nameOffset, this.classElement)
9362 : super(name, nameOffset);
9363
9364 @override
9365 ElementKind get kind => ElementKind.POLYMER_TAG_DART;
9366
9367 @override
9368 accept(ElementVisitor visitor) => visitor.visitPolymerTagDartElement(this);
9369 }
9370
9371 /**
9372 * The interface `PolymerTagHtmlElement` defines a Polymer custom tag in HTML.
9373 *
9374 * <pre>
9375 * <polymer-element name="my-example" attributes='attrA attrB'>
9376 * </polymer-element>
9377 * </pre>
9378 */
9379 abstract class PolymerTagHtmlElement implements PolymerElement {
9380 /**
9381 * An empty list of [PolymerTagHtmlElement]s.
9382 */
9383 static const List<PolymerTagHtmlElement> EMPTY_ARRAY = const
9384 <PolymerTagHtmlElement>[
9385 ];
9386
9387 /**
9388 * Return an array containing all of the attributes declared by this tag.
9389 */
9390 List<PolymerAttributeElement> get attributes;
9391
9392 /**
9393 * Return the [PolymerTagDartElement] part on this Polymer custom tag. Maybe ` null` if
9394 * it has not been resolved yet or there are no corresponding Dart part define d.
9395 */
9396 PolymerTagDartElement get dartElement;
9397 }
9398
9399 /**
9400 * Implementation of `PolymerTagHtmlElement`.
9401 */
9402 class PolymerTagHtmlElementImpl extends PolymerElementImpl implements
9403 PolymerTagHtmlElement {
9404 /**
9405 * The [PolymerTagDartElement] part of this Polymer custom tag. Maybe `null` i f it has
9406 * not been resolved yet or there are no corresponding Dart part defined.
9407 */
9408 PolymerTagDartElement dartElement;
9409
9410 /**
9411 * The array containing all of the attributes declared by this tag.
9412 */
9413 List<PolymerAttributeElement> _attributes =
9414 PolymerAttributeElement.EMPTY_ARRAY;
9415
9416 /**
9417 * Initialize a newly created HTML part of a Polymer tag to have the given nam e.
9418 *
9419 * @param name the name of this element
9420 * @param nameOffset the offset of the name of this element in the file that c ontains the
9421 * declaration of this element
9422 */
9423 PolymerTagHtmlElementImpl(String name, int nameOffset)
9424 : super(name, nameOffset);
9425
9426 @override
9427 List<PolymerAttributeElement> get attributes => _attributes;
9428
9429 /**
9430 * Set an array containing all of the attributes declared by this tag.
9431 *
9432 * @param attributes the properties to set
9433 */
9434 void set attributes(List<PolymerAttributeElement> attributes) {
9435 for (PolymerAttributeElement property in attributes) {
9436 encloseElement(property as PolymerAttributeElementImpl);
9437 }
9438 this._attributes = attributes;
9439 }
9440
9441 @override
9442 ElementKind get kind => ElementKind.POLYMER_TAG_HTML;
9443
9444 @override
9445 accept(ElementVisitor visitor) => visitor.visitPolymerTagHtmlElement(this);
9446
9447 @override
9448 void visitChildren(ElementVisitor visitor) {
9449 safelyVisitChildren(_attributes, visitor);
9450 super.visitChildren(visitor);
9451 }
9452 }
9453
9454 /**
9455 * The interface `PrefixElement` defines the behavior common to elements that re present a 9083 * The interface `PrefixElement` defines the behavior common to elements that re present a
9456 * prefix used to import one or more libraries into another library. 9084 * prefix used to import one or more libraries into another library.
9457 */ 9085 */
9458 abstract class PrefixElement implements Element { 9086 abstract class PrefixElement implements Element {
9459 /** 9087 /**
9460 * Return the library into which other libraries are imported using this prefi x. 9088 * Return the library into which other libraries are imported using this prefi x.
9461 * 9089 *
9462 * @return the library into which other libraries are imported using this pref ix 9090 * @return the library into which other libraries are imported using this pref ix
9463 */ 9091 */
9464 @override 9092 @override
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
10122 return null; 9750 return null;
10123 } 9751 }
10124 9752
10125 @override 9753 @override
10126 R visitParameterElement(ParameterElement element) { 9754 R visitParameterElement(ParameterElement element) {
10127 element.visitChildren(this); 9755 element.visitChildren(this);
10128 return null; 9756 return null;
10129 } 9757 }
10130 9758
10131 @override 9759 @override
10132 R visitPolymerAttributeElement(PolymerAttributeElement element) {
10133 element.visitChildren(this);
10134 return null;
10135 }
10136
10137 @override
10138 R visitPolymerTagDartElement(PolymerTagDartElement element) {
10139 element.visitChildren(this);
10140 return null;
10141 }
10142
10143 @override
10144 R visitPolymerTagHtmlElement(PolymerTagHtmlElement element) {
10145 element.visitChildren(this);
10146 return null;
10147 }
10148
10149 @override
10150 R visitPrefixElement(PrefixElement element) { 9760 R visitPrefixElement(PrefixElement element) {
10151 element.visitChildren(this); 9761 element.visitChildren(this);
10152 return null; 9762 return null;
10153 } 9763 }
10154 9764
10155 @override 9765 @override
10156 R visitPropertyAccessorElement(PropertyAccessorElement element) { 9766 R visitPropertyAccessorElement(PropertyAccessorElement element) {
10157 element.visitChildren(this); 9767 element.visitChildren(this);
10158 return null; 9768 return null;
10159 } 9769 }
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
10291 @override 9901 @override
10292 R visitMethodElement(MethodElement element) => null; 9902 R visitMethodElement(MethodElement element) => null;
10293 9903
10294 @override 9904 @override
10295 R visitMultiplyDefinedElement(MultiplyDefinedElement element) => null; 9905 R visitMultiplyDefinedElement(MultiplyDefinedElement element) => null;
10296 9906
10297 @override 9907 @override
10298 R visitParameterElement(ParameterElement element) => null; 9908 R visitParameterElement(ParameterElement element) => null;
10299 9909
10300 @override 9910 @override
10301 R visitPolymerAttributeElement(PolymerAttributeElement element) => null;
10302
10303 @override
10304 R visitPolymerTagDartElement(PolymerTagDartElement element) => null;
10305
10306 @override
10307 R visitPolymerTagHtmlElement(PolymerTagHtmlElement element) => null;
10308
10309 @override
10310 R visitPrefixElement(PrefixElement element) => null; 9911 R visitPrefixElement(PrefixElement element) => null;
10311 9912
10312 @override 9913 @override
10313 R visitPropertyAccessorElement(PropertyAccessorElement element) => null; 9914 R visitPropertyAccessorElement(PropertyAccessorElement element) => null;
10314 9915
10315 @override 9916 @override
10316 R visitTopLevelVariableElement(TopLevelVariableElement element) => null; 9917 R visitTopLevelVariableElement(TopLevelVariableElement element) => null;
10317 9918
10318 @override 9919 @override
10319 R visitTypeParameterElement(TypeParameterElement element) => null; 9920 R visitTypeParameterElement(TypeParameterElement element) => null;
10320 } 9921 }
10321 9922
10322 /** 9923 /**
10323 * The interface `ToolkitObjectElement` defines the behavior of elements that re present a
10324 * toolkit specific object, such as Angular controller or component. These eleme nts are not based on
10325 * the Dart syntax, but on some semantic agreement, such as a special annotation .
10326 */
10327 abstract class ToolkitObjectElement implements Element {
10328 /**
10329 * An empty list of toolkit object elements.
10330 */
10331 static const List<ToolkitObjectElement> EMPTY_ARRAY = const
10332 <ToolkitObjectElement>[
10333 ];
10334 }
10335
10336 /**
10337 * Instances of the class `ToolkitObjectElementImpl` implement a `ToolkitObjectE lement`.
10338 */
10339 abstract class ToolkitObjectElementImpl extends ElementImpl implements
10340 ToolkitObjectElement {
10341 /**
10342 * Initialize a newly created toolkit object element to have the given name.
10343 *
10344 * @param name the name of this element
10345 * @param nameOffset the offset of the name of this element in the file that c ontains the
10346 * declaration of this element
10347 */
10348 ToolkitObjectElementImpl(String name, int nameOffset)
10349 : super(name, nameOffset);
10350 }
10351
10352 /**
10353 * The interface `TopLevelVariableElement` defines the behavior of elements repr esenting a 9924 * The interface `TopLevelVariableElement` defines the behavior of elements repr esenting a
10354 * top-level variable. 9925 * top-level variable.
10355 */ 9926 */
10356 abstract class TopLevelVariableElement implements PropertyInducingElement { 9927 abstract class TopLevelVariableElement implements PropertyInducingElement {
10357 } 9928 }
10358 9929
10359 /** 9930 /**
10360 * Instances of the class `TopLevelVariableElementImpl` implement a 9931 * Instances of the class `TopLevelVariableElementImpl` implement a
10361 * `TopLevelVariableElement`. 9932 * `TopLevelVariableElement`.
10362 */ 9933 */
(...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after
11579 // bottom <: void (as bottom is a subtype of all types). 11150 // bottom <: void (as bottom is a subtype of all types).
11580 // void <: dynamic (as dynamic is a supertype of all types) 11151 // void <: dynamic (as dynamic is a supertype of all types)
11581 return identical(type, this) || type.isDynamic; 11152 return identical(type, this) || type.isDynamic;
11582 } 11153 }
11583 11154
11584 @override 11155 @override
11585 VoidTypeImpl substitute2(List<DartType> argumentTypes, 11156 VoidTypeImpl substitute2(List<DartType> argumentTypes,
11586 List<DartType> parameterTypes) => 11157 List<DartType> parameterTypes) =>
11587 this; 11158 this;
11588 } 11159 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/protocol_server_test.dart ('k') | pkg/analyzer/lib/src/generated/element_handle.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698