OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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 /** | 5 /** |
6 * This library contains the infrastructure to parse and integrate patch files. | 6 * This library contains the infrastructure to parse and integrate patch files. |
7 * | 7 * |
8 * Three types of elements can be patched: [LibraryElement], [ClassElement], | 8 * Three types of elements can be patched: [LibraryElement], [ClassElement], |
9 * [FunctionElement]. Patches are introduced in patch libraries which are loaded | 9 * [FunctionElement]. Patches are introduced in patch libraries which are loaded |
10 * together with the corresponding origin library. Which libraries that are | 10 * together with the corresponding origin library. Which libraries that are |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 * TODO(johnniwinther): Simplify this invariant to use only declarations in | 107 * TODO(johnniwinther): Simplify this invariant to use only declarations in |
108 * [tree.TreeElements]. | 108 * [tree.TreeElements]. |
109 * - Builders shift between declaration and implementation depending on usages. | 109 * - Builders shift between declaration and implementation depending on usages. |
110 * - Compile-time constants use constructor implementation exclusively. | 110 * - Compile-time constants use constructor implementation exclusively. |
111 * - Work on function parameters is performed on the declaration of the function | 111 * - Work on function parameters is performed on the declaration of the function |
112 * element. | 112 * element. |
113 */ | 113 */ |
114 | 114 |
115 library patchparser; | 115 library patchparser; |
116 | 116 |
117 import "dart:uri"; | |
118 import "tree/tree.dart" as tree; | 117 import "tree/tree.dart" as tree; |
119 import "dart2jslib.dart" as leg; // CompilerTask, Compiler. | 118 import "dart2jslib.dart" as leg; // CompilerTask, Compiler. |
120 import "apiimpl.dart"; | 119 import "apiimpl.dart"; |
121 import "../compiler.dart" as api; | 120 import "../compiler.dart" as api; |
122 import "scanner/scannerlib.dart"; // Scanner, Parsers, Listeners | 121 import "scanner/scannerlib.dart"; // Scanner, Parsers, Listeners |
123 import "elements/elements.dart"; | 122 import "elements/elements.dart"; |
124 import "elements/modelx.dart" show LibraryElementX, MetadataAnnotationX; | 123 import "elements/modelx.dart" show LibraryElementX, MetadataAnnotationX; |
125 import 'util/util.dart'; | 124 import 'util/util.dart'; |
126 | 125 |
127 class PatchParserTask extends leg.CompilerTask { | 126 class PatchParserTask extends leg.CompilerTask { |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 | 586 |
588 // TODO(johnniwinther): Add unittest when patch is (real) metadata. | 587 // TODO(johnniwinther): Add unittest when patch is (real) metadata. |
589 bool isPatchElement(Element element) { | 588 bool isPatchElement(Element element) { |
590 // TODO(lrn): More checks needed if we introduce metadata for real. | 589 // TODO(lrn): More checks needed if we introduce metadata for real. |
591 // In that case, it must have the identifier "native" as metadata. | 590 // In that case, it must have the identifier "native" as metadata. |
592 for (Link link = element.metadata; !link.isEmpty; link = link.tail) { | 591 for (Link link = element.metadata; !link.isEmpty; link = link.tail) { |
593 if (link.head is PatchMetadataAnnotation) return true; | 592 if (link.head is PatchMetadataAnnotation) return true; |
594 } | 593 } |
595 return false; | 594 return false; |
596 } | 595 } |
OLD | NEW |