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

Unified Diff: pkg/compiler/lib/src/js_backend/backend.dart

Issue 1302333006: Support metadata on patches. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Remove partial renaming Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/js_backend/backend.dart
diff --git a/pkg/compiler/lib/src/js_backend/backend.dart b/pkg/compiler/lib/src/js_backend/backend.dart
index e0311003aa1ea7cc2d8f6b729899b67a1b3e0e45..fbcbb0f49d601ea04a8f45557114bdc9e1c390ff 100644
--- a/pkg/compiler/lib/src/js_backend/backend.dart
+++ b/pkg/compiler/lib/src/js_backend/backend.dart
@@ -2313,8 +2313,7 @@ class JavaScriptBackend extends Backend {
*/
bool matchesMirrorsMetaTarget(Element element) {
if (metaTargetsUsed.isEmpty) return false;
- for (Link link = element.metadata; !link.isEmpty; link = link.tail) {
- MetadataAnnotation metadata = link.head;
+ for (MetadataAnnotation metadata in element.metadata) {
// TODO(kasperl): It would be nice if we didn't have to resolve
// all metadata but only stuff that potentially would match one
// of the used meta targets.
@@ -2625,7 +2624,7 @@ class JavaScriptBackend extends Backend {
bool hasForceInline = false;
bool hasNoThrows = false;
bool hasNoSideEffects = false;
- for (MetadataAnnotation metadata in element.metadata) {
+ for (MetadataAnnotation metadata in element.implementation.metadata) {
metadata.ensureResolved(compiler);
ConstantValue constantValue =
compiler.constants.getConstantValue(metadata.constant);
@@ -2894,19 +2893,21 @@ class Annotations {
/// Returns `true` if [element] is annotated with [annotationClass].
bool _hasAnnotation(Element element, ClassElement annotationClass) {
if (annotationClass == null) return false;
- for (Link<MetadataAnnotation> link = element.metadata;
- !link.isEmpty;
- link = link.tail) {
- ConstantValue value =
- compiler.constants.getConstantValue(link.head.constant);
- if (value.isConstructedObject) {
- ConstructedConstantValue constructedConstant = value;
- if (constructedConstant.type.element == annotationClass) {
- return true;
+ return compiler.withCurrentElement(element, () {
+ for (MetadataAnnotation metadata in element.metadata) {
+ assert(invariant(metadata, metadata.constant != null,
+ message: "Unevaluated metadata constant."));
+ ConstantValue value =
+ compiler.constants.getConstantValue(metadata.constant);
+ if (value.isConstructedObject) {
+ ConstructedConstantValue constructedConstant = value;
+ if (constructedConstant.type.element == annotationClass) {
+ return true;
+ }
}
}
- }
- return false;
+ return false;
+ });
}
}

Powered by Google App Engine
This is Rietveld 408576698