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

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

Issue 40583002: Incorporates feedback by Nicolas for UTF-8 bytes based scanner CL (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 | sdk/lib/_internal/compiler/implementation/js_backend/backend.dart » ('j') | 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:async'; 7 import 'dart:async';
8 8
9 import '../compiler.dart' as api; 9 import '../compiler.dart' as api;
10 import 'dart2jslib.dart' as leg; 10 import 'dart2jslib.dart' as leg;
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 void reportReadError(exception) { 166 void reportReadError(exception) {
167 withCurrentElement(element, () { 167 withCurrentElement(element, () {
168 reportError(node, 168 reportError(node,
169 leg.MessageKind.READ_SCRIPT_ERROR, 169 leg.MessageKind.READ_SCRIPT_ERROR,
170 {'uri': readableUri, 'exception': exception}); 170 {'uri': readableUri, 'exception': exception});
171 }); 171 });
172 } 172 }
173 173
174 Uri resourceUri = translateUri(readableUri, node); 174 Uri resourceUri = translateUri(readableUri, node);
175 // TODO(johnniwinther): Wrap the result from [provider] in a specialized 175 // TODO(johnniwinther): Wrap the result from [provider] in a specialized
176 // [Future] to ensure that we never execute an asynchronous action without s etting 176 // [Future] to ensure that we never execute an asynchronous action without
177 // up the current element of the compiler. 177 // setting up the current element of the compiler.
178 return new Future.sync(() => callUserProvider(resourceUri)) 178 return new Future.sync(() => callUserProvider(resourceUri)).then((data) {
179 .then((data) {
180 SourceFile sourceFile; 179 SourceFile sourceFile;
181 String resourceUriString = resourceUri.toString(); 180 String resourceUriString = resourceUri.toString();
182 if (data is List<int>) { 181 if (data is List<int>) {
183 sourceFile = new Utf8BytesSourceFile(resourceUriString, data); 182 sourceFile = new Utf8BytesSourceFile(resourceUriString, data);
184 } else if (data is String) { 183 } else if (data is String) {
185 sourceFile = new StringSourceFile(resourceUriString, data); 184 sourceFile = new StringSourceFile(resourceUriString, data);
186 } else { 185 } else {
187 String message = "Expected a 'String' or a 'List<int>' from the input " 186 String message = "Expected a 'String' or a 'List<int>' from the input "
188 "provider, but got: ${Error.safeToString(data)}."; 187 "provider, but got: ${Error.safeToString(data)}.";
189 reportReadError(message); 188 reportReadError(message);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 rethrow; 323 rethrow;
325 } 324 }
326 } 325 }
327 326
328 void diagnoseCrashInUserCode(String message, exception, stackTrace) { 327 void diagnoseCrashInUserCode(String message, exception, stackTrace) {
329 hasCrashed = true; 328 hasCrashed = true;
330 print('$message: ${tryToString(exception)}'); 329 print('$message: ${tryToString(exception)}');
331 print(tryToString(stackTrace)); 330 print(tryToString(stackTrace));
332 } 331 }
333 } 332 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/js_backend/backend.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698