| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
| 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. | |
| 4 | |
| 5 /** | |
| 6 * Summary information for components and libraries. | |
| 7 * | |
| 8 * These classes are used for modular compilation. Summaries are a subset of the | |
| 9 * information collected by Info objects (see `info.dart`). When we are | |
| 10 * compiling a single file, the information extracted from that file is stored | |
| 11 * as info objects, but any information that is needed from other files (like | |
| 12 * imported components) is stored as a summary. | |
| 13 */ | |
| 14 library polymer.src.summary; | |
| 15 | |
| 16 import 'package:source_maps/span.dart' show Span; | |
| 17 | |
| 18 // TODO(sigmund): consider moving UrlInfo out of info.dart | |
| 19 import 'info.dart' show UrlInfo; | |
| 20 | |
| 21 /** | |
| 22 * Summary information from other library-like objects, which includes HTML | |
| 23 * components and dart libraries). | |
| 24 */ | |
| 25 class LibrarySummary { | |
| 26 /** Path to the sources represented by this summary. */ | |
| 27 final UrlInfo dartCodeUrl; | |
| 28 | |
| 29 /** Name given to this source after it was compiled. */ | |
| 30 final String outputFilename; | |
| 31 | |
| 32 LibrarySummary(this.dartCodeUrl, this.outputFilename); | |
| 33 } | |
| 34 | |
| 35 /** Summary information for an HTML file that defines custom elements. */ | |
| 36 class HtmlFileSummary extends LibrarySummary { | |
| 37 /** | |
| 38 * Summary of each component defined either explicitly the HTML file or | |
| 39 * included transitively from `<link rel="import">` tags. | |
| 40 */ | |
| 41 final Map<String, ComponentSummary> components; | |
| 42 | |
| 43 HtmlFileSummary(UrlInfo dartCodeUrl, String outputFilename, this.components) | |
| 44 : super(dartCodeUrl, outputFilename); | |
| 45 } | |
| 46 | |
| 47 /** Information about a web component definition. */ | |
| 48 class ComponentSummary extends LibrarySummary { | |
| 49 /** The component tag name, defined with the `name` attribute on `element`. */ | |
| 50 final String tagName; | |
| 51 | |
| 52 /** | |
| 53 * The tag name that this component extends, defined with the `extends` | |
| 54 * attribute on `element`. | |
| 55 */ | |
| 56 final String extendsTag; | |
| 57 | |
| 58 /** | |
| 59 * The Dart class containing the component's behavior, derived from tagName or | |
| 60 * defined in the `constructor` attribute on `element`. | |
| 61 */ | |
| 62 final String className; | |
| 63 | |
| 64 /** Summary of the base component, if any. */ | |
| 65 final ComponentSummary extendsComponent; | |
| 66 | |
| 67 /** | |
| 68 * True if [tagName] was defined by more than one component. Used internally | |
| 69 * by the analyzer. Conflicting component will be skipped by the compiler. | |
| 70 */ | |
| 71 bool hasConflict; | |
| 72 | |
| 73 /** Original span where this component is declared. */ | |
| 74 final Span sourceSpan; | |
| 75 | |
| 76 ComponentSummary(UrlInfo dartCodeUrl, String outputFilename, | |
| 77 this.tagName, this.extendsTag, this.className, this.extendsComponent, | |
| 78 this.sourceSpan, [this.hasConflict = false]) | |
| 79 : super(dartCodeUrl, outputFilename); | |
| 80 | |
| 81 /** | |
| 82 * Gets the HTML tag extended by the base of the component hierarchy. | |
| 83 * Equivalent to [extendsTag] if this inherits directly from an HTML element, | |
| 84 * in other words, if [extendsComponent] is null. | |
| 85 */ | |
| 86 String get baseExtendsTag => | |
| 87 extendsComponent == null ? extendsTag : extendsComponent.baseExtendsTag; | |
| 88 } | |
| OLD | NEW |