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

Unified Diff: editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/Context.java

Issue 189433006: Support for DartBlockBody, DartExpressionBody, DartOmit in java2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes for review comments. Created 6 years, 9 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: editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/Context.java
diff --git a/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/Context.java b/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/Context.java
index da999b1c97bc65a33f5a2af3d4e7b82c587d2784..9df2faf0e72c038cc4413579e6ff35dc17db1264 100644
--- a/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/Context.java
+++ b/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/Context.java
@@ -131,6 +131,7 @@ public class Context {
private final Map<AstNode, ITypeBinding> nodeToTypeBinding = Maps.newHashMap();
private final Map<InstanceCreationExpression, ClassDeclaration> anonymousDeclarations = Maps.newHashMap();
private final Set<SimpleIdentifier> innerClassNames = Sets.newHashSet();
+ private final Map<AstNode, List<ParsedAnnotation>> nodeAnnotations = Maps.newHashMap();
// information about constructors
private int technicalConstructorIndex;
private final Map<IMethodBinding, ConstructorDescription> bindingToConstructor = Maps.newHashMap();
@@ -424,6 +425,21 @@ public class Context {
}
/**
+ * Returns all node annotations. Used for testing.
+ */
+ public Map<AstNode, List<ParsedAnnotation>> getNodeAnnotations() {
+ return nodeAnnotations;
+ }
+
+ /**
+ * Returns {@link ParsedAnnotation}s object for the Java annotation specified on the Java node of
+ * the given {@link AstNode}, maybe {@code null}.
+ */
+ public List<ParsedAnnotation> getNodeAnnotations(AstNode node) {
+ return nodeAnnotations.get(node);
+ }
+
+ /**
* @return some Java binding for the given Dart {@link AstNode}.
*/
public IBinding getNodeBinding(AstNode node) {
@@ -656,6 +672,18 @@ public class Context {
}
/**
+ * Remembers the parsed annotation for the given node.
+ */
+ void putNodeAnnotation(AstNode node, ParsedAnnotation parsedAnnotation) {
+ List<ParsedAnnotation> annotations = nodeAnnotations.get(node);
+ if (annotations == null) {
+ annotations = Lists.newArrayList();
+ nodeAnnotations.put(node, annotations);
+ }
+ annotations.add(parsedAnnotation);
+ }
+
+ /**
* Remembers some Java binding for the given Dart {@link AstNode}.
*/
void putNodeBinding(AstNode node, IBinding binding) {

Powered by Google App Engine
This is Rietveld 408576698