| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 * invariants are stated in the field comments. | 105 * invariants are stated in the field comments. |
| 106 * - [tree.TreeElements] only map to patch elements from inside a patch library. | 106 * - [tree.TreeElements] only map to patch elements from inside a patch library. |
| 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 dart2js.patchparser; |
| 116 | 116 |
| 117 import 'dart:async'; | 117 import 'dart:async'; |
| 118 | 118 |
| 119 import 'constants/values.dart' show | 119 import 'constants/values.dart' show |
| 120 ConstantValue; | 120 ConstantValue; |
| 121 import 'compiler.dart' show | 121 import 'compiler.dart' show |
| 122 Compiler; | 122 Compiler; |
| 123 import 'common/tasks.dart' show | 123 import 'common/tasks.dart' show |
| 124 CompilerTask; | 124 CompilerTask; |
| 125 import 'diagnostics/diagnostic_listener.dart'; | 125 import 'diagnostics/diagnostic_listener.dart'; |
| 126 import 'diagnostics/messages.dart' show | 126 import 'diagnostics/messages.dart' show |
| 127 MessageKind; | 127 MessageKind; |
| 128 import 'elements/elements.dart'; | 128 import 'elements/elements.dart'; |
| 129 import 'elements/modelx.dart' show | 129 import 'elements/modelx.dart' show |
| 130 BaseFunctionElementX, | 130 BaseFunctionElementX, |
| 131 ClassElementX, | 131 ClassElementX, |
| 132 GetterElementX, | 132 GetterElementX, |
| 133 LibraryElementX, | 133 LibraryElementX, |
| 134 MetadataAnnotationX, | 134 MetadataAnnotationX, |
| 135 SetterElementX; | 135 SetterElementX; |
| 136 import 'library_loader.dart' show | 136 import 'library_loader.dart' show |
| 137 LibraryLoader; | 137 LibraryLoader; |
| 138 import 'scanner/scannerlib.dart'; // Scanner, Parsers, Listeners | 138 import 'scanner/class_element_parser.dart' show |
| 139 MemberListener, |
| 140 PartialClassElement; |
| 141 import 'scanner/listener.dart' show |
| 142 ElementListener, |
| 143 Listener, |
| 144 ParserError; |
| 145 import 'scanner/partial_parser.dart' show |
| 146 PartialParser; |
| 147 import 'scanner/parser.dart' show |
| 148 Parser; |
| 149 import 'scanner/scanner.dart' show |
| 150 Scanner; |
| 151 import 'scanner/token.dart' show |
| 152 StringToken, |
| 153 Token; |
| 139 import 'script.dart'; | 154 import 'script.dart'; |
| 140 import 'util/util.dart'; | 155 import 'util/util.dart'; |
| 141 | 156 |
| 142 class PatchParserTask extends CompilerTask { | 157 class PatchParserTask extends CompilerTask { |
| 143 final String name = "Patching Parser"; | 158 final String name = "Patching Parser"; |
| 144 | 159 |
| 145 PatchParserTask(Compiler compiler): super(compiler); | 160 PatchParserTask(Compiler compiler): super(compiler); |
| 146 | 161 |
| 147 /** | 162 /** |
| 148 * Scans a library patch file, applies the method patches and | 163 * Scans a library patch file, applies the method patches and |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 | 589 |
| 575 class PatchVersion { | 590 class PatchVersion { |
| 576 final String tag; | 591 final String tag; |
| 577 | 592 |
| 578 const PatchVersion(this.tag); | 593 const PatchVersion(this.tag); |
| 579 | 594 |
| 580 bool isActive(String patchTag) => tag == null || tag == patchTag; | 595 bool isActive(String patchTag) => tag == null || tag == patchTag; |
| 581 | 596 |
| 582 String toString() => 'PatchVersion($tag)'; | 597 String toString() => 'PatchVersion($tag)'; |
| 583 } | 598 } |
| OLD | NEW |