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

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

Issue 16611004: Improve java2dart code style - relax 'don't reference variable name in its initializer'. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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) 2013, the Dart project authors. 2 * Copyright (c) 2013, 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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 } 317 }
318 { 318 {
319 CompilationUnit library = buildResolverLibrary(); 319 CompilationUnit library = buildResolverLibrary();
320 String source = getFormattedSource(library); 320 String source = getFormattedSource(library);
321 source = replaceSourceFragmentRE( 321 source = replaceSourceFragmentRE(
322 source, 322 source,
323 "Object visitImportDirective\\(ImportDirective directive\\) \\{\n.*?FI LE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE.*?return null;", 323 "Object visitImportDirective\\(ImportDirective directive\\) \\{\n.*?FI LE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE.*?return null;",
324 makeSource("Object visitImportDirective(ImportDirective directive) {", " return null;")); 324 makeSource("Object visitImportDirective(ImportDirective directive) {", " return null;"));
325 source = replaceSourceFragment( 325 source = replaceSourceFragment(
326 source, 326 source,
327 "fullName2.replaceAll(new String.fromCharCode(JavaFile.separatorChar), '/')", 327 "fullName.replaceAll(new String.fromCharCode(JavaFile.separatorChar), '/')",
328 "fullName2.replaceAll(r'\\', '/')"); 328 "fullName.replaceAll(r'\\', '/')");
329 Files.write(source, new File(targetFolder + "/resolver.dart"), Charsets.UT F_8); 329 Files.write(source, new File(targetFolder + "/resolver.dart"), Charsets.UT F_8);
330 } 330 }
331 { 331 {
332 CompilationUnit library = buildEngineLibrary(); 332 CompilationUnit library = buildEngineLibrary();
333 Files.write( 333 Files.write(
334 getFormattedSource(library), 334 getFormattedSource(library),
335 new File(targetFolder + "/engine.dart"), 335 new File(targetFolder + "/engine.dart"),
336 Charsets.UTF_8); 336 Charsets.UTF_8);
337 } 337 }
338 // Tests 338 // Tests
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 * @return the source with the replacement fragment 1121 * @return the source with the replacement fragment
1122 */ 1122 */
1123 private static String replaceSourceFragmentRE(String source, String pattern, S tring replacement) { 1123 private static String replaceSourceFragmentRE(String source, String pattern, S tring replacement) {
1124 Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE | Pattern.DOTAL L).matcher(source); 1124 Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE | Pattern.DOTAL L).matcher(source);
1125 if (!matcher.find()) { 1125 if (!matcher.find()) {
1126 throw new IllegalArgumentException("Not found: " + pattern); 1126 throw new IllegalArgumentException("Not found: " + pattern);
1127 } 1127 }
1128 return matcher.replaceFirst(replacement); 1128 return matcher.replaceFirst(replacement);
1129 } 1129 }
1130 } 1130 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698