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

Side by Side Diff: lib/compiler/implementation/compiler.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 5
6 /** 6 /**
7 * If true, print a warning for each method that was resolved, but not 7 * If true, print a warning for each method that was resolved, but not
8 * compiled. 8 * compiled.
9 */ 9 */
10 const bool REPORT_EXCESS_RESOLUTION = false; 10 const bool REPORT_EXCESS_RESOLUTION = false;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 * libraries. 103 * libraries.
104 */ 104 */
105 ClassElement jsIndexingBehaviorInterface; 105 ClassElement jsIndexingBehaviorInterface;
106 106
107 Element get currentElement => _currentElement; 107 Element get currentElement => _currentElement;
108 withCurrentElement(Element element, f()) { 108 withCurrentElement(Element element, f()) {
109 Element old = currentElement; 109 Element old = currentElement;
110 _currentElement = element; 110 _currentElement = element;
111 try { 111 try {
112 return f(); 112 return f();
113 } catch (CompilerCancelledException ex) { 113 } on CompilerCancelledException catch (ex) {
114 throw; 114 throw;
115 } catch (StackOverflowException ex) { 115 } on StackOverflowException catch (ex) {
116 // We cannot report anything useful in this case, because we 116 // We cannot report anything useful in this case, because we
117 // do not have enough stack space. 117 // do not have enough stack space.
118 throw; 118 throw;
119 } catch (var ex) { 119 } catch (ex) {
120 try { 120 try {
121 unhandledExceptionOnElement(element); 121 unhandledExceptionOnElement(element);
122 } catch (var doubleFault) { 122 } catch (doubleFault) {
123 // Ignoring exceptions in exception handling. 123 // Ignoring exceptions in exception handling.
124 } 124 }
125 throw; 125 throw;
126 } finally { 126 } finally {
127 _currentElement = old; 127 _currentElement = old;
128 } 128 }
129 } 129 }
130 130
131 List<CompilerTask> tasks; 131 List<CompilerTask> tasks;
132 ScannerTask scanner; 132 ScannerTask scanner;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 }); 257 });
258 } 258 }
259 259
260 void log(message) { 260 void log(message) {
261 reportDiagnostic(null, message, api.Diagnostic.VERBOSE_INFO); 261 reportDiagnostic(null, message, api.Diagnostic.VERBOSE_INFO);
262 } 262 }
263 263
264 bool run(Uri uri) { 264 bool run(Uri uri) {
265 try { 265 try {
266 runCompiler(uri); 266 runCompiler(uri);
267 } catch (CompilerCancelledException exception) { 267 } on CompilerCancelledException catch (exception) {
268 log(exception.toString()); 268 log(exception.toString());
269 log('compilation failed'); 269 log('compilation failed');
270 return false; 270 return false;
271 } 271 }
272 tracer.close(); 272 tracer.close();
273 log('compilation succeeded'); 273 log('compilation succeeded');
274 return true; 274 return true;
275 } 275 }
276 276
277 void enableNoSuchMethod(Element element) { 277 void enableNoSuchMethod(Element element) {
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 final endOffset = end.charOffset + end.slowCharCount; 894 final endOffset = end.charOffset + end.slowCharCount;
895 895
896 // [begin] and [end] might be the same for the same empty token. This 896 // [begin] and [end] might be the same for the same empty token. This
897 // happens for instance when scanning '$$'. 897 // happens for instance when scanning '$$'.
898 assert(endOffset >= beginOffset); 898 assert(endOffset >= beginOffset);
899 return f(beginOffset, endOffset); 899 return f(beginOffset, endOffset);
900 } 900 }
901 901
902 String toString() => 'SourceSpan($uri, $begin, $end)'; 902 String toString() => 'SourceSpan($uri, $begin, $end)';
903 } 903 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/compile_time_constants.dart ('k') | lib/compiler/implementation/dart2js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698