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

Side by Side Diff: dart/lib/compiler/implementation/apiimpl.dart

Issue 10572014: Don't crash when a file is missing. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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:uri'); 7 #import('dart:uri');
8 8
9 #import('../compiler.dart', prefix: 'api'); 9 #import('../compiler.dart', prefix: 'api');
10 #import('leg.dart', prefix: 'leg'); 10 #import('leg.dart', prefix: 'leg');
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 var translated = translateUri(uri, node); 47 var translated = translateUri(uri, node);
48 String text = ""; 48 String text = "";
49 try { 49 try {
50 // TODO(ahe): We expect the future to be complete and call value 50 // TODO(ahe): We expect the future to be complete and call value
51 // directly. In effect, we don't support truly asynchronous API. 51 // directly. In effect, we don't support truly asynchronous API.
52 text = provider(translated).value; 52 text = provider(translated).value;
53 } catch (var exception) { 53 } catch (var exception) {
54 if (node !== null) { 54 if (node !== null) {
55 cancel("$exception", node: node); 55 cancel("$exception", node: node);
56 } else { 56 } else {
57 reportDiagnostic(const leg.SourceSpan(null, null, null), 57 reportDiagnostic(null, "$exception", api.Diagnostic.ERROR);
58 "$exception", api.Diagnostic.ERROR);
59 throw new leg.CompilerCancelledException("$exception"); 58 throw new leg.CompilerCancelledException("$exception");
60 } 59 }
61 } 60 }
62 SourceFile sourceFile = new SourceFile(uri.toString(), text); 61 SourceFile sourceFile = new SourceFile(uri.toString(), text);
63 return new leg.Script(uri, sourceFile); 62 return new leg.Script(uri, sourceFile);
64 } 63 }
65 64
66 Uri translateUri(Uri uri, tree.Node node) { 65 Uri translateUri(Uri uri, tree.Node node) {
67 switch (uri.scheme) { 66 switch (uri.scheme) {
68 case 'package': return translatePackageUri(uri, node); 67 case 'package': return translatePackageUri(uri, node);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 handler(translateUri(span.uri, null), span.begin, span.end, 102 handler(translateUri(span.uri, null), span.begin, span.end,
104 message, kind); 103 message, kind);
105 } 104 }
106 } 105 }
107 106
108 bool get isMockCompilation() { 107 bool get isMockCompilation() {
109 return mockableLibraryUsed 108 return mockableLibraryUsed
110 && (options.indexOf('--allow-mock-compilation') !== -1); 109 && (options.indexOf('--allow-mock-compilation') !== -1);
111 } 110 }
112 } 111 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698