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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 assert(listener.nodes.isEmpty); | 209 assert(listener.nodes.isEmpty); |
210 })); | 210 })); |
211 } | 211 } |
212 } | 212 } |
213 | 213 |
214 class PatchMemberListener extends MemberListener { | 214 class PatchMemberListener extends MemberListener { |
215 final Compiler compiler; | 215 final Compiler compiler; |
216 | 216 |
217 PatchMemberListener(Compiler compiler, ClassElement enclosingClass) | 217 PatchMemberListener(Compiler compiler, ClassElement enclosingClass) |
218 : this.compiler = compiler, | 218 : this.compiler = compiler, |
219 super(compiler.parsing.getScannerOptionsFor(enclosingClass), | 219 super(compiler.parsingContext.getScannerOptionsFor(enclosingClass), |
220 compiler.reporter, enclosingClass); | 220 compiler.reporter, enclosingClass); |
221 | 221 |
222 @override | 222 @override |
223 void addMember(Element patch) { | 223 void addMember(Element patch) { |
224 addMetadata(patch); | 224 addMetadata(patch); |
225 | 225 |
226 PatchVersion patchVersion = getPatchVersion(compiler, patch); | 226 PatchVersion patchVersion = getPatchVersion(compiler, patch); |
227 if (patchVersion != null) { | 227 if (patchVersion != null) { |
228 if (patchVersion.isActive(compiler.patchVersion)) { | 228 if (patchVersion.isActive(compiler.patchVersion)) { |
229 Element origin = enclosingClass.origin.localLookup(patch.name); | 229 Element origin = enclosingClass.origin.localLookup(patch.name); |
(...skipping 24 matching lines...) Expand all Loading... |
254 | 254 |
255 /** | 255 /** |
256 * Extension of [ElementListener] for parsing patch files. | 256 * Extension of [ElementListener] for parsing patch files. |
257 */ | 257 */ |
258 class PatchElementListener extends ElementListener implements Listener { | 258 class PatchElementListener extends ElementListener implements Listener { |
259 final Compiler compiler; | 259 final Compiler compiler; |
260 | 260 |
261 PatchElementListener(Compiler compiler, CompilationUnitElement patchElement, | 261 PatchElementListener(Compiler compiler, CompilationUnitElement patchElement, |
262 IdGenerator idGenerator) | 262 IdGenerator idGenerator) |
263 : this.compiler = compiler, | 263 : this.compiler = compiler, |
264 super(compiler.parsing.getScannerOptionsFor(patchElement), | 264 super(compiler.parsingContext.getScannerOptionsFor(patchElement), |
265 compiler.reporter, patchElement, idGenerator); | 265 compiler.reporter, patchElement, idGenerator); |
266 | 266 |
267 @override | 267 @override |
268 void pushElement(Element patch) { | 268 void pushElement(Element patch) { |
269 popMetadata(patch); | 269 popMetadata(patch); |
270 | 270 |
271 PatchVersion patchVersion = getPatchVersion(compiler, patch); | 271 PatchVersion patchVersion = getPatchVersion(compiler, patch); |
272 if (patchVersion != null) { | 272 if (patchVersion != null) { |
273 if (patchVersion.isActive(compiler.patchVersion)) { | 273 if (patchVersion.isActive(compiler.patchVersion)) { |
274 LibraryElement originLibrary = compilationUnitElement.library; | 274 LibraryElement originLibrary = compilationUnitElement.library; |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 | 611 |
612 class PatchVersion { | 612 class PatchVersion { |
613 final String tag; | 613 final String tag; |
614 | 614 |
615 const PatchVersion(this.tag); | 615 const PatchVersion(this.tag); |
616 | 616 |
617 bool isActive(String patchTag) => tag == null || tag == patchTag; | 617 bool isActive(String patchTag) => tag == null || tag == patchTag; |
618 | 618 |
619 String toString() => 'PatchVersion($tag)'; | 619 String toString() => 'PatchVersion($tag)'; |
620 } | 620 } |
OLD | NEW |