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 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 unit.getDirectives().add(importDirective("dart:collection", null)); | 702 unit.getDirectives().add(importDirective("dart:collection", null)); |
703 unit.getDirectives().add(importDirective("java_core.dart", null)); | 703 unit.getDirectives().add(importDirective("java_core.dart", null)); |
704 unit.getDirectives().add(importDirective("instrumentation.dart", null)); | 704 unit.getDirectives().add(importDirective("instrumentation.dart", null)); |
705 unit.getDirectives().add(importDirective("error.dart", null)); | 705 unit.getDirectives().add(importDirective("error.dart", null)); |
706 unit.getDirectives().add(importDirective("source.dart", null)); | 706 unit.getDirectives().add(importDirective("source.dart", null)); |
707 unit.getDirectives().add(importDirective("scanner.dart", null)); | 707 unit.getDirectives().add(importDirective("scanner.dart", null)); |
708 unit.getDirectives().add(importDirective("ast.dart", null)); | 708 unit.getDirectives().add(importDirective("ast.dart", null)); |
709 unit.getDirectives().add(importDirective("utilities_dart.dart", null)); | 709 unit.getDirectives().add(importDirective("utilities_dart.dart", null)); |
710 unit.getDirectives().add( | 710 unit.getDirectives().add( |
711 importDirective("engine.dart", null, importShowCombinator("AnalysisEngin
e"))); | 711 importDirective("engine.dart", null, importShowCombinator("AnalysisEngin
e"))); |
| 712 unit.getDirectives().add( |
| 713 importDirective("utilities_collection.dart", null, importShowCombinator(
"TokenMap"))); |
712 for (CompilationUnitMember member : dartUnit.getDeclarations()) { | 714 for (CompilationUnitMember member : dartUnit.getDeclarations()) { |
713 File file = context.getMemberToFile().get(member); | 715 File file = context.getMemberToFile().get(member); |
714 if (isEnginePath(file, "parser/") || isEnginePath(file, "internal/parser/"
) | 716 if (isEnginePath(file, "parser/") || isEnginePath(file, "internal/parser/"
) |
715 || file.getName().equals("ToFormattedSourceVisitor.java")) { | 717 || file.getName().equals("ToFormattedSourceVisitor.java")) { |
716 unit.getDeclarations().add(member); | 718 unit.getDeclarations().add(member); |
717 } | 719 } |
718 } | 720 } |
719 return unit; | 721 return unit; |
720 } | 722 } |
721 | 723 |
722 private static CompilationUnit buildParserTestLibrary() throws Exception { | 724 private static CompilationUnit buildParserTestLibrary() throws Exception { |
723 CompilationUnit unit = new CompilationUnit(null, null, null, null, null); | 725 CompilationUnit unit = new CompilationUnit(null, null, null, null, null); |
724 unit.getDirectives().add(libraryDirective("engine", "parser_test")); | 726 unit.getDirectives().add(libraryDirective("engine", "parser_test")); |
725 unit.getDirectives().add(importDirective(src_package + "java_core.dart", nul
l)); | 727 unit.getDirectives().add(importDirective(src_package + "java_core.dart", nul
l)); |
726 unit.getDirectives().add(importDirective(src_package + "java_junit.dart", nu
ll)); | 728 unit.getDirectives().add(importDirective(src_package + "java_junit.dart", nu
ll)); |
727 unit.getDirectives().add(importDirective(src_package + "error.dart", null)); | 729 unit.getDirectives().add(importDirective(src_package + "error.dart", null)); |
| 730 unit.getDirectives().add( |
| 731 importDirective(src_package + "source.dart", null, importShowCombinator(
"Source"))); |
728 unit.getDirectives().add(importDirective(src_package + "scanner.dart", null)
); | 732 unit.getDirectives().add(importDirective(src_package + "scanner.dart", null)
); |
729 unit.getDirectives().add(importDirective(src_package + "ast.dart", null)); | 733 unit.getDirectives().add(importDirective(src_package + "ast.dart", null)); |
730 unit.getDirectives().add(importDirective(src_package + "parser.dart", null))
; | 734 unit.getDirectives().add(importDirective(src_package + "parser.dart", null))
; |
| 735 unit.getDirectives().add(importDirective(src_package + "element.dart", null)
); |
731 unit.getDirectives().add(importDirective(src_package + "utilities_dart.dart"
, null)); | 736 unit.getDirectives().add(importDirective(src_package + "utilities_dart.dart"
, null)); |
732 unit.getDirectives().add(importDirective("package:unittest/unittest.dart", "
_ut")); | 737 unit.getDirectives().add(importDirective("package:unittest/unittest.dart", "
_ut")); |
733 unit.getDirectives().add(importDirective("test_support.dart", null)); | 738 unit.getDirectives().add(importDirective("test_support.dart", null)); |
734 unit.getDirectives().add( | 739 unit.getDirectives().add( |
735 importDirective("scanner_test.dart", null, importShowCombinator("TokenFa
ctory"))); | 740 importDirective("scanner_test.dart", null, importShowCombinator("TokenFa
ctory"))); |
736 unit.getDirectives().add( | 741 unit.getDirectives().add( |
737 importDirective("ast_test.dart", null, importShowCombinator("ASTFactory"
))); | 742 importDirective("ast_test.dart", null, importShowCombinator("ASTFactory"
))); |
| 743 unit.getDirectives().add( |
| 744 importDirective("element_test.dart", null, importShowCombinator("Element
Factory"))); |
738 List<Statement> mainStatements = Lists.newArrayList(); | 745 List<Statement> mainStatements = Lists.newArrayList(); |
739 for (Entry<File, List<CompilationUnitMember>> entry : context.getFileToMembe
rs().entrySet()) { | 746 for (Entry<File, List<CompilationUnitMember>> entry : context.getFileToMembe
rs().entrySet()) { |
740 File file = entry.getKey(); | 747 File file = entry.getKey(); |
741 if (isEngineTestPath(file, "parser/")) { | 748 if (isEngineTestPath(file, "parser/")) { |
742 List<CompilationUnitMember> unitMembers = entry.getValue(); | 749 List<CompilationUnitMember> unitMembers = entry.getValue(); |
743 for (CompilationUnitMember unitMember : unitMembers) { | 750 for (CompilationUnitMember unitMember : unitMembers) { |
744 boolean isTestSuite = EngineSemanticProcessor.gatherTestSuites(mainSta
tements, unitMember); | 751 boolean isTestSuite = EngineSemanticProcessor.gatherTestSuites(mainSta
tements, unitMember); |
745 if (!isTestSuite) { | 752 if (!isTestSuite) { |
746 unit.getDeclarations().add(unitMember); | 753 unit.getDeclarations().add(unitMember); |
747 } | 754 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 } | 870 } |
864 | 871 |
865 private static CompilationUnit buildScannerTestLibrary() throws Exception { | 872 private static CompilationUnit buildScannerTestLibrary() throws Exception { |
866 CompilationUnit unit = new CompilationUnit(null, null, null, null, null); | 873 CompilationUnit unit = new CompilationUnit(null, null, null, null, null); |
867 unit.getDirectives().add(libraryDirective("engine", "scanner_test")); | 874 unit.getDirectives().add(libraryDirective("engine", "scanner_test")); |
868 unit.getDirectives().add(importDirective(src_package + "java_core.dart", nul
l)); | 875 unit.getDirectives().add(importDirective(src_package + "java_core.dart", nul
l)); |
869 unit.getDirectives().add(importDirective(src_package + "java_junit.dart", nu
ll)); | 876 unit.getDirectives().add(importDirective(src_package + "java_junit.dart", nu
ll)); |
870 unit.getDirectives().add(importDirective(src_package + "source.dart", null))
; | 877 unit.getDirectives().add(importDirective(src_package + "source.dart", null))
; |
871 unit.getDirectives().add(importDirective(src_package + "error.dart", null)); | 878 unit.getDirectives().add(importDirective(src_package + "error.dart", null)); |
872 unit.getDirectives().add(importDirective(src_package + "scanner.dart", null)
); | 879 unit.getDirectives().add(importDirective(src_package + "scanner.dart", null)
); |
| 880 unit.getDirectives().add( |
| 881 importDirective( |
| 882 src_package + "utilities_collection.dart", |
| 883 null, |
| 884 importShowCombinator("TokenMap"))); |
873 unit.getDirectives().add(importDirective("package:unittest/unittest.dart", "
_ut")); | 885 unit.getDirectives().add(importDirective("package:unittest/unittest.dart", "
_ut")); |
874 unit.getDirectives().add(importDirective("test_support.dart", null)); | 886 unit.getDirectives().add(importDirective("test_support.dart", null)); |
875 List<Statement> mainStatements = Lists.newArrayList(); | 887 List<Statement> mainStatements = Lists.newArrayList(); |
876 for (Entry<File, List<CompilationUnitMember>> entry : context.getFileToMembe
rs().entrySet()) { | 888 for (Entry<File, List<CompilationUnitMember>> entry : context.getFileToMembe
rs().entrySet()) { |
877 File file = entry.getKey(); | 889 File file = entry.getKey(); |
878 if (isEngineTestPath(file, "scanner/")) { | 890 if (isEngineTestPath(file, "scanner/")) { |
879 List<CompilationUnitMember> unitMembers = entry.getValue(); | 891 List<CompilationUnitMember> unitMembers = entry.getValue(); |
880 for (CompilationUnitMember unitMember : unitMembers) { | 892 for (CompilationUnitMember unitMember : unitMembers) { |
881 boolean isTestSuite = EngineSemanticProcessor.gatherTestSuites(mainSta
tements, unitMember); | 893 boolean isTestSuite = EngineSemanticProcessor.gatherTestSuites(mainSta
tements, unitMember); |
882 if (!isTestSuite) { | 894 if (!isTestSuite) { |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 * @return the source with the replacement fragment | 1155 * @return the source with the replacement fragment |
1144 */ | 1156 */ |
1145 private static String replaceSourceFragmentRE(String source, String pattern, S
tring replacement) { | 1157 private static String replaceSourceFragmentRE(String source, String pattern, S
tring replacement) { |
1146 Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE | Pattern.DOTAL
L).matcher(source); | 1158 Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE | Pattern.DOTAL
L).matcher(source); |
1147 if (!matcher.find()) { | 1159 if (!matcher.find()) { |
1148 throw new IllegalArgumentException("Not found: " + pattern); | 1160 throw new IllegalArgumentException("Not found: " + pattern); |
1149 } | 1161 } |
1150 return matcher.replaceFirst(replacement); | 1162 return matcher.replaceFirst(replacement); |
1151 } | 1163 } |
1152 } | 1164 } |
OLD | NEW |