OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Dart project authors. | 2 * Copyright 2012 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 10 matching lines...) Expand all Loading... |
21 import com.google.dart.compiler.DartSource; | 21 import com.google.dart.compiler.DartSource; |
22 import com.google.dart.compiler.DefaultCompilerConfiguration; | 22 import com.google.dart.compiler.DefaultCompilerConfiguration; |
23 import com.google.dart.compiler.LibrarySource; | 23 import com.google.dart.compiler.LibrarySource; |
24 import com.google.dart.compiler.Source; | 24 import com.google.dart.compiler.Source; |
25 import com.google.dart.compiler.SystemLibraryManager; | 25 import com.google.dart.compiler.SystemLibraryManager; |
26 import com.google.dart.compiler.UrlLibrarySource; | 26 import com.google.dart.compiler.UrlLibrarySource; |
27 import com.google.dart.compiler.ast.DartUnit; | 27 import com.google.dart.compiler.ast.DartUnit; |
28 import com.google.dart.compiler.ast.LibraryUnit; | 28 import com.google.dart.compiler.ast.LibraryUnit; |
29 import com.google.dart.compiler.parser.DartParser; | 29 import com.google.dart.compiler.parser.DartParser; |
30 import com.google.dart.compiler.parser.DartPrefixParser; | 30 import com.google.dart.compiler.parser.DartPrefixParser; |
31 import com.google.dart.compiler.parser.DartScannerParserContext; | |
32 import com.google.dart.compiler.parser.ParserContext; | |
33 import com.google.dart.tools.core.DartCore; | 31 import com.google.dart.tools.core.DartCore; |
34 import com.google.dart.tools.core.internal.builder.CachingArtifactProvider; | 32 import com.google.dart.tools.core.internal.builder.CachingArtifactProvider; |
35 import com.google.dart.tools.core.internal.model.SystemLibraryManagerProvider; | 33 import com.google.dart.tools.core.internal.model.SystemLibraryManagerProvider; |
36 import com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities; | 34 import com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities; |
37 import com.google.dart.tools.core.utilities.io.FileUtilities; | 35 import com.google.dart.tools.core.utilities.io.FileUtilities; |
38 | 36 |
39 import java.io.File; | 37 import java.io.File; |
40 import java.io.IOException; | 38 import java.io.IOException; |
41 import java.net.URI; | 39 import java.net.URI; |
42 import java.util.HashMap; | 40 import java.util.HashMap; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 DartCompilerListener listener) { | 82 DartCompilerListener listener) { |
85 String sourceCode = null; | 83 String sourceCode = null; |
86 try { | 84 try { |
87 sourceCode = FileUtilities.getContents(sourceFile); | 85 sourceCode = FileUtilities.getContents(sourceFile); |
88 } catch (IOException e) { | 86 } catch (IOException e) { |
89 listener.onError(newIoError(source, e)); | 87 listener.onError(newIoError(source, e)); |
90 } | 88 } |
91 DartUnit dartUnit = null; | 89 DartUnit dartUnit = null; |
92 if (sourceCode != null) { | 90 if (sourceCode != null) { |
93 try { | 91 try { |
94 ParserContext parserCtx = new DartScannerParserContext(source, sourceCod
e, listener); | 92 DartParser parser = new DartPrefixParser( |
95 DartParser parser = new DartPrefixParser(parserCtx, false, prefixes); | 93 source, |
| 94 sourceCode, |
| 95 false, |
| 96 prefixes, |
| 97 listener, |
| 98 null); |
96 dartUnit = DartCompilerUtilities.secureParseUnit(parser, source); | 99 dartUnit = DartCompilerUtilities.secureParseUnit(parser, source); |
97 } catch (Throwable e) { | 100 } catch (Throwable e) { |
98 DartCore.logError("Exception while parsing " + sourceFile.getPath(), e); | 101 DartCore.logError("Exception while parsing " + sourceFile.getPath(), e); |
99 listener.onError(newParseFailure(source, e)); | 102 listener.onError(newParseFailure(source, e)); |
100 } | 103 } |
101 } | 104 } |
102 return dartUnit != null ? dartUnit : new DartUnit(source, false); | 105 return dartUnit != null ? dartUnit : new DartUnit(source, false); |
103 } | 106 } |
104 | 107 |
105 /** | 108 /** |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 206 |
204 private static DartCompilationError newParseFailure(DartSource source, Throwab
le e) { | 207 private static DartCompilationError newParseFailure(DartSource source, Throwab
le e) { |
205 DartCompilationError error = new DartCompilationError( | 208 DartCompilationError error = new DartCompilationError( |
206 source, | 209 source, |
207 AnalysisErrorCode.PARSE_FAILURE, | 210 AnalysisErrorCode.PARSE_FAILURE, |
208 e.getMessage()); | 211 e.getMessage()); |
209 error.setSource(source); | 212 error.setSource(source); |
210 return error; | 213 return error; |
211 } | 214 } |
212 } | 215 } |
OLD | NEW |