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

Side by Side Diff: lib/compiler/implementation/dart2js.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('dart2js'); 5 #library('dart2js');
6 6
7 #import('dart:io'); 7 #import('dart:io');
8 #import('dart:uri'); 8 #import('dart:uri');
9 #import('dart:utf'); 9 #import('dart:utf');
10 10
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 Map<String, SourceFile> sourceFiles = <String, SourceFile>{}; 154 Map<String, SourceFile> sourceFiles = <String, SourceFile>{};
155 int dartBytesRead = 0; 155 int dartBytesRead = 0;
156 156
157 Future<String> provider(Uri uri) { 157 Future<String> provider(Uri uri) {
158 if (uri.scheme != 'file') { 158 if (uri.scheme != 'file') {
159 throw new IllegalArgumentException(uri); 159 throw new IllegalArgumentException(uri);
160 } 160 }
161 String source; 161 String source;
162 try { 162 try {
163 source = readAll(uriPathToNative(uri.path)); 163 source = readAll(uriPathToNative(uri.path));
164 } catch (FileIOException ex) { 164 } on FileIOException catch (ex) {
165 throw 'Error: Cannot read "${relativize(cwd, uri)}" (${ex.osError}).'; 165 throw 'Error: Cannot read "${relativize(cwd, uri)}" (${ex.osError}).';
166 } 166 }
167 dartBytesRead += source.length; 167 dartBytesRead += source.length;
168 sourceFiles[uri.toString()] = 168 sourceFiles[uri.toString()] =
169 new SourceFile(relativize(cwd, uri), source); 169 new SourceFile(relativize(cwd, uri), source);
170 return new Future.immediate(source); 170 return new Future.immediate(source);
171 } 171 }
172 172
173 void info(var message, [api.Diagnostic kind = api.Diagnostic.VERBOSE_INFO]) { 173 void info(var message, [api.Diagnostic kind = api.Diagnostic.VERBOSE_INFO]) {
174 if (!verbose && kind === api.Diagnostic.VERBOSE_INFO) return; 174 if (!verbose && kind === api.Diagnostic.VERBOSE_INFO) return;
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 361
362 void helpAndFail(String message) { 362 void helpAndFail(String message) {
363 help(); 363 help();
364 print(''); 364 print('');
365 fail(message); 365 fail(message);
366 } 366 }
367 367
368 void main() { 368 void main() {
369 try { 369 try {
370 compilerMain(new Options()); 370 compilerMain(new Options());
371 } catch (var exception, var trace) { 371 } catch (exception, trace) {
372 try { 372 try {
373 print('Internal error: $exception'); 373 print('Internal error: $exception');
374 } catch (var ignored) { 374 } catch (ignored) {
375 print('Internal error: error while printing exception'); 375 print('Internal error: error while printing exception');
376 } 376 }
377 try { 377 try {
378 print(trace); 378 print(trace);
379 } finally { 379 } finally {
380 exit(253); // 253 is recognized as a crash by our test scripts. 380 exit(253); // 253 is recognized as a crash by our test scripts.
381 } 381 }
382 } 382 }
383 } 383 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/compiler.dart ('k') | lib/compiler/implementation/lib/isolate_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698