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

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

Issue 189803004: Translate private Java members to private Dart members. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Tweaks 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 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 identifier.setToken(token(TokenType.IDENTIFIER, newName)); 588 identifier.setToken(token(TokenType.IDENTIFIER, newName));
589 } 589 }
590 } 590 }
591 } 591 }
592 // run processors 592 // run processors
593 { 593 {
594 replaceInnerClassReferences(dartUniverse); 594 replaceInnerClassReferences(dartUniverse);
595 unwrapVarArgIfAlreadyArray(dartUniverse); 595 unwrapVarArgIfAlreadyArray(dartUniverse);
596 ensureFieldInitializers(dartUniverse); 596 ensureFieldInitializers(dartUniverse);
597 dontUseThisInFieldInitializers(dartUniverse); 597 dontUseThisInFieldInitializers(dartUniverse);
598 renameAnonymousClassDeclarations();
599 renamePrivateClassMembers();
598 ensureUniqueClassMemberNames(dartUniverse); 600 ensureUniqueClassMemberNames(dartUniverse);
599 renameAnonymousClassDeclarations();
600 applyLocalVariableSemanticChanges(dartUniverse); 601 applyLocalVariableSemanticChanges(dartUniverse);
601 new ConstructorSemanticProcessor(this).process(dartUniverse); 602 new ConstructorSemanticProcessor(this).process(dartUniverse);
602 renameConstructors(dartUniverse); 603 renameConstructors(dartUniverse);
603 insertEnclosingTypeForInstanceCreationArguments(dartUniverse); 604 insertEnclosingTypeForInstanceCreationArguments(dartUniverse);
604 } 605 }
605 // done 606 // done
606 return dartUniverse; 607 return dartUniverse;
607 } 608 }
608 609
609 /** 610 /**
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 if ("<empty>".equals(name)) { 973 if ("<empty>".equals(name)) {
973 name = null; 974 name = null;
974 } 975 }
975 renameConstructor(node, name); 976 renameConstructor(node, name);
976 // continue 977 // continue
977 return super.visitConstructorDeclaration(node); 978 return super.visitConstructorDeclaration(node);
978 } 979 }
979 }); 980 });
980 } 981 }
981 982
983 private void renamePrivateClassMembers() {
984 for (ClassMember member : privateClassMembers) {
985 if (member instanceof FieldDeclaration) {
986 FieldDeclaration fieldDeclaration = (FieldDeclaration) member;
987 NodeList<VariableDeclaration> variables = fieldDeclaration.getFields().g etVariables();
988 for (VariableDeclaration field : variables) {
989 SimpleIdentifier nameNode = field.getName();
990 String name = nameNode.getName();
991 renameIdentifier(nameNode, "_" + name);
992 }
993 }
994 if (member instanceof MethodDeclaration) {
995 MethodDeclaration methodDeclaration = (MethodDeclaration) member;
996 SimpleIdentifier nameNode = methodDeclaration.getName();
997 String name = nameNode.getName();
998 renameIdentifier(nameNode, "_" + name);
999 }
1000 }
1001 }
1002
982 private void replaceInnerClassReferences(CompilationUnit unit) { 1003 private void replaceInnerClassReferences(CompilationUnit unit) {
983 for (SimpleIdentifier identifier : innerClassNames) { 1004 for (SimpleIdentifier identifier : innerClassNames) {
984 renameIdentifier(identifier, identifier.getName()); 1005 renameIdentifier(identifier, identifier.getName());
985 } 1006 }
986 } 1007 }
987 1008
988 /** 1009 /**
989 * Translate {@link #sourceFiles} into Dart AST in {@link #dartUnits}. 1010 * Translate {@link #sourceFiles} into Dart AST in {@link #dartUnits}.
990 */ 1011 */
991 private void translateSyntax() throws Exception { 1012 private void translateSyntax() throws Exception {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 } 1071 }
1051 } 1072 }
1052 } 1073 }
1053 } 1074 }
1054 } 1075 }
1055 } 1076 }
1056 } 1077 }
1057 }); 1078 });
1058 } 1079 }
1059 } 1080 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698