| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library analyzer.source.embedder; | 5 library analyzer.source.embedder; |
| 6 | 6 |
| 7 import 'dart:collection' show HashMap; | 7 import 'dart:collection' show HashMap; |
| 8 import 'dart:core' hide Resource; | 8 import 'dart:core' hide Resource; |
| 9 | 9 |
| 10 import 'package:analyzer/file_system/file_system.dart'; | 10 import 'package:analyzer/file_system/file_system.dart'; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 SdkLibraryImpl library = new SdkLibraryImpl(shortName); | 149 SdkLibraryImpl library = new SdkLibraryImpl(shortName); |
| 150 library.path = libPath; | 150 library.path = libPath; |
| 151 (dartSdk as EmbedderSdk)._librariesMap.setLibrary(name, library); | 151 (dartSdk as EmbedderSdk)._librariesMap.setLibrary(name, library); |
| 152 } | 152 } |
| 153 | 153 |
| 154 /// Number of embedder libraries. | 154 /// Number of embedder libraries. |
| 155 int get length => _urlMappings.length; | 155 int get length => _urlMappings.length; |
| 156 | 156 |
| 157 @override | 157 @override |
| 158 Uri restoreAbsolute(Source source) { | 158 Uri restoreAbsolute(Source source) { |
| 159 Source sdkSource = dartSdk.fromFileUri(Uri.parse(source.fullName)); | 159 String path = source.fullName; |
| 160 if (path.length > 3 && path[1] == ':' && path[2] == '\\') { |
| 161 path = '/${path[0]}:${path.substring(2).replaceAll('\\', '/')}'; |
| 162 } |
| 163 Source sdkSource = dartSdk.fromFileUri(Uri.parse('file://$path')); |
| 160 return sdkSource?.uri; | 164 return sdkSource?.uri; |
| 161 } | 165 } |
| 162 } | 166 } |
| 163 | 167 |
| 164 class EmbedderSdk implements DartSdk { | 168 class EmbedderSdk implements DartSdk { |
| 165 // TODO(danrubel) Refactor this with DirectoryBasedDartSdk | 169 // TODO(danrubel) Refactor this with DirectoryBasedDartSdk |
| 166 | 170 |
| 167 /// The resolver associated with this embedder sdk. | 171 /// The resolver associated with this embedder sdk. |
| 168 EmbedderUriResolver _resolver; | 172 EmbedderUriResolver _resolver; |
| 169 | 173 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 } | 284 } |
| 281 String filePath = srcPath.replaceAll('/', JavaFile.separator); | 285 String filePath = srcPath.replaceAll('/', JavaFile.separator); |
| 282 try { | 286 try { |
| 283 JavaFile file = new JavaFile(filePath); | 287 JavaFile file = new JavaFile(filePath); |
| 284 return new FileBasedSource(file, parseUriWithException(dartUri)); | 288 return new FileBasedSource(file, parseUriWithException(dartUri)); |
| 285 } on URISyntaxException { | 289 } on URISyntaxException { |
| 286 return null; | 290 return null; |
| 287 } | 291 } |
| 288 } | 292 } |
| 289 } | 293 } |
| OLD | NEW |