| 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 // Parse [PartialClassElement] using a "patch"-aware parser instead | 186 // Parse [PartialClassElement] using a "patch"-aware parser instead |
| 187 // of calling its [parseNode] method. | 187 // of calling its [parseNode] method. |
| 188 if (cls.cachedNode != null) return; | 188 if (cls.cachedNode != null) return; |
| 189 | 189 |
| 190 measure(() => compiler.withCurrentElement(cls, () { | 190 measure(() => compiler.withCurrentElement(cls, () { |
| 191 MemberListener listener = new PatchMemberListener(compiler, cls); | 191 MemberListener listener = new PatchMemberListener(compiler, cls); |
| 192 Parser parser = new PatchClassElementParser(listener); | 192 Parser parser = new PatchClassElementParser(listener); |
| 193 try { | 193 try { |
| 194 Token token = parser.parseTopLevelDeclaration(cls.beginToken); | 194 Token token = parser.parseTopLevelDeclaration(cls.beginToken); |
| 195 assert(identical(token, cls.endToken.next)); | 195 assert(identical(token, cls.endToken.next)); |
| 196 } on ParserError catch (e, s) { | 196 } on ParserError catch (e) { |
| 197 // No need to recover from a parser error in platform libraries, user | 197 // No need to recover from a parser error in platform libraries, user |
| 198 // will never see this if the libraries are tested correctly. | 198 // will never see this if the libraries are tested correctly. |
| 199 compiler.internalError( | 199 compiler.internalError( |
| 200 cls, "Parser error in patch file: $e"); | 200 cls, "Parser error in patch file: $e"); |
| 201 } | 201 } |
| 202 cls.cachedNode = listener.popNode(); | 202 cls.cachedNode = listener.popNode(); |
| 203 assert(listener.nodes.isEmpty); | 203 assert(listener.nodes.isEmpty); |
| 204 })); | 204 })); |
| 205 } | 205 } |
| 206 } | 206 } |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 } | 563 } |
| 564 | 564 |
| 565 class PatchVersion { | 565 class PatchVersion { |
| 566 final String tag; | 566 final String tag; |
| 567 | 567 |
| 568 const PatchVersion(this.tag); | 568 const PatchVersion(this.tag); |
| 569 | 569 |
| 570 bool isActive(String patchTag) => tag == null || tag == patchTag; | 570 bool isActive(String patchTag) => tag == null || tag == patchTag; |
| 571 | 571 |
| 572 String toString() => 'PatchVersion($tag)'; | 572 String toString() => 'PatchVersion($tag)'; |
| 573 } | 573 } |
| OLD | NEW |