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

Side by Side Diff: lib/compiler/implementation/scanner/scanner_task.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 class ScannerTask extends CompilerTask { 5 class ScannerTask extends CompilerTask {
6 ScannerTask(Compiler compiler) : super(compiler); 6 ScannerTask(Compiler compiler) : super(compiler);
7 String get name => 'Scanner'; 7 String get name => 'Scanner';
8 8
9 void scanLibrary(LibraryElement library) { 9 void scanLibrary(LibraryElement library) {
10 var compilationUnit = library.entryCompilationUnit; 10 var compilationUnit = library.entryCompilationUnit;
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 tag, 108 tag,
109 compilationUnit); 109 compilationUnit);
110 return resolved; 110 return resolved;
111 } 111 }
112 112
113 void scanElements(CompilationUnitElement compilationUnit) { 113 void scanElements(CompilationUnitElement compilationUnit) {
114 Script script = compilationUnit.script; 114 Script script = compilationUnit.script;
115 Token tokens; 115 Token tokens;
116 try { 116 try {
117 tokens = new StringScanner(script.text).tokenize(); 117 tokens = new StringScanner(script.text).tokenize();
118 } catch (MalformedInputException ex) { 118 } on MalformedInputException catch (ex) {
119 Token token; 119 Token token;
120 var message; 120 var message;
121 if (ex.position is num) { 121 if (ex.position is num) {
122 // TODO(ahe): Always use tokens in MalformedInputException. 122 // TODO(ahe): Always use tokens in MalformedInputException.
123 token = new Token(EOF_INFO, ex.position); 123 token = new Token(EOF_INFO, ex.position);
124 } else { 124 } else {
125 token = ex.position; 125 token = ex.position;
126 } 126 }
127 compiler.cancel(ex.message, token: token); 127 compiler.cancel(ex.message, token: token);
128 } 128 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 static const int RESOURCE = 4; 226 static const int RESOURCE = 4;
227 227
228 /** Next state. */ 228 /** Next state. */
229 static const List<int> NEXT = 229 static const List<int> NEXT =
230 const <int>[NO_TAG_SEEN, 230 const <int>[NO_TAG_SEEN,
231 IMPORT, // Only one library tag is allowed. 231 IMPORT, // Only one library tag is allowed.
232 IMPORT, 232 IMPORT,
233 SOURCE, 233 SOURCE,
234 RESOURCE]; 234 RESOURCE];
235 } 235 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/lib/regexp_helper.dart ('k') | lib/compiler/implementation/tools/mini_parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698