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

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

Issue 10891022: Update corelib/ and lib/ to use the new try-catch syntax. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } 51 }
52 52
53 leg.Script readScript(Uri uri, [tree.Node node]) { 53 leg.Script readScript(Uri uri, [tree.Node node]) {
54 if (uri.scheme == 'dart') uri = translateDartUri(uri, node); 54 if (uri.scheme == 'dart') uri = translateDartUri(uri, node);
55 var translated = translateUri(uri, node); 55 var translated = translateUri(uri, node);
56 String text = ""; 56 String text = "";
57 try { 57 try {
58 // TODO(ahe): We expect the future to be complete and call value 58 // TODO(ahe): We expect the future to be complete and call value
59 // directly. In effect, we don't support truly asynchronous API. 59 // directly. In effect, we don't support truly asynchronous API.
60 text = provider(translated).value; 60 text = provider(translated).value;
61 } catch (var exception) { 61 } catch (exception) {
62 if (node !== null) { 62 if (node !== null) {
63 cancel("$exception", node: node); 63 cancel("$exception", node: node);
64 } else { 64 } else {
65 reportDiagnostic(null, "$exception", api.Diagnostic.ERROR); 65 reportDiagnostic(null, "$exception", api.Diagnostic.ERROR);
66 throw new leg.CompilerCancelledException("$exception"); 66 throw new leg.CompilerCancelledException("$exception");
67 } 67 }
68 } 68 }
69 SourceFile sourceFile = new SourceFile(uri.toString(), text); 69 SourceFile sourceFile = new SourceFile(uri.toString(), text);
70 return new leg.Script(uri, sourceFile); 70 return new leg.Script(uri, sourceFile);
71 } 71 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 handler(translateUri(span.uri, null), span.begin, span.end, 121 handler(translateUri(span.uri, null), span.begin, span.end,
122 message, kind); 122 message, kind);
123 } 123 }
124 } 124 }
125 125
126 bool get isMockCompilation { 126 bool get isMockCompilation {
127 return mockableLibraryUsed 127 return mockableLibraryUsed
128 && (options.indexOf('--allow-mock-compilation') !== -1); 128 && (options.indexOf('--allow-mock-compilation') !== -1);
129 } 129 }
130 } 130 }
OLDNEW
« no previous file with comments | « corelib/src/implementation/future_implementation.dart ('k') | lib/compiler/implementation/compile_time_constants.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698