| OLD | NEW |
| 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'; |
| 11 | 11 |
| 12 import 'ast.dart'; | 12 import 'ast.dart'; |
| 13 import 'constant.dart' show EvaluationResultImpl; | 13 import 'constant.dart' show EvaluationResultImpl; |
| 14 import 'engine.dart' show AnalysisContext, AnalysisEngine, AnalysisException; | 14 import 'engine.dart' show AnalysisContext, AnalysisEngine, AnalysisException; |
| 15 import 'html.dart' show XmlAttributeNode, XmlTagNode; | 15 import 'html.dart' show XmlAttributeNode, XmlTagNode; |
| 16 import 'java_core.dart'; | 16 import 'java_core.dart'; |
| 17 import 'java_engine.dart'; | 17 import 'java_engine.dart'; |
| 18 import 'resolver.dart'; | 18 import 'resolver.dart'; |
| 19 import 'scanner.dart' show Keyword; | 19 import 'scanner.dart' show Keyword; |
| 20 import 'sdk.dart' show DartSdk; | 20 import 'sdk.dart' show DartSdk; |
| 21 import 'source.dart'; | 21 import 'source.dart'; |
| 22 import 'utilities_collection.dart'; | 22 import 'utilities_collection.dart'; |
| 23 import 'utilities_dart.dart'; | 23 import 'utilities_dart.dart'; |
| 24 | 24 |
| 25 /** | |
| 26 * Information about Angular application. | |
| 27 */ | |
| 28 class AngularApplication { | |
| 29 final Source entryPoint; | |
| 30 | |
| 31 final Set<Source> _librarySources; | |
| 32 | |
| 33 final List<AngularElement> elements; | |
| 34 | |
| 35 final List<Source> elementSources; | |
| 36 | |
| 37 AngularApplication(this.entryPoint, this._librarySources, this.elements, | |
| 38 this.elementSources); | |
| 39 | |
| 40 /** | |
| 41 * Checks if this application depends on the library with the given [Source]. | |
| 42 */ | |
| 43 bool dependsOn(Source librarySource) => | |
| 44 _librarySources.contains(librarySource); | |
| 45 } | |
| 46 | |
| 47 /** | |
| 48 * The interface `AngularControllerElement` defines the Angular component descri
bed by | |
| 49 * <code>Component</code> annotation. | |
| 50 */ | |
| 51 abstract class AngularComponentElement implements AngularHasSelectorElement, | |
| 52 AngularHasTemplateElement { | |
| 53 /** | |
| 54 * Return an array containing all of the properties declared by this component
. | |
| 55 */ | |
| 56 List<AngularPropertyElement> get properties; | |
| 57 | |
| 58 /** | |
| 59 * Return an array containing all of the scope properties set in the implement
ation of this | |
| 60 * component. | |
| 61 */ | |
| 62 List<AngularScopePropertyElement> get scopeProperties; | |
| 63 | |
| 64 /** | |
| 65 * Returns the CSS file URI. | |
| 66 */ | |
| 67 String get styleUri; | |
| 68 | |
| 69 /** | |
| 70 * Return the offset of the [getStyleUri] in the [getSource]. | |
| 71 * | |
| 72 * @return the offset of the style URI | |
| 73 */ | |
| 74 int get styleUriOffset; | |
| 75 } | |
| 76 | |
| 77 /** | |
| 78 * Implementation of `AngularComponentElement`. | |
| 79 */ | |
| 80 class AngularComponentElementImpl extends AngularHasSelectorElementImpl | |
| 81 implements AngularComponentElement { | |
| 82 /** | |
| 83 * The offset of the defining <code>Component</code> annotation. | |
| 84 */ | |
| 85 final int _annotationOffset; | |
| 86 | |
| 87 /** | |
| 88 * The array containing all of the properties declared by this component. | |
| 89 */ | |
| 90 List<AngularPropertyElement> _properties = AngularPropertyElement.EMPTY_ARRAY; | |
| 91 | |
| 92 /** | |
| 93 * The array containing all of the scope properties set by this component. | |
| 94 */ | |
| 95 List<AngularScopePropertyElement> _scopeProperties = | |
| 96 AngularScopePropertyElement.EMPTY_ARRAY; | |
| 97 | |
| 98 /** | |
| 99 * The the CSS file URI. | |
| 100 */ | |
| 101 String styleUri; | |
| 102 | |
| 103 /** | |
| 104 * The offset of the [styleUri] in the [getSource]. | |
| 105 */ | |
| 106 int styleUriOffset = 0; | |
| 107 | |
| 108 /** | |
| 109 * The HTML template URI. | |
| 110 */ | |
| 111 String templateUri; | |
| 112 | |
| 113 /** | |
| 114 * The HTML template source. | |
| 115 */ | |
| 116 Source templateSource; | |
| 117 | |
| 118 /** | |
| 119 * The offset of the [templateUri] in the [getSource]. | |
| 120 */ | |
| 121 int templateUriOffset = 0; | |
| 122 | |
| 123 /** | |
| 124 * Initialize a newly created Angular component to have the given name. | |
| 125 * | |
| 126 * @param name the name of this element | |
| 127 * @param nameOffset the offset of the name of this element in the file that c
ontains the | |
| 128 * declaration of this element | |
| 129 */ | |
| 130 AngularComponentElementImpl(String name, int nameOffset, | |
| 131 this._annotationOffset) | |
| 132 : super(name, nameOffset); | |
| 133 | |
| 134 @override | |
| 135 String get identifier => "AngularComponent@$_annotationOffset"; | |
| 136 | |
| 137 @override | |
| 138 ElementKind get kind => ElementKind.ANGULAR_COMPONENT; | |
| 139 | |
| 140 @override | |
| 141 List<AngularPropertyElement> get properties => _properties; | |
| 142 | |
| 143 /** | |
| 144 * Set an array containing all of the properties declared by this component. | |
| 145 * | |
| 146 * @param properties the properties to set | |
| 147 */ | |
| 148 void set properties(List<AngularPropertyElement> properties) { | |
| 149 for (AngularPropertyElement property in properties) { | |
| 150 encloseElement(property as AngularPropertyElementImpl); | |
| 151 } | |
| 152 this._properties = properties; | |
| 153 } | |
| 154 | |
| 155 @override | |
| 156 List<AngularScopePropertyElement> get scopeProperties => _scopeProperties; | |
| 157 | |
| 158 /** | |
| 159 * Set an array containing all of the scope properties declared by this compon
ent. | |
| 160 * | |
| 161 * @param properties the properties to set | |
| 162 */ | |
| 163 void set scopeProperties(List<AngularScopePropertyElement> properties) { | |
| 164 for (AngularScopePropertyElement property in properties) { | |
| 165 encloseElement(property as AngularScopePropertyElementImpl); | |
| 166 } | |
| 167 this._scopeProperties = properties; | |
| 168 } | |
| 169 | |
| 170 @override | |
| 171 accept(ElementVisitor visitor) => visitor.visitAngularComponentElement(this); | |
| 172 | |
| 173 @override | |
| 174 void visitChildren(ElementVisitor visitor) { | |
| 175 safelyVisitChildren(_properties, visitor); | |
| 176 safelyVisitChildren(_scopeProperties, visitor); | |
| 177 super.visitChildren(visitor); | |
| 178 } | |
| 179 } | |
| 180 | |
| 181 /** | |
| 182 * The interface `AngularControllerElement` defines the Angular controller descr
ibed by | |
| 183 * <code>Controller</code> annotation. | |
| 184 */ | |
| 185 abstract class AngularControllerElement implements AngularHasSelectorElement { | |
| 186 } | |
| 187 | |
| 188 /** | |
| 189 * Implementation of `AngularControllerElement`. | |
| 190 */ | |
| 191 class AngularControllerElementImpl extends AngularHasSelectorElementImpl | |
| 192 implements AngularControllerElement { | |
| 193 /** | |
| 194 * Initialize a newly created Angular controller to have the given name. | |
| 195 * | |
| 196 * @param name the name of this element | |
| 197 * @param nameOffset the offset of the name of this element in the file that c
ontains the | |
| 198 * declaration of this element | |
| 199 */ | |
| 200 AngularControllerElementImpl(String name, int nameOffset) | |
| 201 : super(name, nameOffset); | |
| 202 | |
| 203 @override | |
| 204 ElementKind get kind => ElementKind.ANGULAR_CONTROLLER; | |
| 205 | |
| 206 @override | |
| 207 accept(ElementVisitor visitor) => visitor.visitAngularControllerElement(this); | |
| 208 } | |
| 209 | |
| 210 /** | |
| 211 * The interface `AngularDirectiveElement` defines the Angular controller descri
bed by | |
| 212 * <code>Decorator</code> annotation. | |
| 213 */ | |
| 214 abstract class AngularDecoratorElement implements AngularHasSelectorElement { | |
| 215 /** | |
| 216 * Return an array containing all of the properties declared by this directive
. | |
| 217 */ | |
| 218 List<AngularPropertyElement> get properties; | |
| 219 | |
| 220 /** | |
| 221 * Checks if this directive is implemented by the class with given name. | |
| 222 */ | |
| 223 bool isClass(String name); | |
| 224 } | |
| 225 | |
| 226 /** | |
| 227 * Implementation of `AngularDirectiveElement`. | |
| 228 */ | |
| 229 class AngularDecoratorElementImpl extends AngularHasSelectorElementImpl | |
| 230 implements AngularDecoratorElement { | |
| 231 /** | |
| 232 * The offset of the annotation that defines this directive. | |
| 233 */ | |
| 234 final int _offset; | |
| 235 | |
| 236 /** | |
| 237 * The array containing all of the properties declared by this directive. | |
| 238 */ | |
| 239 List<AngularPropertyElement> _properties = AngularPropertyElement.EMPTY_ARRAY; | |
| 240 | |
| 241 /** | |
| 242 * Initialize a newly created Angular directive to have the given name. | |
| 243 * | |
| 244 * @param offset the offset of the annotation that defines this directive | |
| 245 */ | |
| 246 AngularDecoratorElementImpl(this._offset) : super(null, -1); | |
| 247 | |
| 248 @override | |
| 249 String get displayName => selector.displayName; | |
| 250 | |
| 251 @override | |
| 252 String get identifier => "Decorator@$_offset"; | |
| 253 | |
| 254 @override | |
| 255 ElementKind get kind => ElementKind.ANGULAR_DIRECTIVE; | |
| 256 | |
| 257 @override | |
| 258 List<AngularPropertyElement> get properties => _properties; | |
| 259 | |
| 260 /** | |
| 261 * Set an array containing all of the properties declared by this directive. | |
| 262 * | |
| 263 * @param properties the properties to set | |
| 264 */ | |
| 265 void set properties(List<AngularPropertyElement> properties) { | |
| 266 for (AngularPropertyElement property in properties) { | |
| 267 encloseElement(property as AngularPropertyElementImpl); | |
| 268 } | |
| 269 this._properties = properties; | |
| 270 } | |
| 271 | |
| 272 @override | |
| 273 accept(ElementVisitor visitor) => visitor.visitAngularDirectiveElement(this); | |
| 274 | |
| 275 @override | |
| 276 bool isClass(String name) { | |
| 277 Element enclosing = enclosingElement; | |
| 278 return enclosing is ClassElement && enclosing.name == name; | |
| 279 } | |
| 280 | |
| 281 @override | |
| 282 void visitChildren(ElementVisitor visitor) { | |
| 283 safelyVisitChildren(_properties, visitor); | |
| 284 super.visitChildren(visitor); | |
| 285 } | |
| 286 } | |
| 287 | |
| 288 /** | |
| 289 * The interface `AngularElement` defines the behavior of objects representing i
nformation | |
| 290 * about an Angular specific element. | |
| 291 */ | |
| 292 abstract class AngularElement implements ToolkitObjectElement { | |
| 293 /** | |
| 294 * An empty list of Angular elements. | |
| 295 */ | |
| 296 static const List<AngularElement> EMPTY_ARRAY = const <AngularElement>[]; | |
| 297 | |
| 298 /** | |
| 299 * Returns the [AngularApplication] this element is used in. | |
| 300 * | |
| 301 * @return the [AngularApplication] this element is used in | |
| 302 */ | |
| 303 AngularApplication get application; | |
| 304 } | |
| 305 | |
| 306 /** | |
| 307 * Implementation of `AngularElement`. | |
| 308 */ | |
| 309 abstract class AngularElementImpl extends ToolkitObjectElementImpl implements | |
| 310 AngularElement { | |
| 311 /** | |
| 312 * The [AngularApplication] this element is used in. | |
| 313 */ | |
| 314 AngularApplication _application; | |
| 315 | |
| 316 /** | |
| 317 * Initialize a newly created Angular element to have the given name. | |
| 318 * | |
| 319 * @param name the name of this element | |
| 320 * @param nameOffset the offset of the name of this element in the file that c
ontains the | |
| 321 * declaration of this element | |
| 322 */ | |
| 323 AngularElementImpl(String name, int nameOffset) : super(name, nameOffset); | |
| 324 | |
| 325 @override | |
| 326 AngularApplication get application => _application; | |
| 327 | |
| 328 /** | |
| 329 * Set the [AngularApplication] this element is used in. | |
| 330 */ | |
| 331 void set application(AngularApplication application) { | |
| 332 this._application = application; | |
| 333 } | |
| 334 } | |
| 335 | |
| 336 /** | |
| 337 * The interface `AngularFormatterElement` defines the Angular formatter describ
ed by | |
| 338 * <code>Formatter</code> annotation. | |
| 339 */ | |
| 340 abstract class AngularFormatterElement implements AngularElement { | |
| 341 } | |
| 342 | |
| 343 /** | |
| 344 * Implementation of `AngularFormatterElement`. | |
| 345 */ | |
| 346 class AngularFormatterElementImpl extends AngularElementImpl implements | |
| 347 AngularFormatterElement { | |
| 348 /** | |
| 349 * Initialize a newly created Angular formatter to have the given name. | |
| 350 * | |
| 351 * @param name the name of this element | |
| 352 * @param nameOffset the offset of the name of this element in the file that c
ontains the | |
| 353 * declaration of this element | |
| 354 */ | |
| 355 AngularFormatterElementImpl(String name, int nameOffset) | |
| 356 : super(name, nameOffset); | |
| 357 | |
| 358 @override | |
| 359 ElementKind get kind => ElementKind.ANGULAR_FORMATTER; | |
| 360 | |
| 361 @override | |
| 362 accept(ElementVisitor visitor) => visitor.visitAngularFormatterElement(this); | |
| 363 } | |
| 364 | |
| 365 /** | |
| 366 * [AngularSelectorElement] based on presence of attribute. | |
| 367 */ | |
| 368 abstract class AngularHasAttributeSelectorElement implements | |
| 369 AngularSelectorElement { | |
| 370 } | |
| 371 | |
| 372 /** | |
| 373 * [AngularSelectorElement] based on presence of a class. | |
| 374 */ | |
| 375 abstract class AngularHasClassSelectorElement implements AngularSelectorElement | |
| 376 { | |
| 377 } | |
| 378 | |
| 379 /** | |
| 380 * Implementation of [AngularSelectorElement] based on presence of a class. | |
| 381 */ | |
| 382 class AngularHasClassSelectorElementImpl extends AngularSelectorElementImpl | |
| 383 implements AngularHasClassSelectorElement { | |
| 384 AngularHasClassSelectorElementImpl(String name, int offset) | |
| 385 : super(name, offset); | |
| 386 | |
| 387 @override | |
| 388 void appendTo(StringBuffer buffer) { | |
| 389 buffer.write("."); | |
| 390 buffer.write(name); | |
| 391 } | |
| 392 | |
| 393 @override | |
| 394 bool apply(XmlTagNode node) { | |
| 395 XmlAttributeNode attribute = node.getAttribute("class"); | |
| 396 if (attribute != null) { | |
| 397 String text = attribute.text; | |
| 398 if (text != null) { | |
| 399 String name = this.name; | |
| 400 for (String className in StringUtils.split(text)) { | |
| 401 if (className == name) { | |
| 402 return true; | |
| 403 } | |
| 404 } | |
| 405 } | |
| 406 } | |
| 407 return false; | |
| 408 } | |
| 409 } | |
| 410 | |
| 411 /** | |
| 412 * The interface `AngularElement` defines the behavior of objects representing i
nformation | |
| 413 * about an Angular element which is applied conditionally using some [AngularSe
lectorElement]. | |
| 414 */ | |
| 415 abstract class AngularHasSelectorElement implements AngularElement { | |
| 416 /** | |
| 417 * Returns the selector specified for this element. | |
| 418 * | |
| 419 * @return the [AngularSelectorElement] specified for this element | |
| 420 */ | |
| 421 AngularSelectorElement get selector; | |
| 422 } | |
| 423 | |
| 424 /** | |
| 425 * Implementation of `AngularSelectorElement`. | |
| 426 */ | |
| 427 abstract class AngularHasSelectorElementImpl extends AngularElementImpl | |
| 428 implements AngularHasSelectorElement { | |
| 429 /** | |
| 430 * The selector of this element. | |
| 431 */ | |
| 432 AngularSelectorElement _selector; | |
| 433 | |
| 434 /** | |
| 435 * Initialize a newly created Angular element to have the given name. | |
| 436 * | |
| 437 * @param name the name of this element | |
| 438 * @param nameOffset the offset of the name of this element in the file that c
ontains the | |
| 439 * declaration of this element | |
| 440 */ | |
| 441 AngularHasSelectorElementImpl(String name, int nameOffset) | |
| 442 : super(name, nameOffset); | |
| 443 | |
| 444 @override | |
| 445 AngularSelectorElement get selector => _selector; | |
| 446 | |
| 447 /** | |
| 448 * Set the selector of this selector-based element. | |
| 449 * | |
| 450 * @param selector the selector to set | |
| 451 */ | |
| 452 void set selector(AngularSelectorElement selector) { | |
| 453 encloseElement(selector as AngularSelectorElementImpl); | |
| 454 this._selector = selector; | |
| 455 } | |
| 456 | |
| 457 @override | |
| 458 void visitChildren(ElementVisitor visitor) { | |
| 459 safelyVisitChild(_selector, visitor); | |
| 460 super.visitChildren(visitor); | |
| 461 } | |
| 462 } | |
| 463 | |
| 464 /** | |
| 465 * The interface `AngularHasTemplateElement` defines common behavior for | |
| 466 * [AngularElement] that have template URI / [Source]. | |
| 467 */ | |
| 468 abstract class AngularHasTemplateElement implements AngularElement { | |
| 469 /** | |
| 470 * Returns the HTML template [Source], `null` if not resolved. | |
| 471 */ | |
| 472 Source get templateSource; | |
| 473 | |
| 474 /** | |
| 475 * Returns the HTML template URI. | |
| 476 */ | |
| 477 String get templateUri; | |
| 478 | |
| 479 /** | |
| 480 * Return the offset of the [getTemplateUri] in the [getSource]. | |
| 481 * | |
| 482 * @return the offset of the template URI | |
| 483 */ | |
| 484 int get templateUriOffset; | |
| 485 } | |
| 486 | |
| 487 /** | |
| 488 * The interface `AngularPropertyElement` defines a single property in | |
| 489 * [AngularComponentElement]. | |
| 490 */ | |
| 491 abstract class AngularPropertyElement implements AngularElement { | |
| 492 /** | |
| 493 * An empty list of property elements. | |
| 494 */ | |
| 495 static const List<AngularPropertyElement> EMPTY_ARRAY = const | |
| 496 <AngularPropertyElement>[ | |
| 497 ]; | |
| 498 | |
| 499 /** | |
| 500 * Returns the field this property is mapped to. | |
| 501 * | |
| 502 * @return the field this property is mapped to. | |
| 503 */ | |
| 504 FieldElement get field; | |
| 505 | |
| 506 /** | |
| 507 * Return the offset of the field name of this property in the property map, o
r `-1` if | |
| 508 * property was created using annotation on [FieldElement]. | |
| 509 * | |
| 510 * @return the offset of the field name of this property | |
| 511 */ | |
| 512 int get fieldNameOffset; | |
| 513 | |
| 514 /** | |
| 515 * Returns the kind of this property. | |
| 516 * | |
| 517 * @return the kind of this property | |
| 518 */ | |
| 519 AngularPropertyKind get propertyKind; | |
| 520 } | |
| 521 | |
| 522 /** | |
| 523 * Implementation of `AngularPropertyElement`. | |
| 524 */ | |
| 525 class AngularPropertyElementImpl extends AngularElementImpl implements | |
| 526 AngularPropertyElement { | |
| 527 /** | |
| 528 * The [FieldElement] to which this property is bound. | |
| 529 */ | |
| 530 FieldElement field; | |
| 531 | |
| 532 /** | |
| 533 * The offset of the field name in the property map. | |
| 534 */ | |
| 535 int fieldNameOffset = -1; | |
| 536 | |
| 537 AngularPropertyKind propertyKind; | |
| 538 | |
| 539 /** | |
| 540 * Initialize a newly created Angular property to have the given name. | |
| 541 * | |
| 542 * @param name the name of this element | |
| 543 * @param nameOffset the offset of the name of this element in the file that c
ontains the | |
| 544 * declaration of this element | |
| 545 */ | |
| 546 AngularPropertyElementImpl(String name, int nameOffset) | |
| 547 : super(name, nameOffset); | |
| 548 | |
| 549 @override | |
| 550 ElementKind get kind => ElementKind.ANGULAR_PROPERTY; | |
| 551 | |
| 552 @override | |
| 553 accept(ElementVisitor visitor) => visitor.visitAngularPropertyElement(this); | |
| 554 } | |
| 555 | |
| 556 /** | |
| 557 * The enumeration `AngularPropertyKind` defines the different kinds of property
bindings. | |
| 558 */ | |
| 559 class AngularPropertyKind extends Enum<AngularPropertyKind> { | |
| 560 /** | |
| 561 * `@` - Map the DOM attribute string. The attribute string will be taken lite
rally or | |
| 562 * interpolated if it contains binding {{}} syntax and assigned to the express
ion. (cost: 0 | |
| 563 * watches) | |
| 564 */ | |
| 565 static const AngularPropertyKind ATTR = const AngularPropertyKind('ATTR', 0); | |
| 566 | |
| 567 /** | |
| 568 * `&` - Treat the DOM attribute value as an expression. Assign a closure func
tion into the field. | |
| 569 * This allows the component to control the invocation of the closure. This is
useful for passing | |
| 570 * expressions into controllers which act like callbacks. (cost: 0 watches) | |
| 571 */ | |
| 572 static const AngularPropertyKind CALLBACK = | |
| 573 const AngularPropertyKind('CALLBACK', 1); | |
| 574 | |
| 575 /** | |
| 576 * `=>` - Treat the DOM attribute value as an expression. Set up a watch, whic
h will read the | |
| 577 * expression in the attribute and assign the value to destination expression.
(cost: 1 watch) | |
| 578 */ | |
| 579 static const AngularPropertyKind ONE_WAY = | |
| 580 const AngularPropertyKind('ONE_WAY', 2); | |
| 581 | |
| 582 /** | |
| 583 * `=>!` - Treat the DOM attribute value as an expression. Set up a one time w
atch on expression. | |
| 584 * Once the expression turns not null it will no longer update. (cost: 1 watch
es until not null, | |
| 585 * then 0 watches) | |
| 586 */ | |
| 587 static const AngularPropertyKind ONE_WAY_ONE_TIME = | |
| 588 const AngularPropertyKind('ONE_WAY_ONE_TIME', 3); | |
| 589 | |
| 590 /** | |
| 591 * `<=>` - Treat the DOM attribute value as an expression. Set up a watch on b
oth outside as well | |
| 592 * as component scope to keep the source and destination in sync. (cost: 2 wat
ches) | |
| 593 */ | |
| 594 static const AngularPropertyKind TWO_WAY = | |
| 595 const AngularPropertyKind_TWO_WAY('TWO_WAY', 4); | |
| 596 | |
| 597 static const List<AngularPropertyKind> values = const [ | |
| 598 ATTR, | |
| 599 CALLBACK, | |
| 600 ONE_WAY, | |
| 601 ONE_WAY_ONE_TIME, | |
| 602 TWO_WAY]; | |
| 603 | |
| 604 const AngularPropertyKind(String name, int ordinal) : super(name, ordinal); | |
| 605 | |
| 606 /** | |
| 607 * Returns `true` if property of this kind calls field getter. | |
| 608 */ | |
| 609 bool callsGetter() => false; | |
| 610 | |
| 611 /** | |
| 612 * Returns `true` if property of this kind calls field setter. | |
| 613 */ | |
| 614 bool callsSetter() => true; | |
| 615 } | |
| 616 | |
| 617 class AngularPropertyKind_TWO_WAY extends AngularPropertyKind { | |
| 618 const AngularPropertyKind_TWO_WAY(String name, int ordinal) | |
| 619 : super(name, ordinal); | |
| 620 | |
| 621 @override | |
| 622 bool callsGetter() => true; | |
| 623 } | |
| 624 | |
| 625 /** | |
| 626 * The interface `AngularScopeVariableElement` defines the Angular <code>Scope</
code> | |
| 627 * property. They are created for every <code>scope['property'] = value;</code>
code snippet. | |
| 628 */ | |
| 629 abstract class AngularScopePropertyElement implements AngularElement { | |
| 630 /** | |
| 631 * An empty list of scope property elements. | |
| 632 */ | |
| 633 static const List<AngularScopePropertyElement> EMPTY_ARRAY = const | |
| 634 <AngularScopePropertyElement>[ | |
| 635 ]; | |
| 636 | |
| 637 /** | |
| 638 * Returns the type of this property, not `null`, maybe <code>dynamic</code>. | |
| 639 * | |
| 640 * @return the type of this property. | |
| 641 */ | |
| 642 DartType get type; | |
| 643 } | |
| 644 | |
| 645 /** | |
| 646 * Implementation of `AngularScopePropertyElement`. | |
| 647 */ | |
| 648 class AngularScopePropertyElementImpl extends AngularElementImpl implements | |
| 649 AngularScopePropertyElement { | |
| 650 /** | |
| 651 * The type of the property | |
| 652 */ | |
| 653 final DartType type; | |
| 654 | |
| 655 /** | |
| 656 * Initialize a newly created Angular scope property to have the given name. | |
| 657 * | |
| 658 * @param name the name of this element | |
| 659 * @param nameOffset the offset of the name of this element in the file that c
ontains the | |
| 660 * declaration of this element | |
| 661 */ | |
| 662 AngularScopePropertyElementImpl(String name, int nameOffset, this.type) | |
| 663 : super(name, nameOffset); | |
| 664 | |
| 665 @override | |
| 666 ElementKind get kind => ElementKind.ANGULAR_SCOPE_PROPERTY; | |
| 667 | |
| 668 @override | |
| 669 accept(ElementVisitor visitor) => | |
| 670 visitor.visitAngularScopePropertyElement(this); | |
| 671 } | |
| 672 | |
| 673 /** | |
| 674 * [AngularSelectorElement] is used to decide when Angular object should be appl
ied. | |
| 675 * | |
| 676 * This class is an [Element] to support renaming component tag names, which are
identifiers | |
| 677 * in selectors. | |
| 678 */ | |
| 679 abstract class AngularSelectorElement implements AngularElement { | |
| 680 /** | |
| 681 * Checks if the given [XmlTagNode] matches this selector. | |
| 682 * | |
| 683 * @param node the [XmlTagNode] to check | |
| 684 * @return `true` if the given [XmlTagNode] matches, or `false` otherwise | |
| 685 */ | |
| 686 bool apply(XmlTagNode node); | |
| 687 } | |
| 688 | |
| 689 /** | |
| 690 * Implementation of `AngularFormatterElement`. | |
| 691 */ | |
| 692 abstract class AngularSelectorElementImpl extends AngularElementImpl implements | |
| 693 AngularSelectorElement { | |
| 694 /** | |
| 695 * Initialize a newly created Angular selector to have the given name. | |
| 696 * | |
| 697 * @param name the name of this element | |
| 698 * @param nameOffset the offset of the name of this element in the file that c
ontains the | |
| 699 * declaration of this element | |
| 700 */ | |
| 701 AngularSelectorElementImpl(String name, int nameOffset) | |
| 702 : super(name, nameOffset); | |
| 703 | |
| 704 @override | |
| 705 ElementKind get kind => ElementKind.ANGULAR_SELECTOR; | |
| 706 | |
| 707 @override | |
| 708 accept(ElementVisitor visitor) => visitor.visitAngularSelectorElement(this); | |
| 709 } | |
| 710 | |
| 711 /** | |
| 712 * [AngularSelectorElement] based on tag name. | |
| 713 */ | |
| 714 abstract class AngularTagSelectorElement implements AngularSelectorElement { | |
| 715 } | |
| 716 | |
| 717 /** | |
| 718 * Implementation of [AngularSelectorElement] based on tag name. | |
| 719 */ | |
| 720 class AngularTagSelectorElementImpl extends AngularSelectorElementImpl | |
| 721 implements AngularTagSelectorElement { | |
| 722 AngularTagSelectorElementImpl(String name, int offset) : super(name, offset); | |
| 723 | |
| 724 @override | |
| 725 AngularApplication get application => | |
| 726 (enclosingElement as AngularElementImpl).application; | |
| 727 | |
| 728 @override | |
| 729 bool apply(XmlTagNode node) { | |
| 730 String tagName = name; | |
| 731 return node.tag == tagName; | |
| 732 } | |
| 733 } | |
| 734 | |
| 735 /** | |
| 736 * The interface `AngularViewElement` defines the Angular view defined using inv
ocation like | |
| 737 * <code>view('views/create.html')</code>. | |
| 738 */ | |
| 739 abstract class AngularViewElement implements AngularHasTemplateElement { | |
| 740 /** | |
| 741 * An empty list of view elements. | |
| 742 */ | |
| 743 static const List<AngularViewElement> EMPTY_ARRAY = const | |
| 744 <AngularViewElement>[ | |
| 745 ]; | |
| 746 } | |
| 747 | |
| 748 /** | |
| 749 * Implementation of `AngularViewElement`. | |
| 750 */ | |
| 751 class AngularViewElementImpl extends AngularElementImpl implements | |
| 752 AngularViewElement { | |
| 753 /** | |
| 754 * The HTML template URI. | |
| 755 */ | |
| 756 final String templateUri; | |
| 757 | |
| 758 /** | |
| 759 * The offset of the [templateUri] in the [getSource]. | |
| 760 */ | |
| 761 final int templateUriOffset; | |
| 762 | |
| 763 /** | |
| 764 * The HTML template source. | |
| 765 */ | |
| 766 Source templateSource; | |
| 767 | |
| 768 /** | |
| 769 * Initialize a newly created Angular view. | |
| 770 */ | |
| 771 AngularViewElementImpl(this.templateUri, this.templateUriOffset) | |
| 772 : super(null, -1); | |
| 773 | |
| 774 @override | |
| 775 String get identifier => "AngularView@$templateUriOffset"; | |
| 776 | |
| 777 @override | |
| 778 ElementKind get kind => ElementKind.ANGULAR_VIEW; | |
| 779 | |
| 780 @override | |
| 781 accept(ElementVisitor visitor) => visitor.visitAngularViewElement(this); | |
| 782 } | |
| 783 | 25 |
| 784 /** | 26 /** |
| 785 * For AST nodes that could be in both the getter and setter contexts ([IndexExp
ression]s and | 27 * For AST nodes that could be in both the getter and setter contexts ([IndexExp
ression]s and |
| 786 * [SimpleIdentifier]s), the additional resolved elements are stored in the AST
node, in an | 28 * [SimpleIdentifier]s), the additional resolved elements are stored in the AST
node, in an |
| 787 * [AuxiliaryElements]. Since resolved elements are either statically resolved o
r resolved | 29 * [AuxiliaryElements]. Since resolved elements are either statically resolved o
r resolved |
| 788 * using propagated type information, this class is a wrapper for a pair of | 30 * using propagated type information, this class is a wrapper for a pair of |
| 789 * [ExecutableElement]s, not just a single [ExecutableElement]. | 31 * [ExecutableElement]s, not just a single [ExecutableElement]. |
| 790 */ | 32 */ |
| 791 class AuxiliaryElements { | 33 class AuxiliaryElements { |
| 792 /** | 34 /** |
| (...skipping 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2018 abstract class CompilationUnitElement implements Element, UriReferencedElement { | 1260 abstract class CompilationUnitElement implements Element, UriReferencedElement { |
| 2019 /** | 1261 /** |
| 2020 * Return an array containing all of the top-level accessors (getters and sett
ers) contained in | 1262 * Return an array containing all of the top-level accessors (getters and sett
ers) contained in |
| 2021 * this compilation unit. | 1263 * this compilation unit. |
| 2022 * | 1264 * |
| 2023 * @return the top-level accessors contained in this compilation unit | 1265 * @return the top-level accessors contained in this compilation unit |
| 2024 */ | 1266 */ |
| 2025 List<PropertyAccessorElement> get accessors; | 1267 List<PropertyAccessorElement> get accessors; |
| 2026 | 1268 |
| 2027 /** | 1269 /** |
| 2028 * Return an array containing all of the Angular views defined in this compila
tion unit. The array | |
| 2029 * will be empty if the element does not have any Angular views or if the comp
ilation unit has not | |
| 2030 * yet had toolkit references resolved. | |
| 2031 * | |
| 2032 * @return the Angular views defined in this compilation unit. | |
| 2033 */ | |
| 2034 List<AngularViewElement> get angularViews; | |
| 2035 | |
| 2036 /** | |
| 2037 * Return the library in which this compilation unit is defined. | 1270 * Return the library in which this compilation unit is defined. |
| 2038 * | 1271 * |
| 2039 * @return the library in which this compilation unit is defined | 1272 * @return the library in which this compilation unit is defined |
| 2040 */ | 1273 */ |
| 2041 @override | 1274 @override |
| 2042 LibraryElement get enclosingElement; | 1275 LibraryElement get enclosingElement; |
| 2043 | 1276 |
| 2044 /** | 1277 /** |
| 2045 * Return an array containing all of the enums contained in this compilation u
nit. | 1278 * Return an array containing all of the enums contained in this compilation u
nit. |
| 2046 * | 1279 * |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2166 */ | 1399 */ |
| 2167 List<ClassElement> _types = ClassElementImpl.EMPTY_ARRAY; | 1400 List<ClassElement> _types = ClassElementImpl.EMPTY_ARRAY; |
| 2168 | 1401 |
| 2169 /** | 1402 /** |
| 2170 * An array containing all of the variables contained in this compilation unit
. | 1403 * An array containing all of the variables contained in this compilation unit
. |
| 2171 */ | 1404 */ |
| 2172 List<TopLevelVariableElement> _variables = | 1405 List<TopLevelVariableElement> _variables = |
| 2173 TopLevelVariableElementImpl.EMPTY_ARRAY; | 1406 TopLevelVariableElementImpl.EMPTY_ARRAY; |
| 2174 | 1407 |
| 2175 /** | 1408 /** |
| 2176 * An array containing all of the Angular views contained in this compilation
unit. | |
| 2177 */ | |
| 2178 List<AngularViewElement> _angularViews = AngularViewElement.EMPTY_ARRAY; | |
| 2179 | |
| 2180 /** | |
| 2181 * Initialize a newly created compilation unit element to have the given name. | 1409 * Initialize a newly created compilation unit element to have the given name. |
| 2182 * | 1410 * |
| 2183 * @param name the name of this element | 1411 * @param name the name of this element |
| 2184 */ | 1412 */ |
| 2185 CompilationUnitElementImpl(String name) : super(name, -1); | 1413 CompilationUnitElementImpl(String name) : super(name, -1); |
| 2186 | 1414 |
| 2187 @override | 1415 @override |
| 2188 List<PropertyAccessorElement> get accessors => _accessors; | 1416 List<PropertyAccessorElement> get accessors => _accessors; |
| 2189 | 1417 |
| 2190 /** | 1418 /** |
| 2191 * Set the top-level accessors (getters and setters) contained in this compila
tion unit to the | 1419 * Set the top-level accessors (getters and setters) contained in this compila
tion unit to the |
| 2192 * given accessors. | 1420 * given accessors. |
| 2193 * | 1421 * |
| 2194 * @param the top-level accessors (getters and setters) contained in this comp
ilation unit | 1422 * @param the top-level accessors (getters and setters) contained in this comp
ilation unit |
| 2195 */ | 1423 */ |
| 2196 void set accessors(List<PropertyAccessorElement> accessors) { | 1424 void set accessors(List<PropertyAccessorElement> accessors) { |
| 2197 for (PropertyAccessorElement accessor in accessors) { | 1425 for (PropertyAccessorElement accessor in accessors) { |
| 2198 (accessor as PropertyAccessorElementImpl).enclosingElement = this; | 1426 (accessor as PropertyAccessorElementImpl).enclosingElement = this; |
| 2199 } | 1427 } |
| 2200 this._accessors = accessors; | 1428 this._accessors = accessors; |
| 2201 } | 1429 } |
| 2202 | 1430 |
| 2203 @override | 1431 @override |
| 2204 List<AngularViewElement> get angularViews => _angularViews; | |
| 2205 | |
| 2206 /** | |
| 2207 * Set the Angular views defined in this compilation unit. | |
| 2208 * | |
| 2209 * @param angularViews the Angular views defined in this compilation unit | |
| 2210 */ | |
| 2211 void set angularViews(List<AngularViewElement> angularViews) { | |
| 2212 for (AngularViewElement view in angularViews) { | |
| 2213 (view as AngularViewElementImpl).enclosingElement = this; | |
| 2214 } | |
| 2215 this._angularViews = angularViews; | |
| 2216 } | |
| 2217 | |
| 2218 @override | |
| 2219 LibraryElement get enclosingElement => | 1432 LibraryElement get enclosingElement => |
| 2220 super.enclosingElement as LibraryElement; | 1433 super.enclosingElement as LibraryElement; |
| 2221 | 1434 |
| 2222 @override | 1435 @override |
| 2223 List<ClassElement> get enums => _enums; | 1436 List<ClassElement> get enums => _enums; |
| 2224 | 1437 |
| 2225 /** | 1438 /** |
| 2226 * Set the enums contained in this compilation unit to the given enums. | 1439 * Set the enums contained in this compilation unit to the given enums. |
| 2227 * | 1440 * |
| 2228 * @param enums enums contained in this compilation unit | 1441 * @param enums enums contained in this compilation unit |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2397 | 1610 |
| 2398 @override | 1611 @override |
| 2399 void visitChildren(ElementVisitor visitor) { | 1612 void visitChildren(ElementVisitor visitor) { |
| 2400 super.visitChildren(visitor); | 1613 super.visitChildren(visitor); |
| 2401 safelyVisitChildren(_accessors, visitor); | 1614 safelyVisitChildren(_accessors, visitor); |
| 2402 safelyVisitChildren(_enums, visitor); | 1615 safelyVisitChildren(_enums, visitor); |
| 2403 safelyVisitChildren(_functions, visitor); | 1616 safelyVisitChildren(_functions, visitor); |
| 2404 safelyVisitChildren(_typeAliases, visitor); | 1617 safelyVisitChildren(_typeAliases, visitor); |
| 2405 safelyVisitChildren(_types, visitor); | 1618 safelyVisitChildren(_types, visitor); |
| 2406 safelyVisitChildren(_variables, visitor); | 1619 safelyVisitChildren(_variables, visitor); |
| 2407 safelyVisitChildren(_angularViews, visitor); | |
| 2408 } | 1620 } |
| 2409 | 1621 |
| 2410 /** | 1622 /** |
| 2411 * Returns the associated toolkit objects. | 1623 * Returns the associated toolkit objects. |
| 2412 * | 1624 * |
| 2413 * @param element the [Element] to get toolkit objects for | 1625 * @param element the [Element] to get toolkit objects for |
| 2414 * @return the associated toolkit objects, may be empty, but not `null` | 1626 * @return the associated toolkit objects, may be empty, but not `null` |
| 2415 */ | 1627 */ |
| 2416 List<ToolkitObjectElement> _getToolkitObjects(Element element) { | 1628 List<ToolkitObjectElement> _getToolkitObjects(Element element) { |
| 2417 List<ToolkitObjectElement> objects = _toolkitObjects[element]; | 1629 List<ToolkitObjectElement> objects = _toolkitObjects[element]; |
| (...skipping 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3814 @override | 3026 @override |
| 3815 void visitChildren(ElementVisitor visitor) { | 3027 void visitChildren(ElementVisitor visitor) { |
| 3816 // There are no children to visit | 3028 // There are no children to visit |
| 3817 } | 3029 } |
| 3818 } | 3030 } |
| 3819 | 3031 |
| 3820 /** | 3032 /** |
| 3821 * The enumeration `ElementKind` defines the various kinds of elements in the el
ement model. | 3033 * The enumeration `ElementKind` defines the various kinds of elements in the el
ement model. |
| 3822 */ | 3034 */ |
| 3823 class ElementKind extends Enum<ElementKind> { | 3035 class ElementKind extends Enum<ElementKind> { |
| 3824 static const ElementKind ANGULAR_FORMATTER = | 3036 static const ElementKind CLASS = const ElementKind('CLASS', 0, "class"); |
| 3825 const ElementKind('ANGULAR_FORMATTER', 0, "Angular formatter"); | |
| 3826 | |
| 3827 static const ElementKind ANGULAR_COMPONENT = | |
| 3828 const ElementKind('ANGULAR_COMPONENT', 1, "Angular component"); | |
| 3829 | |
| 3830 static const ElementKind ANGULAR_CONTROLLER = | |
| 3831 const ElementKind('ANGULAR_CONTROLLER', 2, "Angular controller"); | |
| 3832 | |
| 3833 static const ElementKind ANGULAR_DIRECTIVE = | |
| 3834 const ElementKind('ANGULAR_DIRECTIVE', 3, "Angular directive"); | |
| 3835 | |
| 3836 static const ElementKind ANGULAR_PROPERTY = | |
| 3837 const ElementKind('ANGULAR_PROPERTY', 4, "Angular property"); | |
| 3838 | |
| 3839 static const ElementKind ANGULAR_SCOPE_PROPERTY = | |
| 3840 const ElementKind('ANGULAR_SCOPE_PROPERTY', 5, "Angular scope property"); | |
| 3841 | |
| 3842 static const ElementKind ANGULAR_SELECTOR = | |
| 3843 const ElementKind('ANGULAR_SELECTOR', 6, "Angular selector"); | |
| 3844 | |
| 3845 static const ElementKind ANGULAR_VIEW = | |
| 3846 const ElementKind('ANGULAR_VIEW', 7, "Angular view"); | |
| 3847 | |
| 3848 static const ElementKind CLASS = const ElementKind('CLASS', 8, "class"); | |
| 3849 | 3037 |
| 3850 static const ElementKind COMPILATION_UNIT = | 3038 static const ElementKind COMPILATION_UNIT = |
| 3851 const ElementKind('COMPILATION_UNIT', 9, "compilation unit"); | 3039 const ElementKind('COMPILATION_UNIT', 1, "compilation unit"); |
| 3852 | 3040 |
| 3853 static const ElementKind CONSTRUCTOR = | 3041 static const ElementKind CONSTRUCTOR = |
| 3854 const ElementKind('CONSTRUCTOR', 10, "constructor"); | 3042 const ElementKind('CONSTRUCTOR', 2, "constructor"); |
| 3855 | 3043 |
| 3856 static const ElementKind DYNAMIC = | 3044 static const ElementKind DYNAMIC = |
| 3857 const ElementKind('DYNAMIC', 11, "<dynamic>"); | 3045 const ElementKind('DYNAMIC', 3, "<dynamic>"); |
| 3858 | 3046 |
| 3859 static const ElementKind EMBEDDED_HTML_SCRIPT = | 3047 static const ElementKind EMBEDDED_HTML_SCRIPT = |
| 3860 const ElementKind('EMBEDDED_HTML_SCRIPT', 12, "embedded html script"); | 3048 const ElementKind('EMBEDDED_HTML_SCRIPT', 4, "embedded html script"); |
| 3861 | 3049 |
| 3862 static const ElementKind ERROR = const ElementKind('ERROR', 13, "<error>"); | 3050 static const ElementKind ERROR = const ElementKind('ERROR', 5, "<error>"); |
| 3863 | 3051 |
| 3864 static const ElementKind EXPORT = | 3052 static const ElementKind EXPORT = |
| 3865 const ElementKind('EXPORT', 14, "export directive"); | 3053 const ElementKind('EXPORT', 6, "export directive"); |
| 3866 | 3054 |
| 3867 static const ElementKind EXTERNAL_HTML_SCRIPT = | 3055 static const ElementKind EXTERNAL_HTML_SCRIPT = |
| 3868 const ElementKind('EXTERNAL_HTML_SCRIPT', 15, "external html script"); | 3056 const ElementKind('EXTERNAL_HTML_SCRIPT', 7, "external html script"); |
| 3869 | 3057 |
| 3870 static const ElementKind FIELD = const ElementKind('FIELD', 16, "field"); | 3058 static const ElementKind FIELD = const ElementKind('FIELD', 8, "field"); |
| 3871 | 3059 |
| 3872 static const ElementKind FUNCTION = | 3060 static const ElementKind FUNCTION = |
| 3873 const ElementKind('FUNCTION', 17, "function"); | 3061 const ElementKind('FUNCTION', 9, "function"); |
| 3874 | 3062 |
| 3875 static const ElementKind GETTER = const ElementKind('GETTER', 18, "getter"); | 3063 static const ElementKind GETTER = const ElementKind('GETTER', 10, "getter"); |
| 3876 | 3064 |
| 3877 static const ElementKind HTML = const ElementKind('HTML', 19, "html"); | 3065 static const ElementKind HTML = const ElementKind('HTML', 11, "html"); |
| 3878 | 3066 |
| 3879 static const ElementKind IMPORT = | 3067 static const ElementKind IMPORT = |
| 3880 const ElementKind('IMPORT', 20, "import directive"); | 3068 const ElementKind('IMPORT', 12, "import directive"); |
| 3881 | 3069 |
| 3882 static const ElementKind LABEL = const ElementKind('LABEL', 21, "label"); | 3070 static const ElementKind LABEL = const ElementKind('LABEL', 13, "label"); |
| 3883 | 3071 |
| 3884 static const ElementKind LIBRARY = | 3072 static const ElementKind LIBRARY = |
| 3885 const ElementKind('LIBRARY', 22, "library"); | 3073 const ElementKind('LIBRARY', 14, "library"); |
| 3886 | 3074 |
| 3887 static const ElementKind LOCAL_VARIABLE = | 3075 static const ElementKind LOCAL_VARIABLE = |
| 3888 const ElementKind('LOCAL_VARIABLE', 23, "local variable"); | 3076 const ElementKind('LOCAL_VARIABLE', 15, "local variable"); |
| 3889 | 3077 |
| 3890 static const ElementKind METHOD = const ElementKind('METHOD', 24, "method"); | 3078 static const ElementKind METHOD = const ElementKind('METHOD', 16, "method"); |
| 3891 | 3079 |
| 3892 static const ElementKind NAME = const ElementKind('NAME', 25, "<name>"); | 3080 static const ElementKind NAME = const ElementKind('NAME', 17, "<name>"); |
| 3893 | 3081 |
| 3894 static const ElementKind PARAMETER = | 3082 static const ElementKind PARAMETER = |
| 3895 const ElementKind('PARAMETER', 26, "parameter"); | 3083 const ElementKind('PARAMETER', 18, "parameter"); |
| 3896 | 3084 |
| 3897 static const ElementKind POLYMER_ATTRIBUTE = | 3085 static const ElementKind POLYMER_ATTRIBUTE = |
| 3898 const ElementKind('POLYMER_ATTRIBUTE', 27, "Polymer attribute"); | 3086 const ElementKind('POLYMER_ATTRIBUTE', 19, "Polymer attribute"); |
| 3899 | 3087 |
| 3900 static const ElementKind POLYMER_TAG_DART = | 3088 static const ElementKind POLYMER_TAG_DART = |
| 3901 const ElementKind('POLYMER_TAG_DART', 28, "Polymer Dart tag"); | 3089 const ElementKind('POLYMER_TAG_DART', 20, "Polymer Dart tag"); |
| 3902 | 3090 |
| 3903 static const ElementKind POLYMER_TAG_HTML = | 3091 static const ElementKind POLYMER_TAG_HTML = |
| 3904 const ElementKind('POLYMER_TAG_HTML', 29, "Polymer HTML tag"); | 3092 const ElementKind('POLYMER_TAG_HTML', 21, "Polymer HTML tag"); |
| 3905 | 3093 |
| 3906 static const ElementKind PREFIX = | 3094 static const ElementKind PREFIX = |
| 3907 const ElementKind('PREFIX', 30, "import prefix"); | 3095 const ElementKind('PREFIX', 22, "import prefix"); |
| 3908 | 3096 |
| 3909 static const ElementKind SETTER = const ElementKind('SETTER', 31, "setter"); | 3097 static const ElementKind SETTER = const ElementKind('SETTER', 23, "setter"); |
| 3910 | 3098 |
| 3911 static const ElementKind TOP_LEVEL_VARIABLE = | 3099 static const ElementKind TOP_LEVEL_VARIABLE = |
| 3912 const ElementKind('TOP_LEVEL_VARIABLE', 32, "top level variable"); | 3100 const ElementKind('TOP_LEVEL_VARIABLE', 24, "top level variable"); |
| 3913 | 3101 |
| 3914 static const ElementKind FUNCTION_TYPE_ALIAS = | 3102 static const ElementKind FUNCTION_TYPE_ALIAS = |
| 3915 const ElementKind('FUNCTION_TYPE_ALIAS', 33, "function type alias"); | 3103 const ElementKind('FUNCTION_TYPE_ALIAS', 25, "function type alias"); |
| 3916 | 3104 |
| 3917 static const ElementKind TYPE_PARAMETER = | 3105 static const ElementKind TYPE_PARAMETER = |
| 3918 const ElementKind('TYPE_PARAMETER', 34, "type parameter"); | 3106 const ElementKind('TYPE_PARAMETER', 26, "type parameter"); |
| 3919 | 3107 |
| 3920 static const ElementKind UNIVERSE = | 3108 static const ElementKind UNIVERSE = |
| 3921 const ElementKind('UNIVERSE', 35, "<universe>"); | 3109 const ElementKind('UNIVERSE', 27, "<universe>"); |
| 3922 | 3110 |
| 3923 static const List<ElementKind> values = const [ | 3111 static const List<ElementKind> values = const [ |
| 3924 ANGULAR_FORMATTER, | |
| 3925 ANGULAR_COMPONENT, | |
| 3926 ANGULAR_CONTROLLER, | |
| 3927 ANGULAR_DIRECTIVE, | |
| 3928 ANGULAR_PROPERTY, | |
| 3929 ANGULAR_SCOPE_PROPERTY, | |
| 3930 ANGULAR_SELECTOR, | |
| 3931 ANGULAR_VIEW, | |
| 3932 CLASS, | 3112 CLASS, |
| 3933 COMPILATION_UNIT, | 3113 COMPILATION_UNIT, |
| 3934 CONSTRUCTOR, | 3114 CONSTRUCTOR, |
| 3935 DYNAMIC, | 3115 DYNAMIC, |
| 3936 EMBEDDED_HTML_SCRIPT, | 3116 EMBEDDED_HTML_SCRIPT, |
| 3937 ERROR, | 3117 ERROR, |
| 3938 EXPORT, | 3118 EXPORT, |
| 3939 EXTERNAL_HTML_SCRIPT, | 3119 EXTERNAL_HTML_SCRIPT, |
| 3940 FIELD, | 3120 FIELD, |
| 3941 FUNCTION, | 3121 FUNCTION, |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4223 } | 3403 } |
| 4224 return false; | 3404 return false; |
| 4225 } | 3405 } |
| 4226 } | 3406 } |
| 4227 | 3407 |
| 4228 /** | 3408 /** |
| 4229 * The interface `ElementVisitor` defines the behavior of objects that can be us
ed to visit an | 3409 * The interface `ElementVisitor` defines the behavior of objects that can be us
ed to visit an |
| 4230 * element structure. | 3410 * element structure. |
| 4231 */ | 3411 */ |
| 4232 abstract class ElementVisitor<R> { | 3412 abstract class ElementVisitor<R> { |
| 4233 R visitAngularComponentElement(AngularComponentElement element); | |
| 4234 | |
| 4235 R visitAngularControllerElement(AngularControllerElement element); | |
| 4236 | |
| 4237 R visitAngularDirectiveElement(AngularDecoratorElement element); | |
| 4238 | |
| 4239 R visitAngularFormatterElement(AngularFormatterElement element); | |
| 4240 | |
| 4241 R visitAngularPropertyElement(AngularPropertyElement element); | |
| 4242 | |
| 4243 R visitAngularScopePropertyElement(AngularScopePropertyElement element); | |
| 4244 | |
| 4245 R visitAngularSelectorElement(AngularSelectorElement element); | |
| 4246 | |
| 4247 R visitAngularViewElement(AngularViewElement element); | |
| 4248 | |
| 4249 R visitClassElement(ClassElement element); | 3413 R visitClassElement(ClassElement element); |
| 4250 | 3414 |
| 4251 R visitCompilationUnitElement(CompilationUnitElement element); | 3415 R visitCompilationUnitElement(CompilationUnitElement element); |
| 4252 | 3416 |
| 4253 R visitConstructorElement(ConstructorElement element); | 3417 R visitConstructorElement(ConstructorElement element); |
| 4254 | 3418 |
| 4255 R visitEmbeddedHtmlScriptElement(EmbeddedHtmlScriptElement element); | 3419 R visitEmbeddedHtmlScriptElement(EmbeddedHtmlScriptElement element); |
| 4256 | 3420 |
| 4257 R visitExportElement(ExportElement element); | 3421 R visitExportElement(ExportElement element); |
| 4258 | 3422 |
| (...skipping 2072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6331 * FieldFormalParameterElement | 5495 * FieldFormalParameterElement |
| 6332 * </pre> | 5496 * </pre> |
| 6333 * | 5497 * |
| 6334 * Subclasses that override a visit method must either invoke the overridden vis
it method or | 5498 * Subclasses that override a visit method must either invoke the overridden vis
it method or |
| 6335 * explicitly invoke the more general visit method. Failure to do so will cause
the visit methods | 5499 * explicitly invoke the more general visit method. Failure to do so will cause
the visit methods |
| 6336 * for superclasses of the element to not be invoked and will cause the children
of the visited node | 5500 * for superclasses of the element to not be invoked and will cause the children
of the visited node |
| 6337 * to not be visited. | 5501 * to not be visited. |
| 6338 */ | 5502 */ |
| 6339 class GeneralizingElementVisitor<R> implements ElementVisitor<R> { | 5503 class GeneralizingElementVisitor<R> implements ElementVisitor<R> { |
| 6340 @override | 5504 @override |
| 6341 R visitAngularComponentElement(AngularComponentElement element) => | |
| 6342 visitAngularHasSelectorElement(element); | |
| 6343 | |
| 6344 @override | |
| 6345 R visitAngularControllerElement(AngularControllerElement element) => | |
| 6346 visitAngularHasSelectorElement(element); | |
| 6347 | |
| 6348 @override | |
| 6349 R visitAngularDirectiveElement(AngularDecoratorElement element) => | |
| 6350 visitAngularHasSelectorElement(element); | |
| 6351 | |
| 6352 R visitAngularElement(AngularElement element) => | |
| 6353 visitToolkitObjectElement(element); | |
| 6354 | |
| 6355 @override | |
| 6356 R visitAngularFormatterElement(AngularFormatterElement element) => | |
| 6357 visitAngularElement(element); | |
| 6358 | |
| 6359 R visitAngularHasSelectorElement(AngularHasSelectorElement element) => | |
| 6360 visitAngularElement(element); | |
| 6361 | |
| 6362 @override | |
| 6363 R visitAngularPropertyElement(AngularPropertyElement element) => | |
| 6364 visitAngularElement(element); | |
| 6365 | |
| 6366 @override | |
| 6367 R visitAngularScopePropertyElement(AngularScopePropertyElement element) => | |
| 6368 visitAngularElement(element); | |
| 6369 | |
| 6370 @override | |
| 6371 R visitAngularSelectorElement(AngularSelectorElement element) => | |
| 6372 visitAngularElement(element); | |
| 6373 | |
| 6374 @override | |
| 6375 R visitAngularViewElement(AngularViewElement element) => | |
| 6376 visitAngularElement(element); | |
| 6377 | |
| 6378 @override | |
| 6379 R visitClassElement(ClassElement element) => visitElement(element); | 5505 R visitClassElement(ClassElement element) => visitElement(element); |
| 6380 | 5506 |
| 6381 @override | 5507 @override |
| 6382 R visitCompilationUnitElement(CompilationUnitElement element) => | 5508 R visitCompilationUnitElement(CompilationUnitElement element) => |
| 6383 visitElement(element); | 5509 visitElement(element); |
| 6384 | 5510 |
| 6385 @override | 5511 @override |
| 6386 R visitConstructorElement(ConstructorElement element) => | 5512 R visitConstructorElement(ConstructorElement element) => |
| 6387 visitExecutableElement(element); | 5513 visitExecutableElement(element); |
| 6388 | 5514 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6493 visitPropertyInducingElement(element); | 5619 visitPropertyInducingElement(element); |
| 6494 | 5620 |
| 6495 @override | 5621 @override |
| 6496 R visitTypeParameterElement(TypeParameterElement element) => | 5622 R visitTypeParameterElement(TypeParameterElement element) => |
| 6497 visitElement(element); | 5623 visitElement(element); |
| 6498 | 5624 |
| 6499 R visitVariableElement(VariableElement element) => visitElement(element); | 5625 R visitVariableElement(VariableElement element) => visitElement(element); |
| 6500 } | 5626 } |
| 6501 | 5627 |
| 6502 /** | 5628 /** |
| 6503 * Implementation of [AngularSelectorElement] based on presence of attribute. | |
| 6504 */ | |
| 6505 class HasAttributeSelectorElementImpl extends AngularSelectorElementImpl | |
| 6506 implements AngularHasAttributeSelectorElement { | |
| 6507 HasAttributeSelectorElementImpl(String attributeName, int offset) | |
| 6508 : super(attributeName, offset); | |
| 6509 | |
| 6510 @override | |
| 6511 void appendTo(StringBuffer buffer) { | |
| 6512 buffer.write("["); | |
| 6513 buffer.write(name); | |
| 6514 buffer.write("]"); | |
| 6515 } | |
| 6516 | |
| 6517 @override | |
| 6518 bool apply(XmlTagNode node) { | |
| 6519 String attributeName = name; | |
| 6520 return node.getAttribute(attributeName) != null; | |
| 6521 } | |
| 6522 } | |
| 6523 | |
| 6524 /** | |
| 6525 * The interface `HideElementCombinator` defines the behavior of combinators tha
t cause some | 5629 * The interface `HideElementCombinator` defines the behavior of combinators tha
t cause some |
| 6526 * of the names in a namespace to be hidden when being imported. | 5630 * of the names in a namespace to be hidden when being imported. |
| 6527 */ | 5631 */ |
| 6528 abstract class HideElementCombinator implements NamespaceCombinator { | 5632 abstract class HideElementCombinator implements NamespaceCombinator { |
| 6529 /** | 5633 /** |
| 6530 * Return an array containing the names that are not to be made visible in the
importing library | 5634 * Return an array containing the names that are not to be made visible in the
importing library |
| 6531 * even if they are defined in the imported library. | 5635 * even if they are defined in the imported library. |
| 6532 * | 5636 * |
| 6533 * @return the names from the imported library that are hidden from the import
ing library | 5637 * @return the names from the imported library that are hidden from the import
ing library |
| 6534 */ | 5638 */ |
| (...skipping 24 matching lines...) Expand all Loading... |
| 6559 } | 5663 } |
| 6560 return buffer.toString(); | 5664 return buffer.toString(); |
| 6561 } | 5665 } |
| 6562 } | 5666 } |
| 6563 | 5667 |
| 6564 /** | 5668 /** |
| 6565 * The interface `HtmlElement` defines the behavior of elements representing an
HTML file. | 5669 * The interface `HtmlElement` defines the behavior of elements representing an
HTML file. |
| 6566 */ | 5670 */ |
| 6567 abstract class HtmlElement implements Element { | 5671 abstract class HtmlElement implements Element { |
| 6568 /** | 5672 /** |
| 6569 * Return the [CompilationUnitElement] associated with this Angular HTML file,
maybe | |
| 6570 * `null` if not an Angular file. | |
| 6571 */ | |
| 6572 CompilationUnitElement get angularCompilationUnit; | |
| 6573 | |
| 6574 /** | |
| 6575 * Return an array containing all of the [PolymerTagHtmlElement]s defined in t
he HTML file. | 5673 * Return an array containing all of the [PolymerTagHtmlElement]s defined in t
he HTML file. |
| 6576 * | 5674 * |
| 6577 * @return the [PolymerTagHtmlElement]s elements in the HTML file (not `null`, | 5675 * @return the [PolymerTagHtmlElement]s elements in the HTML file (not `null`, |
| 6578 * contains no `null`s) | 5676 * contains no `null`s) |
| 6579 */ | 5677 */ |
| 6580 List<PolymerTagHtmlElement> get polymerTags; | 5678 List<PolymerTagHtmlElement> get polymerTags; |
| 6581 | 5679 |
| 6582 /** | 5680 /** |
| 6583 * Return an array containing all of the script elements contained in the HTML
file. This includes | 5681 * Return an array containing all of the script elements contained in the HTML
file. This includes |
| 6584 * scripts with libraries that are defined by the content of a script tag as w
ell as libraries | 5682 * scripts with libraries that are defined by the content of a script tag as w
ell as libraries |
| (...skipping 27 matching lines...) Expand all Loading... |
| 6612 * The [PolymerTagHtmlElement]s defined in the HTML file. | 5710 * The [PolymerTagHtmlElement]s defined in the HTML file. |
| 6613 */ | 5711 */ |
| 6614 List<PolymerTagHtmlElement> _polymerTags = PolymerTagHtmlElement.EMPTY_ARRAY; | 5712 List<PolymerTagHtmlElement> _polymerTags = PolymerTagHtmlElement.EMPTY_ARRAY; |
| 6615 | 5713 |
| 6616 /** | 5714 /** |
| 6617 * The source that corresponds to this HTML file. | 5715 * The source that corresponds to this HTML file. |
| 6618 */ | 5716 */ |
| 6619 Source source; | 5717 Source source; |
| 6620 | 5718 |
| 6621 /** | 5719 /** |
| 6622 * The element associated with Dart pieces in this HTML unit or `null` if the
receiver is | |
| 6623 * not resolved. | |
| 6624 */ | |
| 6625 CompilationUnitElement angularCompilationUnit; | |
| 6626 | |
| 6627 /** | |
| 6628 * Initialize a newly created HTML element to have the given name. | 5720 * Initialize a newly created HTML element to have the given name. |
| 6629 * | 5721 * |
| 6630 * @param context the analysis context in which the HTML file is defined | 5722 * @param context the analysis context in which the HTML file is defined |
| 6631 * @param name the name of this element | 5723 * @param name the name of this element |
| 6632 */ | 5724 */ |
| 6633 HtmlElementImpl(this.context, String name) : super(name, -1); | 5725 HtmlElementImpl(this.context, String name) : super(name, -1); |
| 6634 | 5726 |
| 6635 @override | 5727 @override |
| 6636 int get hashCode => source.hashCode; | 5728 int get hashCode => source.hashCode; |
| 6637 | 5729 |
| (...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8068 */ | 7160 */ |
| 8069 static List<InterfaceType> _intersection(Set<InterfaceType> first, | 7161 static List<InterfaceType> _intersection(Set<InterfaceType> first, |
| 8070 Set<InterfaceType> second) { | 7162 Set<InterfaceType> second) { |
| 8071 Set<InterfaceType> result = new HashSet<InterfaceType>.from(first); | 7163 Set<InterfaceType> result = new HashSet<InterfaceType>.from(first); |
| 8072 result.retainAll(second); | 7164 result.retainAll(second); |
| 8073 return new List.from(result); | 7165 return new List.from(result); |
| 8074 } | 7166 } |
| 8075 } | 7167 } |
| 8076 | 7168 |
| 8077 /** | 7169 /** |
| 8078 * Combination of [AngularTagSelectorElementImpl] and [HasAttributeSelectorEleme
ntImpl]. | |
| 8079 */ | |
| 8080 class IsTagHasAttributeSelectorElementImpl extends AngularSelectorElementImpl { | |
| 8081 String _tagName; | |
| 8082 | |
| 8083 String _attributeName; | |
| 8084 | |
| 8085 IsTagHasAttributeSelectorElementImpl(String tagName, String attributeName) | |
| 8086 : super("$tagName[$attributeName]", -1) { | |
| 8087 this._tagName = tagName; | |
| 8088 this._attributeName = attributeName; | |
| 8089 } | |
| 8090 | |
| 8091 String get attributeName => _attributeName; | |
| 8092 | |
| 8093 String get tagName => _tagName; | |
| 8094 | |
| 8095 @override | |
| 8096 bool apply(XmlTagNode node) => | |
| 8097 node.tag == _tagName && node.getAttribute(_attributeName) != null; | |
| 8098 } | |
| 8099 | |
| 8100 /** | |
| 8101 * The interface `LabelElement` defines the behavior of elements representing a
label | 7170 * The interface `LabelElement` defines the behavior of elements representing a
label |
| 8102 * associated with a statement. | 7171 * associated with a statement. |
| 8103 */ | 7172 */ |
| 8104 abstract class LabelElement implements Element { | 7173 abstract class LabelElement implements Element { |
| 8105 /** | 7174 /** |
| 8106 * Return the executable element in which this label is defined. | 7175 * Return the executable element in which this label is defined. |
| 8107 * | 7176 * |
| 8108 * @return the executable element in which this label is defined | 7177 * @return the executable element in which this label is defined |
| 8109 */ | 7178 */ |
| 8110 @override | 7179 @override |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8226 List<LibraryElement> get importedLibraries; | 7295 List<LibraryElement> get importedLibraries; |
| 8227 | 7296 |
| 8228 /** | 7297 /** |
| 8229 * Return an array containing all of the imports defined in this library. | 7298 * Return an array containing all of the imports defined in this library. |
| 8230 * | 7299 * |
| 8231 * @return the imports defined in this library | 7300 * @return the imports defined in this library |
| 8232 */ | 7301 */ |
| 8233 List<ImportElement> get imports; | 7302 List<ImportElement> get imports; |
| 8234 | 7303 |
| 8235 /** | 7304 /** |
| 8236 * Return `true` if this library is created for Angular analysis. If this libr
ary has not | |
| 8237 * yet had toolkit references resolved, then `false` will be returned. | |
| 8238 * | |
| 8239 * @return `true` if this library is created for Angular analysis | |
| 8240 */ | |
| 8241 bool get isAngularHtml; | |
| 8242 | |
| 8243 /** | |
| 8244 * Return `true` if this library is an application that can be run in the brow
ser. | 7305 * Return `true` if this library is an application that can be run in the brow
ser. |
| 8245 * | 7306 * |
| 8246 * @return `true` if this library is an application that can be run in the bro
wser | 7307 * @return `true` if this library is an application that can be run in the bro
wser |
| 8247 */ | 7308 */ |
| 8248 bool get isBrowserApplication; | 7309 bool get isBrowserApplication; |
| 8249 | 7310 |
| 8250 /** | 7311 /** |
| 8251 * Return `true` if this library is the dart:core library. | 7312 * Return `true` if this library is the dart:core library. |
| 8252 * | 7313 * |
| 8253 * @return `true` if this library is the dart:core library | 7314 * @return `true` if this library is the dart:core library |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8360 */ | 7421 */ |
| 8361 List<ExportElement> _exports = ExportElement.EMPTY_ARRAY; | 7422 List<ExportElement> _exports = ExportElement.EMPTY_ARRAY; |
| 8362 | 7423 |
| 8363 /** | 7424 /** |
| 8364 * An array containing all of the compilation units that are included in this
library using a | 7425 * An array containing all of the compilation units that are included in this
library using a |
| 8365 * `part` directive. | 7426 * `part` directive. |
| 8366 */ | 7427 */ |
| 8367 List<CompilationUnitElement> _parts = CompilationUnitElementImpl.EMPTY_ARRAY; | 7428 List<CompilationUnitElement> _parts = CompilationUnitElementImpl.EMPTY_ARRAY; |
| 8368 | 7429 |
| 8369 /** | 7430 /** |
| 8370 * Is `true` if this library is created for Angular analysis. | |
| 8371 */ | |
| 8372 bool _isAngularHtml = false; | |
| 8373 | |
| 8374 /** | |
| 8375 * The element representing the synthetic function `loadLibrary` that is defin
ed for this | 7431 * The element representing the synthetic function `loadLibrary` that is defin
ed for this |
| 8376 * library, or `null` if the element has not yet been created. | 7432 * library, or `null` if the element has not yet been created. |
| 8377 */ | 7433 */ |
| 8378 FunctionElement _loadLibraryFunction; | 7434 FunctionElement _loadLibraryFunction; |
| 8379 | 7435 |
| 8380 /** | 7436 /** |
| 8381 * Initialize a newly created library element to have the given name. | 7437 * Initialize a newly created library element to have the given name. |
| 8382 * | 7438 * |
| 8383 * @param context the analysis context in which the library is defined | 7439 * @param context the analysis context in which the library is defined |
| 8384 * @param name the name of this element | 7440 * @param name the name of this element |
| 8385 * @param nameOffset the offset of the name of this element in the file that c
ontains the | 7441 * @param nameOffset the offset of the name of this element in the file that c
ontains the |
| 8386 * declaration of this element | 7442 * declaration of this element |
| 8387 */ | 7443 */ |
| 8388 LibraryElementImpl(this.context, String name, int nameOffset) | 7444 LibraryElementImpl(this.context, String name, int nameOffset) |
| 8389 : super(name, nameOffset); | 7445 : super(name, nameOffset); |
| 8390 | 7446 |
| 8391 /** | 7447 /** |
| 8392 * Initialize a newly created library element to have the given name. | 7448 * Initialize a newly created library element to have the given name. |
| 8393 * | 7449 * |
| 8394 * @param context the analysis context in which the library is defined | 7450 * @param context the analysis context in which the library is defined |
| 8395 * @param name the name of this element | 7451 * @param name the name of this element |
| 8396 */ | 7452 */ |
| 8397 LibraryElementImpl.forNode(this.context, LibraryIdentifier name) | 7453 LibraryElementImpl.forNode(this.context, LibraryIdentifier name) |
| 8398 : super.forNode(name); | 7454 : super.forNode(name); |
| 8399 | 7455 |
| 8400 /** | |
| 8401 * Specifies if this library is created for Angular analysis. | |
| 8402 */ | |
| 8403 void set angularHtml(bool isAngularHtml) { | |
| 8404 this._isAngularHtml = isAngularHtml; | |
| 8405 } | |
| 8406 | |
| 8407 @override | 7456 @override |
| 8408 CompilationUnitElement get definingCompilationUnit => | 7457 CompilationUnitElement get definingCompilationUnit => |
| 8409 _definingCompilationUnit; | 7458 _definingCompilationUnit; |
| 8410 | 7459 |
| 8411 /** | 7460 /** |
| 8412 * Set the compilation unit that defines this library to the given compilation
unit. | 7461 * Set the compilation unit that defines this library to the given compilation
unit. |
| 8413 * | 7462 * |
| 8414 * @param definingCompilationUnit the compilation unit that defines this libra
ry | 7463 * @param definingCompilationUnit the compilation unit that defines this libra
ry |
| 8415 */ | 7464 */ |
| 8416 void set | 7465 void set |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8503 (importElement as ImportElementImpl).enclosingElement = this; | 7552 (importElement as ImportElementImpl).enclosingElement = this; |
| 8504 PrefixElementImpl prefix = importElement.prefix as PrefixElementImpl; | 7553 PrefixElementImpl prefix = importElement.prefix as PrefixElementImpl; |
| 8505 if (prefix != null) { | 7554 if (prefix != null) { |
| 8506 prefix.enclosingElement = this; | 7555 prefix.enclosingElement = this; |
| 8507 } | 7556 } |
| 8508 } | 7557 } |
| 8509 this._imports = imports; | 7558 this._imports = imports; |
| 8510 } | 7559 } |
| 8511 | 7560 |
| 8512 @override | 7561 @override |
| 8513 bool get isAngularHtml => _isAngularHtml; | |
| 8514 | |
| 8515 @override | |
| 8516 bool get isBrowserApplication => | 7562 bool get isBrowserApplication => |
| 8517 entryPoint != null && isOrImportsBrowserLibrary; | 7563 entryPoint != null && isOrImportsBrowserLibrary; |
| 8518 | 7564 |
| 8519 @override | 7565 @override |
| 8520 bool get isDartCore => name == "dart.core"; | 7566 bool get isDartCore => name == "dart.core"; |
| 8521 | 7567 |
| 8522 @override | 7568 @override |
| 8523 bool get isInSdk => | 7569 bool get isInSdk => |
| 8524 StringUtilities.startsWith5(name, 0, 0x64, 0x61, 0x72, 0x74, 0x2E); | 7570 StringUtilities.startsWith5(name, 0, 0x64, 0x61, 0x72, 0x74, 0x2E); |
| 8525 | 7571 |
| (...skipping 2442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10968 * recursively visit all of the element in an element model. For example, using
an instance of this | 10014 * recursively visit all of the element in an element model. For example, using
an instance of this |
| 10969 * class to visit a [CompilationUnitElement] will also cause all of the types in
the | 10015 * class to visit a [CompilationUnitElement] will also cause all of the types in
the |
| 10970 * compilation unit to be visited. | 10016 * compilation unit to be visited. |
| 10971 * | 10017 * |
| 10972 * Subclasses that override a visit method must either invoke the overridden vis
it method or must | 10018 * Subclasses that override a visit method must either invoke the overridden vis
it method or must |
| 10973 * explicitly ask the visited element to visit its children. Failure to do so wi
ll cause the | 10019 * explicitly ask the visited element to visit its children. Failure to do so wi
ll cause the |
| 10974 * children of the visited element to not be visited. | 10020 * children of the visited element to not be visited. |
| 10975 */ | 10021 */ |
| 10976 class RecursiveElementVisitor<R> implements ElementVisitor<R> { | 10022 class RecursiveElementVisitor<R> implements ElementVisitor<R> { |
| 10977 @override | 10023 @override |
| 10978 R visitAngularComponentElement(AngularComponentElement element) { | |
| 10979 element.visitChildren(this); | |
| 10980 return null; | |
| 10981 } | |
| 10982 | |
| 10983 @override | |
| 10984 R visitAngularControllerElement(AngularControllerElement element) { | |
| 10985 element.visitChildren(this); | |
| 10986 return null; | |
| 10987 } | |
| 10988 | |
| 10989 @override | |
| 10990 R visitAngularDirectiveElement(AngularDecoratorElement element) { | |
| 10991 element.visitChildren(this); | |
| 10992 return null; | |
| 10993 } | |
| 10994 | |
| 10995 @override | |
| 10996 R visitAngularFormatterElement(AngularFormatterElement element) { | |
| 10997 element.visitChildren(this); | |
| 10998 return null; | |
| 10999 } | |
| 11000 | |
| 11001 @override | |
| 11002 R visitAngularPropertyElement(AngularPropertyElement element) { | |
| 11003 element.visitChildren(this); | |
| 11004 return null; | |
| 11005 } | |
| 11006 | |
| 11007 @override | |
| 11008 R visitAngularScopePropertyElement(AngularScopePropertyElement element) { | |
| 11009 element.visitChildren(this); | |
| 11010 return null; | |
| 11011 } | |
| 11012 | |
| 11013 @override | |
| 11014 R visitAngularSelectorElement(AngularSelectorElement element) { | |
| 11015 element.visitChildren(this); | |
| 11016 return null; | |
| 11017 } | |
| 11018 | |
| 11019 @override | |
| 11020 R visitAngularViewElement(AngularViewElement element) { | |
| 11021 element.visitChildren(this); | |
| 11022 return null; | |
| 11023 } | |
| 11024 | |
| 11025 @override | |
| 11026 R visitClassElement(ClassElement element) { | 10024 R visitClassElement(ClassElement element) { |
| 11027 element.visitChildren(this); | 10025 element.visitChildren(this); |
| 11028 return null; | 10026 return null; |
| 11029 } | 10027 } |
| 11030 | 10028 |
| 11031 @override | 10029 @override |
| 11032 R visitCompilationUnitElement(CompilationUnitElement element) { | 10030 R visitCompilationUnitElement(CompilationUnitElement element) { |
| 11033 element.visitChildren(this); | 10031 element.visitChildren(this); |
| 11034 return null; | 10032 return null; |
| 11035 } | 10033 } |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11238 } | 10236 } |
| 11239 | 10237 |
| 11240 /** | 10238 /** |
| 11241 * Instances of the class `SimpleElementVisitor` implement an element visitor th
at will do | 10239 * Instances of the class `SimpleElementVisitor` implement an element visitor th
at will do |
| 11242 * nothing when visiting an element. It is intended to be a superclass for class
es that use the | 10240 * nothing when visiting an element. It is intended to be a superclass for class
es that use the |
| 11243 * visitor pattern primarily as a dispatch mechanism (and hence don't need to re
cursively visit a | 10241 * visitor pattern primarily as a dispatch mechanism (and hence don't need to re
cursively visit a |
| 11244 * whole structure) and that only need to visit a small number of element types. | 10242 * whole structure) and that only need to visit a small number of element types. |
| 11245 */ | 10243 */ |
| 11246 class SimpleElementVisitor<R> implements ElementVisitor<R> { | 10244 class SimpleElementVisitor<R> implements ElementVisitor<R> { |
| 11247 @override | 10245 @override |
| 11248 R visitAngularComponentElement(AngularComponentElement element) => null; | |
| 11249 | |
| 11250 @override | |
| 11251 R visitAngularControllerElement(AngularControllerElement element) => null; | |
| 11252 | |
| 11253 @override | |
| 11254 R visitAngularDirectiveElement(AngularDecoratorElement element) => null; | |
| 11255 | |
| 11256 @override | |
| 11257 R visitAngularFormatterElement(AngularFormatterElement element) => null; | |
| 11258 | |
| 11259 @override | |
| 11260 R visitAngularPropertyElement(AngularPropertyElement element) => null; | |
| 11261 | |
| 11262 @override | |
| 11263 R visitAngularScopePropertyElement(AngularScopePropertyElement element) => | |
| 11264 null; | |
| 11265 | |
| 11266 @override | |
| 11267 R visitAngularSelectorElement(AngularSelectorElement element) => null; | |
| 11268 | |
| 11269 @override | |
| 11270 R visitAngularViewElement(AngularViewElement element) => null; | |
| 11271 | |
| 11272 @override | |
| 11273 R visitClassElement(ClassElement element) => null; | 10246 R visitClassElement(ClassElement element) => null; |
| 11274 | 10247 |
| 11275 @override | 10248 @override |
| 11276 R visitCompilationUnitElement(CompilationUnitElement element) => null; | 10249 R visitCompilationUnitElement(CompilationUnitElement element) => null; |
| 11277 | 10250 |
| 11278 @override | 10251 @override |
| 11279 R visitConstructorElement(ConstructorElement element) => null; | 10252 R visitConstructorElement(ConstructorElement element) => null; |
| 11280 | 10253 |
| 11281 @override | 10254 @override |
| 11282 R visitEmbeddedHtmlScriptElement(EmbeddedHtmlScriptElement element) => null; | 10255 R visitEmbeddedHtmlScriptElement(EmbeddedHtmlScriptElement element) => null; |
| (...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12606 // bottom <: void (as bottom is a subtype of all types). | 11579 // bottom <: void (as bottom is a subtype of all types). |
| 12607 // void <: dynamic (as dynamic is a supertype of all types) | 11580 // void <: dynamic (as dynamic is a supertype of all types) |
| 12608 return identical(type, this) || type.isDynamic; | 11581 return identical(type, this) || type.isDynamic; |
| 12609 } | 11582 } |
| 12610 | 11583 |
| 12611 @override | 11584 @override |
| 12612 VoidTypeImpl substitute2(List<DartType> argumentTypes, | 11585 VoidTypeImpl substitute2(List<DartType> argumentTypes, |
| 12613 List<DartType> parameterTypes) => | 11586 List<DartType> parameterTypes) => |
| 12614 this; | 11587 this; |
| 12615 } | 11588 } |
| OLD | NEW |