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

Unified Diff: compiler/java/com/google/dart/compiler/parser/DartParser.java

Issue 11415065: Issue 6770. Support for @deprecated on library directive. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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: compiler/java/com/google/dart/compiler/parser/DartParser.java
diff --git a/compiler/java/com/google/dart/compiler/parser/DartParser.java b/compiler/java/com/google/dart/compiler/parser/DartParser.java
index 7537e4389a49532d5461013bbb9b433157e9e27b..9e3c5df7362dc53345c3e69acb697bc208af7ec3 100644
--- a/compiler/java/com/google/dart/compiler/parser/DartParser.java
+++ b/compiler/java/com/google/dart/compiler/parser/DartParser.java
@@ -96,6 +96,7 @@ import com.google.dart.compiler.ast.DartUnqualifiedInvocation;
import com.google.dart.compiler.ast.DartVariable;
import com.google.dart.compiler.ast.DartVariableStatement;
import com.google.dart.compiler.ast.DartWhileStatement;
+import com.google.dart.compiler.ast.HasObsoleteMetadata;
import com.google.dart.compiler.ast.ImportCombinator;
import com.google.dart.compiler.ast.ImportHideCombinator;
import com.google.dart.compiler.ast.ImportShowCombinator;
@@ -387,17 +388,16 @@ public class DartParser extends CompletionHooksParserBase {
private void setMetadata(DartNodeWithMetadata node, List<DartAnnotation> annotations) {
if (annotations != null && !annotations.isEmpty()) {
node.setMetadata(annotations);
- if (node instanceof DartDeclaration<?>) {
+ if (node instanceof HasObsoleteMetadata) {
+ HasObsoleteMetadata declaration = (HasObsoleteMetadata) node;
for (int i = 0, size = annotations.size(); i < size; i++) {
DartAnnotation annotation = annotations.get(i);
DartExpression nameNode = annotation.getName();
if (nameNode instanceof DartIdentifier) {
String name = ((DartIdentifier) nameNode).getName();
if (name.equals("deprecated")) {
- DartDeclaration<?> declaration = (DartDeclaration<?>) node;
declaration.setObsoleteMetadata(declaration.getObsoleteMetadata().makeDeprecated());
} else if (name.equals("override")) {
- DartDeclaration<?> declaration = (DartDeclaration<?>) node;
declaration.setObsoleteMetadata(declaration.getObsoleteMetadata().makeOverride());
}
}

Powered by Google App Engine
This is Rietveld 408576698