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

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

Issue 12610006: Renamed StreamSink to EventSink. Renamed signalError to addError. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Changed inheritance back! Now create StreamSink instead of EventSink where we create them. Created 7 years, 9 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:async'; 7 import 'dart:async';
8 import 'dart:collection' show Queue, LinkedHashMap; 8 import 'dart:collection' show Queue, LinkedHashMap;
9 import 'dart:io'; 9 import 'dart:io';
10 import 'dart:uri'; 10 import 'dart:uri';
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 'compiled ${inputProvider.dartCharactersRead} characters Dart ' 255 'compiled ${inputProvider.dartCharactersRead} characters Dart '
256 '-> $charactersWritten characters $outputLanguage ' 256 '-> $charactersWritten characters $outputLanguage '
257 'in ${relativize(cwd, out, isWindows)}'); 257 'in ${relativize(cwd, out, isWindows)}');
258 if (!explicitOut) { 258 if (!explicitOut) {
259 String input = uriPathToNative(arguments[0]); 259 String input = uriPathToNative(arguments[0]);
260 String output = relativize(cwd, out, isWindows); 260 String output = relativize(cwd, out, isWindows);
261 print('Dart file $input compiled to $outputLanguage: $output'); 261 print('Dart file $input compiled to $outputLanguage: $output');
262 } 262 }
263 } 263 }
264 264
265 StreamSink<String> outputProvider(String name, String extension) { 265 EventSink<String> outputProvider(String name, String extension) {
266 Uri uri; 266 Uri uri;
267 String sourceMapFileName; 267 String sourceMapFileName;
268 bool isPrimaryOutput = false; 268 bool isPrimaryOutput = false;
269 if (name == '') { 269 if (name == '') {
270 if (extension == 'js' || extension == 'dart') { 270 if (extension == 'js' || extension == 'dart') {
271 isPrimaryOutput = true; 271 isPrimaryOutput = true;
272 uri = out; 272 uri = out;
273 sourceMapFileName = 273 sourceMapFileName =
274 sourceMapOut.path.substring(sourceMapOut.path.lastIndexOf('/') + 1); 274 sourceMapOut.path.substring(sourceMapOut.path.lastIndexOf('/') + 1);
275 } else if (extension == 'js.map' || extension == 'dart.map') { 275 } else if (extension == 'js.map' || extension == 'dart.map') {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 return sink; 307 return sink;
308 } 308 }
309 309
310 api.compile(uri, libraryRoot, packageRoot, 310 api.compile(uri, libraryRoot, packageRoot,
311 inputProvider.readStringFromUri, handler, 311 inputProvider.readStringFromUri, handler,
312 options, outputProvider) 312 options, outputProvider)
313 .then(compilationDone); 313 .then(compilationDone);
314 } 314 }
315 315
316 // TODO(ahe): Get rid of this class if http://dartbug.com/8118 is fixed. 316 // TODO(ahe): Get rid of this class if http://dartbug.com/8118 is fixed.
317 class CountingSink implements StreamSink<String> { 317 class CountingSink implements EventSink<String> {
318 final StreamSink<String> sink; 318 final EventSink<String> sink;
319 int count = 0; 319 int count = 0;
320 320
321 CountingSink(this.sink); 321 CountingSink(this.sink);
322 322
323 add(String value) { 323 void add(String value) {
324 sink.add(value); 324 sink.add(value);
325 count += value.length; 325 count += value.length;
326 } 326 }
327 327
328 signalError(AsyncError error) => sink.signalError(error); 328 void addError(AsyncError error) { sink.signalError(error); }
329 329
330 close() => sink.close(); 330 void close() { sink.close(); }
331 } 331 }
332 332
333 class AbortLeg { 333 class AbortLeg {
334 final message; 334 final message;
335 AbortLeg(this.message); 335 AbortLeg(this.message);
336 toString() => 'Aborted due to --throw-on-error: $message'; 336 toString() => 'Aborted due to --throw-on-error: $message';
337 } 337 }
338 338
339 void writeString(Uri uri, String text) { 339 void writeString(Uri uri, String text) {
340 if (uri.scheme != 'file') { 340 if (uri.scheme != 'file') {
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 } catch (ignored) { 491 } catch (ignored) {
492 print('Internal error: error while printing exception'); 492 print('Internal error: error while printing exception');
493 } 493 }
494 try { 494 try {
495 print(trace); 495 print(trace);
496 } finally { 496 } finally {
497 exit(253); // 253 is recognized as a crash by our test scripts. 497 exit(253); // 253 is recognized as a crash by our test scripts.
498 } 498 }
499 } 499 }
500 } 500 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698