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 source.sdk_ext; | 5 library source.sdk_ext; |
6 | 6 |
7 import 'dart:convert'; | 7 import 'dart:convert'; |
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 if (partPath != null) { | 70 if (partPath != null) { |
71 return _resolvePart(libraryEntry, partPath, importUri); | 71 return _resolvePart(libraryEntry, partPath, importUri); |
72 } else { | 72 } else { |
73 return _resolveEntry(libraryEntry, importUri); | 73 return _resolveEntry(libraryEntry, importUri); |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 @override | 77 @override |
78 Uri restoreAbsolute(Source source) { | 78 Uri restoreAbsolute(Source source) { |
| 79 // TODO(paulberry, johnmccutchan): this has incorrect semantics because it |
| 80 // refers to source.uri. See dartbug.com/24090. |
79 String libraryName = _libraryName(source.uri); | 81 String libraryName = _libraryName(source.uri); |
80 if (_registeredSdkExtension(libraryName)) { | 82 if (_registeredSdkExtension(libraryName)) { |
81 return source.uri; | 83 return source.uri; |
82 } | 84 } |
83 return null; | 85 return null; |
84 } | 86 } |
85 | 87 |
86 /// Return the library name of [importUri]. | 88 /// Return the library name of [importUri]. |
87 String _libraryName(Uri importUri) { | 89 String _libraryName(Uri importUri) { |
88 var uri = importUri.toString(); | 90 var uri = importUri.toString(); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 /// Resolve a 'part' statement inside an sdk extension. | 169 /// Resolve a 'part' statement inside an sdk extension. |
168 Source _resolvePart(Uri libraryEntry, String partPath, Uri importUri) { | 170 Source _resolvePart(Uri libraryEntry, String partPath, Uri importUri) { |
169 // Library part. | 171 // Library part. |
170 var directory = pathos.dirname(libraryEntry.path); | 172 var directory = pathos.dirname(libraryEntry.path); |
171 var partUri = new Uri.file(pathos.join(directory, partPath)); | 173 var partUri = new Uri.file(pathos.join(directory, partPath)); |
172 assert(partUri.isAbsolute); | 174 assert(partUri.isAbsolute); |
173 JavaFile javaFile = new JavaFile.fromUri(partUri); | 175 JavaFile javaFile = new JavaFile.fromUri(partUri); |
174 return new FileBasedSource(javaFile, importUri); | 176 return new FileBasedSource(javaFile, importUri); |
175 } | 177 } |
176 } | 178 } |
OLD | NEW |