OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 leg_apiimpl; | 5 library leg_apiimpl; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:convert'; | 8 import 'dart:convert'; |
9 | 9 |
10 import 'package:package_config/packages.dart'; | 10 import 'package:package_config/packages.dart'; |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 callUserHandler( | 271 callUserHandler( |
272 message, span.uri, span.begin, span.end, '$message', kind); | 272 message, span.uri, span.begin, span.end, '$message', kind); |
273 } | 273 } |
274 } | 274 } |
275 | 275 |
276 bool get isMockCompilation => | 276 bool get isMockCompilation => |
277 mockableLibraryUsed && options.allowMockCompilation; | 277 mockableLibraryUsed && options.allowMockCompilation; |
278 | 278 |
279 void callUserHandler(Message message, Uri uri, int begin, int end, | 279 void callUserHandler(Message message, Uri uri, int begin, int end, |
280 String text, api.Diagnostic kind) { | 280 String text, api.Diagnostic kind) { |
281 userHandlerTask.measure(() { | 281 try { |
282 handler.report(message, uri, begin, end, text, kind); | 282 userHandlerTask.measure(() { |
283 }); | 283 handler.report(message, uri, begin, end, text, kind); |
| 284 }); |
| 285 } catch (ex, s) { |
| 286 reportCrashInUserCode('Uncaught exception in diagnostic handler', ex, s); |
| 287 rethrow; |
| 288 } |
284 } | 289 } |
285 | 290 |
286 Future callUserProvider(Uri uri) { | 291 Future callUserProvider(Uri uri) { |
287 return userProviderTask.measure(() => provider.readFromUri(uri)); | 292 try { |
| 293 return userProviderTask.measure(() => provider.readFromUri(uri)); |
| 294 } catch (ex, s) { |
| 295 reportCrashInUserCode('Uncaught exception in input provider', ex, s); |
| 296 rethrow; |
| 297 } |
288 } | 298 } |
289 | 299 |
290 Future<Packages> callUserPackagesDiscovery(Uri uri) { | 300 Future<Packages> callUserPackagesDiscovery(Uri uri) { |
291 return userPackagesDiscoveryTask | 301 try { |
292 .measure(() => options.packagesDiscoveryProvider(uri)); | 302 return userPackagesDiscoveryTask |
| 303 .measure(() => options.packagesDiscoveryProvider(uri)); |
| 304 } catch (ex, s) { |
| 305 reportCrashInUserCode('Uncaught exception in package discovery', ex, s); |
| 306 rethrow; |
| 307 } |
293 } | 308 } |
294 | 309 |
295 Uri resolvePatchUri(String libraryName) { | 310 Uri resolvePatchUri(String libraryName) { |
296 return backend.resolvePatchUri(libraryName, options.platformConfigUri); | 311 return backend.resolvePatchUri(libraryName, options.platformConfigUri); |
297 } | 312 } |
298 } | 313 } |
299 | 314 |
300 class _Environment implements Environment { | 315 class _Environment implements Environment { |
301 final Map<String, String> definitions; | 316 final Map<String, String> definitions; |
302 | 317 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 } | 349 } |
335 } | 350 } |
336 | 351 |
337 /// For every 'dart:' library, a corresponding environment variable is set | 352 /// For every 'dart:' library, a corresponding environment variable is set |
338 /// to "true". The environment variable's name is the concatenation of | 353 /// to "true". The environment variable's name is the concatenation of |
339 /// this prefix and the name (without the 'dart:'. | 354 /// this prefix and the name (without the 'dart:'. |
340 /// | 355 /// |
341 /// For example 'dart:html' has the environment variable 'dart.library.html' set | 356 /// For example 'dart:html' has the environment variable 'dart.library.html' set |
342 /// to "true". | 357 /// to "true". |
343 const String _dartLibraryEnvironmentPrefix = 'dart.library.'; | 358 const String _dartLibraryEnvironmentPrefix = 'dart.library.'; |
OLD | NEW |