| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 pub.dart2js_transformer; | 5 library pub.dart2js_transformer; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 | 9 |
| 10 import 'package:analyzer/analyzer.dart'; | 10 import 'package:analyzer/analyzer.dart'; |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 | 265 |
| 266 /// A [CompilerInputProvider] for dart2js. | 266 /// A [CompilerInputProvider] for dart2js. |
| 267 Future<String> provideInput(Uri resourceUri) { | 267 Future<String> provideInput(Uri resourceUri) { |
| 268 // We only expect to get absolute "file:" URLs from dart2js. | 268 // We only expect to get absolute "file:" URLs from dart2js. |
| 269 assert(resourceUri.isAbsolute); | 269 assert(resourceUri.isAbsolute); |
| 270 assert(resourceUri.scheme == "file"); | 270 assert(resourceUri.scheme == "file"); |
| 271 | 271 |
| 272 var sourcePath = path.fromUri(resourceUri); | 272 var sourcePath = path.fromUri(resourceUri); |
| 273 return _readResource(resourceUri).then((source) { | 273 return _readResource(resourceUri).then((source) { |
| 274 _sourceFiles[resourceUri.toString()] = | 274 _sourceFiles[resourceUri.toString()] = |
| 275 new StringSourceFile(path.relative(sourcePath), source); | 275 new StringSourceFile(resourceUri, path.relative(sourcePath), source); |
| 276 return source; | 276 return source; |
| 277 }); | 277 }); |
| 278 } | 278 } |
| 279 | 279 |
| 280 /// A [CompilerOutputProvider] for dart2js. | 280 /// A [CompilerOutputProvider] for dart2js. |
| 281 EventSink<String> provideOutput(String name, String extension) { | 281 EventSink<String> provideOutput(String name, String extension) { |
| 282 // TODO(rnystrom): Do this more cleanly. See: #17403. | 282 // TODO(rnystrom): Do this more cleanly. See: #17403. |
| 283 if (!generateSourceMaps && extension.endsWith(".map")) { | 283 if (!generateSourceMaps && extension.endsWith(".map")) { |
| 284 return new NullSink<String>(); | 284 return new NullSink<String>(); |
| 285 } | 285 } |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 } | 408 } |
| 409 } | 409 } |
| 410 | 410 |
| 411 /// An [EventSink] that discards all data. Provided to dart2js when we don't | 411 /// An [EventSink] that discards all data. Provided to dart2js when we don't |
| 412 /// want an actual output. | 412 /// want an actual output. |
| 413 class NullSink<T> implements EventSink<T> { | 413 class NullSink<T> implements EventSink<T> { |
| 414 void add(T event) {} | 414 void add(T event) {} |
| 415 void addError(errorEvent, [StackTrace stackTrace]) {} | 415 void addError(errorEvent, [StackTrace stackTrace]) {} |
| 416 void close() {} | 416 void close() {} |
| 417 } | 417 } |
| OLD | NEW |