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

Unified Diff: pkg/compiler/lib/src/js_emitter/metadata_collector.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_emitter/metadata_collector.dart
diff --git a/pkg/compiler/lib/src/js_emitter/metadata_collector.dart b/pkg/compiler/lib/src/js_emitter/metadata_collector.dart
index 8ffda2434c8a0571d7665342fcdd2e98754ea418..af554558ebedc39e5efd908eae704929202b8ddb 100644
--- a/pkg/compiler/lib/src/js_emitter/metadata_collector.dart
+++ b/pkg/compiler/lib/src/js_emitter/metadata_collector.dart
@@ -161,18 +161,13 @@ class MetadataCollector implements jsAst.TokenFinalizer {
if (!_mustEmitMetadataFor(element)) return null;
return _compiler.withCurrentElement(element, () {
List<jsAst.Expression> metadata = <jsAst.Expression>[];
- Link link = element.metadata;
- // TODO(ahe): Why is metadata sometimes null?
- if (link != null) {
- for (; !link.isEmpty; link = link.tail) {
- MetadataAnnotation annotation = link.head;
- ConstantValue constant =
- _backend.constants.getConstantValueForMetadata(annotation);
- if (constant == null) {
- _compiler.internalError(annotation, 'Annotation value is null.');
- } else {
- metadata.add(_emitter.constantReference(constant));
- }
+ for (MetadataAnnotation annotation in element.metadata) {
+ ConstantValue constant =
+ _backend.constants.getConstantValueForMetadata(annotation);
+ if (constant == null) {
+ _compiler.internalError(annotation, 'Annotation value is null.');
+ } else {
+ metadata.add(_emitter.constantReference(constant));
}
}
if (metadata.isEmpty) return null;
@@ -289,12 +284,8 @@ class MetadataCollector implements jsAst.TokenFinalizer {
return _compiler.withCurrentElement(element, () {
if (!_mustEmitMetadataFor(element)) return const <jsAst.DeferredNumber>[];
List<jsAst.DeferredNumber> metadata = <jsAst.DeferredNumber>[];
- Link link = element.metadata;
- // TODO(ahe): Why is metadata sometimes null?
- if (link != null) {
- for (; !link.isEmpty; link = link.tail) {
- metadata.add(reifyMetadata(link.head));
- }
+ for (MetadataAnnotation annotation in element.metadata) {
+ metadata.add(reifyMetadata(annotation));
}
return metadata;
});

Powered by Google App Engine
This is Rietveld 408576698