Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: pkg/compiler/lib/src/apiimpl.dart

Issue 1205373002: Translate package URIs to resource URIs for diagnostics. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tests/compiler/dart2js/memory_compiler.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 '../compiler.dart' as api; 10 import '../compiler.dart' as api;
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 if (identical(kind, api.Diagnostic.ERROR) 416 if (identical(kind, api.Diagnostic.ERROR)
417 || identical(kind, api.Diagnostic.CRASH) 417 || identical(kind, api.Diagnostic.CRASH)
418 || (fatalWarnings && identical(kind, api.Diagnostic.WARNING))) { 418 || (fatalWarnings && identical(kind, api.Diagnostic.WARNING))) {
419 compilationFailed = true; 419 compilationFailed = true;
420 } 420 }
421 // [:span.uri:] might be [:null:] in case of a [Script] with no [uri]. For 421 // [:span.uri:] might be [:null:] in case of a [Script] with no [uri]. For
422 // instance in the [Types] constructor in typechecker.dart. 422 // instance in the [Types] constructor in typechecker.dart.
423 if (span == null || span.uri == null) { 423 if (span == null || span.uri == null) {
424 callUserHandler(null, null, null, '$message', kind); 424 callUserHandler(null, null, null, '$message', kind);
425 } else { 425 } else {
426 callUserHandler(span.uri, span.begin, span.end, '$message', kind); 426 // Translate uri into a resource uri if possible.
427 Uri uri = translateUri(null, span.uri);
ahe 2015/06/26 07:56:05 If I understand this correctly, this may invoke a
Johnni Winther 2015/06/26 10:15:06 Good point. Will cache the resource URIs.
Johnni Winther 2015/06/26 17:06:54 No need for extra caching; it was already in Scrip
428 if (uri == null) {
429 // Use readable uri as fallback.
430 uri = span.uri;
431 }
432 callUserHandler(uri, span.begin, span.end, '$message', kind);
427 } 433 }
428 } 434 }
429 435
430 bool get isMockCompilation { 436 bool get isMockCompilation {
431 return mockableLibraryUsed 437 return mockableLibraryUsed
432 && (options.indexOf('--allow-mock-compilation') != -1); 438 && (options.indexOf('--allow-mock-compilation') != -1);
433 } 439 }
434 440
435 void callUserHandler(Uri uri, int begin, int end, 441 void callUserHandler(Uri uri, int begin, int end,
436 String message, api.Diagnostic kind) { 442 String message, api.Diagnostic kind) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 print('$message: ${tryToString(exception)}'); 475 print('$message: ${tryToString(exception)}');
470 print(tryToString(stackTrace)); 476 print(tryToString(stackTrace));
471 } 477 }
472 478
473 fromEnvironment(String name) => environment[name]; 479 fromEnvironment(String name) => environment[name];
474 480
475 LibraryInfo lookupLibraryInfo(String libraryName) { 481 LibraryInfo lookupLibraryInfo(String libraryName) {
476 return library_info.LIBRARIES[libraryName]; 482 return library_info.LIBRARIES[libraryName];
477 } 483 }
478 } 484 }
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js/memory_compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698