OLD | NEW |
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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 } | 380 } |
381 { | 381 { |
382 CompilationUnit library = buildSourceLibrary(); | 382 CompilationUnit library = buildSourceLibrary(); |
383 Files.write( | 383 Files.write( |
384 getFormattedSource(library), | 384 getFormattedSource(library), |
385 new File(targetFolder + "/source.dart"), | 385 new File(targetFolder + "/source.dart"), |
386 Charsets.UTF_8); | 386 Charsets.UTF_8); |
387 } | 387 } |
388 { | 388 { |
389 CompilationUnit library = buildSourceIoLibrary(); | 389 CompilationUnit library = buildSourceIoLibrary(); |
390 Files.write( | 390 String code = getFormattedSource(library); |
391 getFormattedSource(library), | 391 code = replaceSourceFragment( |
392 new File(targetFolder + "/source_io.dart"), | 392 code, |
393 Charsets.UTF_8); | 393 "bool isOpaque = uri.isOpaque()", |
| 394 "bool isOpaque = uri.isAbsolute && !uri.path.startsWith('/')"); |
| 395 Files.write(code, new File(targetFolder + "/source_io.dart"), Charsets.UTF
_8); |
394 } | 396 } |
395 { | 397 { |
396 CompilationUnit library = buildErrorLibrary(); | 398 CompilationUnit library = buildErrorLibrary(); |
397 Files.write( | 399 Files.write( |
398 getFormattedSource(library), | 400 getFormattedSource(library), |
399 new File(targetFolder + "/error.dart"), | 401 new File(targetFolder + "/error.dart"), |
400 Charsets.UTF_8); | 402 Charsets.UTF_8); |
401 } | 403 } |
402 { | 404 { |
403 CompilationUnit library = buildScannerLibrary(); | 405 CompilationUnit library = buildScannerLibrary(); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 Charsets.UTF_8); | 544 Charsets.UTF_8); |
543 } | 545 } |
544 { | 546 { |
545 CompilationUnit library = buildResolverTestLibrary(); | 547 CompilationUnit library = buildResolverTestLibrary(); |
546 String source = getFormattedSource(library); | 548 String source = getFormattedSource(library); |
547 // TODO(scheglov) restore this test once TestSource is not file based | 549 // TODO(scheglov) restore this test once TestSource is not file based |
548 source = replaceSourceFragment( | 550 source = replaceSourceFragment( |
549 source, | 551 source, |
550 "AnalysisDeltaTest.dartSuite();", | 552 "AnalysisDeltaTest.dartSuite();", |
551 "//AnalysisDeltaTest.dartSuite();"); | 553 "//AnalysisDeltaTest.dartSuite();"); |
| 554 source = replaceSourceFragment(source, "on AssertionFailedError catch", "c
atch"); |
552 Files.write(source, new File(targetTestFolder + "/resolver_test.dart"), Ch
arsets.UTF_8); | 555 Files.write(source, new File(targetTestFolder + "/resolver_test.dart"), Ch
arsets.UTF_8); |
553 } | 556 } |
554 { | 557 { |
555 String projectFolder = new File(targetFolder).getParentFile().getParentFil
e().getParent(); | 558 String projectFolder = new File(targetFolder).getParentFile().getParentFil
e().getParent(); |
556 fixUnnecessaryCastHints(projectFolder); | 559 fixUnnecessaryCastHints(projectFolder); |
557 } | 560 } |
558 System.out.println("Translation complete"); | 561 System.out.println("Translation complete"); |
559 } | 562 } |
560 | 563 |
561 private static void addNotRemovedCompiationUnitEntries(CompilationUnit targetU
nit, | 564 private static void addNotRemovedCompiationUnitEntries(CompilationUnit targetU
nit, |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1174 | 1177 |
1175 private static CompilationUnit buildSourceIoLibrary() throws Exception { | 1178 private static CompilationUnit buildSourceIoLibrary() throws Exception { |
1176 CompilationUnit unit = new CompilationUnit(null, null, null, null, null); | 1179 CompilationUnit unit = new CompilationUnit(null, null, null, null, null); |
1177 unit.getDirectives().add(libraryDirective("engine", "source", "io")); | 1180 unit.getDirectives().add(libraryDirective("engine", "source", "io")); |
1178 unit.getDirectives().add(importDirective("source.dart", null)); | 1181 unit.getDirectives().add(importDirective("source.dart", null)); |
1179 unit.getDirectives().add(importDirective("java_core.dart", null)); | 1182 unit.getDirectives().add(importDirective("java_core.dart", null)); |
1180 unit.getDirectives().add(importDirective("java_io.dart", null)); | 1183 unit.getDirectives().add(importDirective("java_io.dart", null)); |
1181 unit.getDirectives().add(importDirective("utilities_general.dart", null)); | 1184 unit.getDirectives().add(importDirective("utilities_general.dart", null)); |
1182 unit.getDirectives().add(importDirective("instrumentation.dart", null)); | 1185 unit.getDirectives().add(importDirective("instrumentation.dart", null)); |
1183 unit.getDirectives().add(importDirective("engine.dart", null)); | 1186 unit.getDirectives().add(importDirective("engine.dart", null)); |
| 1187 unit.getDirectives().add(importDirective("java_engine.dart", null)); |
1184 unit.getDirectives().add(exportDirective("source.dart")); | 1188 unit.getDirectives().add(exportDirective("source.dart")); |
1185 for (Entry<File, List<CompilationUnitMember>> entry : context.getFileToMembe
rs().entrySet()) { | 1189 for (Entry<File, List<CompilationUnitMember>> entry : context.getFileToMembe
rs().entrySet()) { |
1186 File file = entry.getKey(); | 1190 File file = entry.getKey(); |
1187 if (isEnginePath(file, "source/Source.java") | 1191 if (isEnginePath(file, "source/Source.java") |
1188 || isEnginePath(file, "source/ContentCache.java") | 1192 || isEnginePath(file, "source/ContentCache.java") |
1189 || isEnginePath(file, "source/DartUriResolver.java") | 1193 || isEnginePath(file, "source/DartUriResolver.java") |
1190 || isEnginePath(file, "source/NonExistingSource.java") | 1194 || isEnginePath(file, "source/NonExistingSource.java") |
1191 || isEnginePath(file, "source/SourceFactory.java") | 1195 || isEnginePath(file, "source/SourceFactory.java") |
1192 || isEnginePath(file, "source/SourceContainer.java") | 1196 || isEnginePath(file, "source/SourceContainer.java") |
1193 || isEnginePath(file, "source/SourceKind.java") | 1197 || isEnginePath(file, "source/SourceKind.java") |
(...skipping 11 matching lines...) Expand all Loading... |
1205 } | 1209 } |
1206 return unit; | 1210 return unit; |
1207 } | 1211 } |
1208 | 1212 |
1209 private static CompilationUnit buildSourceLibrary() throws Exception { | 1213 private static CompilationUnit buildSourceLibrary() throws Exception { |
1210 CompilationUnit unit = new CompilationUnit(null, null, null, null, null); | 1214 CompilationUnit unit = new CompilationUnit(null, null, null, null, null); |
1211 unit.getDirectives().add(libraryDirective("engine", "source")); | 1215 unit.getDirectives().add(libraryDirective("engine", "source")); |
1212 unit.getDirectives().add(importDirective("dart:collection", null)); | 1216 unit.getDirectives().add(importDirective("dart:collection", null)); |
1213 unit.getDirectives().add(importDirective("java_core.dart", null)); | 1217 unit.getDirectives().add(importDirective("java_core.dart", null)); |
1214 unit.getDirectives().add(importDirective("sdk.dart", null, importShowCombina
tor("DartSdk"))); | 1218 unit.getDirectives().add(importDirective("sdk.dart", null, importShowCombina
tor("DartSdk"))); |
1215 unit.getDirectives().add( | 1219 unit.getDirectives().add(importDirective("engine.dart", null)); |
1216 importDirective( | 1220 unit.getDirectives().add(importDirective("java_engine.dart", null)); |
1217 "engine.dart", | |
1218 null, | |
1219 importShowCombinator("AnalysisContext", "TimestampedData"))); | |
1220 for (Entry<File, List<CompilationUnitMember>> entry : context.getFileToMembe
rs().entrySet()) { | 1221 for (Entry<File, List<CompilationUnitMember>> entry : context.getFileToMembe
rs().entrySet()) { |
1221 File file = entry.getKey(); | 1222 File file = entry.getKey(); |
1222 if (isEnginePath(file, "source/Source.java") | 1223 if (isEnginePath(file, "source/Source.java") |
1223 || isEnginePath(file, "source/ContentCache.java") | 1224 || isEnginePath(file, "source/ContentCache.java") |
1224 || isEnginePath(file, "source/DartUriResolver.java") | 1225 || isEnginePath(file, "source/DartUriResolver.java") |
1225 || isEnginePath(file, "source/LocalSourcePredicate.java") | 1226 || isEnginePath(file, "source/LocalSourcePredicate.java") |
1226 || isEnginePath(file, "source/NonExistingSource.java") | 1227 || isEnginePath(file, "source/NonExistingSource.java") |
1227 || isEnginePath(file, "source/SourceFactory.java") | 1228 || isEnginePath(file, "source/SourceFactory.java") |
1228 || isEnginePath(file, "source/SourceContainer.java") | 1229 || isEnginePath(file, "source/SourceContainer.java") |
1229 || isEnginePath(file, "source/SourceKind.java") | 1230 || isEnginePath(file, "source/SourceKind.java") |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1579 return ((ClassDeclaration) member).getName().getName(); | 1580 return ((ClassDeclaration) member).getName().getName(); |
1580 } | 1581 } |
1581 if (member instanceof FunctionDeclaration) { | 1582 if (member instanceof FunctionDeclaration) { |
1582 return ((FunctionDeclaration) member).getName().getName(); | 1583 return ((FunctionDeclaration) member).getName().getName(); |
1583 } | 1584 } |
1584 throw new UnsupportedOperationException(member.toSource()); | 1585 throw new UnsupportedOperationException(member.toSource()); |
1585 } | 1586 } |
1586 }); | 1587 }); |
1587 } | 1588 } |
1588 } | 1589 } |
OLD | NEW |