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

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

Issue 214253002: Translate Java enums to Dart constants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 524
525 public boolean isMethodBinding(AstNode node) { 525 public boolean isMethodBinding(AstNode node) {
526 IBinding binding = getNodeBinding(node); 526 IBinding binding = getNodeBinding(node);
527 return binding instanceof IMethodBinding; 527 return binding instanceof IMethodBinding;
528 } 528 }
529 529
530 /** 530 /**
531 * Remembers that "identifier" is reference to the given Java binding. 531 * Remembers that "identifier" is reference to the given Java binding.
532 */ 532 */
533 public void putReference(SimpleIdentifier identifier, IBinding binding, String bindingSignature) { 533 public void putReference(SimpleIdentifier identifier, IBinding binding, String bindingSignature) {
534 String name = identifier.getName();
534 if (binding != null) { 535 if (binding != null) {
535 signatureToBinding.put(bindingSignature, binding); 536 signatureToBinding.put(bindingSignature, binding);
536 identifierToName.put(identifier, identifier.getName()); 537 identifierToName.put(identifier, name);
537 // remember binding for reference 538 // remember binding for reference
538 nodeToBinding.put(identifier, binding); 539 nodeToBinding.put(identifier, binding);
539 // add reference to binding 540 // add reference to binding
540 List<SimpleIdentifier> identifiers = bindingToIdentifiers.get(binding); 541 List<SimpleIdentifier> identifiers = bindingToIdentifiers.get(binding);
541 if (identifiers == null) { 542 if (identifiers == null) {
542 identifiers = Lists.newLinkedList(); 543 identifiers = Lists.newLinkedList();
543 bindingToIdentifiers.put(binding, identifiers); 544 bindingToIdentifiers.put(binding, identifiers);
544 } 545 }
545 identifiers.add(identifier); 546 identifiers.add(identifier);
546 } 547 }
547 // remember global name 548 // remember global name
548 usedNames.add(identifier.getName()); 549 usedNames.add(name);
549 } 550 }
550 551
551 /** 552 /**
552 * Removes recorded identifier reference. 553 * Removes recorded identifier reference.
553 */ 554 */
554 public void removeReference(SimpleIdentifier identifier) { 555 public void removeReference(SimpleIdentifier identifier) {
555 IBinding binding = getNodeBinding(identifier); 556 IBinding binding = getNodeBinding(identifier);
556 List<SimpleIdentifier> identifiers = bindingToIdentifiers.get(binding); 557 List<SimpleIdentifier> identifiers = bindingToIdentifiers.get(binding);
557 if (identifiers != null) { 558 if (identifiers != null) {
558 identifiers.remove(identifier); 559 identifiers.remove(identifier);
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 } 1058 }
1058 } 1059 }
1059 } 1060 }
1060 } 1061 }
1061 } 1062 }
1062 } 1063 }
1063 } 1064 }
1064 }); 1065 });
1065 } 1066 }
1066 } 1067 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698