| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011, the Dart project authors. | 2 * Copyright (c) 2011, 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 /** | 104 /** |
| 105 * Answer a library source for the specified file | 105 * Answer a library source for the specified file |
| 106 * | 106 * |
| 107 * @param libraryFile the *.dart library configuration file | 107 * @param libraryFile the *.dart library configuration file |
| 108 * @return the source file or <code>null</code> if it could not be determined | 108 * @return the source file or <code>null</code> if it could not be determined |
| 109 */ | 109 */ |
| 110 private static LibrarySource newLibrarySourceFile(File libraryFile) throws Ass
ertionError { | 110 private static LibrarySource newLibrarySourceFile(File libraryFile) throws Ass
ertionError { |
| 111 if (libraryFile == null) { | 111 if (libraryFile == null) { |
| 112 return null; | 112 return null; |
| 113 } | 113 } |
| 114 URI uri; | 114 |
| 115 try { | 115 URI uri = libraryFile.toURI().normalize(); |
| 116 // We need to use the 3-arg constructor of URI in order to properly escape
file system chars. | 116 |
| 117 uri = new URI("file", libraryFile.getPath(), null); | |
| 118 } catch (URISyntaxException e) { | |
| 119 throw new AssertionError(e); | |
| 120 } | |
| 121 SystemLibraryManager libMgr = SystemLibraryManagerProvider.getSystemLibraryM
anager(); | 117 SystemLibraryManager libMgr = SystemLibraryManagerProvider.getSystemLibraryM
anager(); |
| 118 |
| 122 return new UrlLibrarySource(uri, libMgr); | 119 return new UrlLibrarySource(uri, libMgr); |
| 123 } | 120 } |
| 124 | 121 |
| 125 /** | 122 /** |
| 126 * Answer a library source for the specified file | 123 * Answer a library source for the specified file |
| 127 * | 124 * |
| 128 * @param libraryFile the *.dart library configuration file | 125 * @param libraryFile the *.dart library configuration file |
| 129 * @return the source file or <code>null</code> if it could not be determined | 126 * @return the source file or <code>null</code> if it could not be determined |
| 130 */ | 127 */ |
| 131 private static LibrarySource newLibrarySourceFile(IFile libraryFile) { | 128 private static LibrarySource newLibrarySourceFile(IFile libraryFile) { |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 return DartCompilerUtilities.parseSource(libraryFile.getName(), | 846 return DartCompilerUtilities.parseSource(libraryFile.getName(), |
| 850 IFileUtilities.getContents(libraryFile), null); | 847 IFileUtilities.getContents(libraryFile), null); |
| 851 } | 848 } |
| 852 } catch (Exception exception) { | 849 } catch (Exception exception) { |
| 853 DartCore.logError("Could not read and parse a library file", exception); | 850 DartCore.logError("Could not read and parse a library file", exception); |
| 854 // Fall through to return null. | 851 // Fall through to return null. |
| 855 } | 852 } |
| 856 return null; | 853 return null; |
| 857 } | 854 } |
| 858 } | 855 } |
| OLD | NEW |