Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: sdk/lib/_internal/compiler/implementation/patch_parser.dart

Issue 574683002: Use ConstExp for storing constants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 EagerAnnotationHandler handler) { 321 EagerAnnotationHandler handler) {
322 for (Link<MetadataAnnotation> link = element.metadata; 322 for (Link<MetadataAnnotation> link = element.metadata;
323 !link.isEmpty; 323 !link.isEmpty;
324 link = link.tail) { 324 link = link.tail) {
325 MetadataAnnotation annotation = link.head; 325 MetadataAnnotation annotation = link.head;
326 if (handler.apply(compiler, element, annotation)) { 326 if (handler.apply(compiler, element, annotation)) {
327 // TODO(johnniwinther): Perform this check in 327 // TODO(johnniwinther): Perform this check in
328 // [Compiler.onLibrariesLoaded]. 328 // [Compiler.onLibrariesLoaded].
329 compiler.enqueuer.resolution.addDeferredAction(element, () { 329 compiler.enqueuer.resolution.addDeferredAction(element, () {
330 annotation.ensureResolved(compiler); 330 annotation.ensureResolved(compiler);
331 handler.validate(compiler, element, annotation, annotation.value); 331 handler.validate(
332 compiler, element, annotation, annotation.constant.value);
332 }); 333 });
333 return true; 334 return true;
334 } 335 }
335 } 336 }
336 return false; 337 return false;
337 } 338 }
338 } 339 }
339 340
340 /// Annotation handler for pre-resolution detection of `@Native(...)` 341 /// Annotation handler for pre-resolution detection of `@Native(...)`
341 /// annotations. 342 /// annotations.
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 "Trying to patch a function more than once."); 498 "Trying to patch a function more than once.");
498 } 499 }
499 origin.applyPatch(patch); 500 origin.applyPatch(patch);
500 } 501 }
501 502
502 // TODO(johnniwinther): Add unittest when patch is (real) metadata. 503 // TODO(johnniwinther): Add unittest when patch is (real) metadata.
503 bool isPatchElement(leg.Compiler compiler, Element element) { 504 bool isPatchElement(leg.Compiler compiler, Element element) {
504 return EagerAnnotationHandler.checkAnnotation(compiler, element, 505 return EagerAnnotationHandler.checkAnnotation(compiler, element,
505 const PatchAnnotationHandler()); 506 const PatchAnnotationHandler());
506 } 507 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698