OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 import 'package:front_end/compiler_options.dart'; | 7 import 'package:front_end/compiler_options.dart'; |
8 import 'package:front_end/file_system.dart'; | 8 import 'package:front_end/file_system.dart'; |
9 import 'package:front_end/src/fasta/translate_uri.dart'; | 9 import 'package:front_end/src/fasta/translate_uri.dart'; |
10 import 'package:front_end/src/base/performace_logger.dart'; | 10 import 'package:front_end/src/base/performace_logger.dart'; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 128 |
129 /// Get the [TranslateUri] which resolves "package:" and "dart:" URIs. | 129 /// Get the [TranslateUri] which resolves "package:" and "dart:" URIs. |
130 /// | 130 /// |
131 /// This is an asynchronous method since file system operations may be | 131 /// This is an asynchronous method since file system operations may be |
132 /// required to locate/read the packages file as well as SDK metadata. | 132 /// required to locate/read the packages file as well as SDK metadata. |
133 Future<TranslateUri> getUriTranslator() async { | 133 Future<TranslateUri> getUriTranslator() async { |
134 if (_uriTranslator == null) { | 134 if (_uriTranslator == null) { |
135 await _getPackages(); | 135 await _getPackages(); |
136 // TODO(scheglov) Load SDK libraries from whatever format we decide. | 136 // TODO(scheglov) Load SDK libraries from whatever format we decide. |
137 // TODO(scheglov) Remove the field "_raw.dartLibraries". | 137 // TODO(scheglov) Remove the field "_raw.dartLibraries". |
138 _uriTranslator = new TranslateUri(_packages, _raw.dartLibraries); | 138 _uriTranslator = new TranslateUri( |
| 139 _packages, _raw.dartLibraries, const <String, List<Uri>>{}); |
139 _uriTranslator.dartLibraries.addAll(_raw.dartLibraries); | 140 _uriTranslator.dartLibraries.addAll(_raw.dartLibraries); |
140 } | 141 } |
141 return _uriTranslator; | 142 return _uriTranslator; |
142 } | 143 } |
143 | 144 |
144 /// Get the package map which maps package names to URIs. | 145 /// Get the package map which maps package names to URIs. |
145 /// | 146 /// |
146 /// This is an asynchronous getter since file system operations may be | 147 /// This is an asynchronous getter since file system operations may be |
147 /// required to locate/read the packages file. | 148 /// required to locate/read the packages file. |
148 Future<Map<String, Uri>> _getPackages() async { | 149 Future<Map<String, Uri>> _getPackages() async { |
(...skipping 24 matching lines...) Expand all Loading... |
173 // automagically. | 174 // automagically. |
174 throw new UnimplementedError(); | 175 throw new UnimplementedError(); |
175 } | 176 } |
176 var root = _raw.sdkRoot; | 177 var root = _raw.sdkRoot; |
177 if (!root.path.endsWith('/')) { | 178 if (!root.path.endsWith('/')) { |
178 root = root.replace(path: _sdkRoot.path + '/'); | 179 root = root.replace(path: _sdkRoot.path + '/'); |
179 } | 180 } |
180 return root; | 181 return root; |
181 } | 182 } |
182 } | 183 } |
OLD | NEW |