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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012, the Dart project authors. 2 * Copyright (c) 2012, the Dart project authors.
3 * 3 *
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u se this file except 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u se this file except
5 * in compliance with the License. You may obtain a copy of the License at 5 * in compliance with the License. You may obtain a copy of the License at
6 * 6 *
7 * http://www.eclipse.org/legal/epl-v10.html 7 * http://www.eclipse.org/legal/epl-v10.html
8 * 8 *
9 * Unless required by applicable law or agreed to in writing, software distribut ed under the License 9 * Unless required by applicable law or agreed to in writing, software distribut ed under the License
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K IND, either express 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K IND, either express
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 public static final Set<String> FORBIDDEN_NAMES = Sets.newHashSet(); 124 public static final Set<String> FORBIDDEN_NAMES = Sets.newHashSet();
125 private final Set<String> usedNames = Sets.newHashSet(); 125 private final Set<String> usedNames = Sets.newHashSet();
126 private final Set<ClassMember> privateClassMembers = Sets.newHashSet(); 126 private final Set<ClassMember> privateClassMembers = Sets.newHashSet();
127 private final Map<SimpleIdentifier, String> identifierToName = Maps.newHashMap (); 127 private final Map<SimpleIdentifier, String> identifierToName = Maps.newHashMap ();
128 private final Map<String, Object> signatureToBinding = Maps.newHashMap(); 128 private final Map<String, Object> signatureToBinding = Maps.newHashMap();
129 private final Map<Object, List<SimpleIdentifier>> bindingToIdentifiers = Maps. newHashMap(); 129 private final Map<Object, List<SimpleIdentifier>> bindingToIdentifiers = Maps. newHashMap();
130 private final Map<AstNode, IBinding> nodeToBinding = Maps.newHashMap(); 130 private final Map<AstNode, IBinding> nodeToBinding = Maps.newHashMap();
131 private final Map<AstNode, ITypeBinding> nodeToTypeBinding = Maps.newHashMap() ; 131 private final Map<AstNode, ITypeBinding> nodeToTypeBinding = Maps.newHashMap() ;
132 private final Map<InstanceCreationExpression, ClassDeclaration> anonymousDecla rations = Maps.newHashMap(); 132 private final Map<InstanceCreationExpression, ClassDeclaration> anonymousDecla rations = Maps.newHashMap();
133 private final Set<SimpleIdentifier> innerClassNames = Sets.newHashSet(); 133 private final Set<SimpleIdentifier> innerClassNames = Sets.newHashSet();
134 private final Map<AstNode, List<ParsedAnnotation>> nodeAnnotations = Maps.newH ashMap();
134 // information about constructors 135 // information about constructors
135 private int technicalConstructorIndex; 136 private int technicalConstructorIndex;
136 private final Map<IMethodBinding, ConstructorDescription> bindingToConstructor = Maps.newHashMap(); 137 private final Map<IMethodBinding, ConstructorDescription> bindingToConstructor = Maps.newHashMap();
137 private final Map<ConstructorDeclaration, IMethodBinding> constructorToBinding = Maps.newHashMap(); 138 private final Map<ConstructorDeclaration, IMethodBinding> constructorToBinding = Maps.newHashMap();
138 // information about inner classes 139 // information about inner classes
139 private int technicalInnerClassIndex; 140 private int technicalInnerClassIndex;
140 private int technicalAnonymousClassIndex; 141 private int technicalAnonymousClassIndex;
141 142
142 static { 143 static {
143 for (Keyword keyword : Keyword.values()) { 144 for (Keyword keyword : Keyword.values()) {
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 name = identifier.getName(); 418 name = identifier.getName();
418 } 419 }
419 return name; 420 return name;
420 } 421 }
421 422
422 public Map<CompilationUnitMember, File> getMemberToFile() { 423 public Map<CompilationUnitMember, File> getMemberToFile() {
423 return memberToFile; 424 return memberToFile;
424 } 425 }
425 426
426 /** 427 /**
428 * Returns all node annotations. Used for testing.
429 */
430 public Map<AstNode, List<ParsedAnnotation>> getNodeAnnotations() {
431 return nodeAnnotations;
432 }
433
434 /**
435 * Returns {@link ParsedAnnotation}s object for the Java annotation specified on the Java node of
436 * the given {@link AstNode}, maybe {@code null}.
437 */
438 public List<ParsedAnnotation> getNodeAnnotations(AstNode node) {
439 return nodeAnnotations.get(node);
440 }
441
442 /**
427 * @return some Java binding for the given Dart {@link AstNode}. 443 * @return some Java binding for the given Dart {@link AstNode}.
428 */ 444 */
429 public IBinding getNodeBinding(AstNode node) { 445 public IBinding getNodeBinding(AstNode node) {
430 return nodeToBinding.get(node); 446 return nodeToBinding.get(node);
431 } 447 }
432 448
433 /** 449 /**
434 * @return some Java {@link ITypeBinding} for the given Dart {@link AstNode}. 450 * @return some Java {@link ITypeBinding} for the given Dart {@link AstNode}.
435 */ 451 */
436 public ITypeBinding getNodeTypeBinding(AstNode node) { 452 public ITypeBinding getNodeTypeBinding(AstNode node) {
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 665
650 /** 666 /**
651 * Remembers that given {@link SimpleIdentifier} is the name of inner class an d all references to 667 * Remembers that given {@link SimpleIdentifier} is the name of inner class an d all references to
652 * it should be renamed. 668 * it should be renamed.
653 */ 669 */
654 void putInnerClassName(SimpleIdentifier identifier) { 670 void putInnerClassName(SimpleIdentifier identifier) {
655 innerClassNames.add(identifier); 671 innerClassNames.add(identifier);
656 } 672 }
657 673
658 /** 674 /**
675 * Remembers the parsed annotation for the given node.
676 */
677 void putNodeAnnotation(AstNode node, ParsedAnnotation parsedAnnotation) {
678 List<ParsedAnnotation> annotations = nodeAnnotations.get(node);
679 if (annotations == null) {
680 annotations = Lists.newArrayList();
681 nodeAnnotations.put(node, annotations);
682 }
683 annotations.add(parsedAnnotation);
684 }
685
686 /**
659 * Remembers some Java binding for the given Dart {@link AstNode}. 687 * Remembers some Java binding for the given Dart {@link AstNode}.
660 */ 688 */
661 void putNodeBinding(AstNode node, IBinding binding) { 689 void putNodeBinding(AstNode node, IBinding binding) {
662 nodeToBinding.put(node, binding); 690 nodeToBinding.put(node, binding);
663 } 691 }
664 692
665 /** 693 /**
666 * Remembers Java {@link ITypeBinding} for the given Dart {@link AstNode}. 694 * Remembers Java {@link ITypeBinding} for the given Dart {@link AstNode}.
667 */ 695 */
668 void putNodeTypeBinding(AstNode node, ITypeBinding binding) { 696 void putNodeTypeBinding(AstNode node, ITypeBinding binding) {
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 } 1099 }
1072 } 1100 }
1073 } 1101 }
1074 } 1102 }
1075 } 1103 }
1076 } 1104 }
1077 } 1105 }
1078 }); 1106 });
1079 } 1107 }
1080 } 1108 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698