| 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 } | 193 } |
| 194 } | 194 } |
| 195 | 195 |
| 196 /// Defines an interface for dart2js to communicate with barback and pub. | 196 /// Defines an interface for dart2js to communicate with barback and pub. |
| 197 /// | 197 /// |
| 198 /// Note that most of the implementation of diagnostic handling here was | 198 /// Note that most of the implementation of diagnostic handling here was |
| 199 /// copied from [FormattingDiagnosticHandler] in dart2js. The primary | 199 /// copied from [FormattingDiagnosticHandler] in dart2js. The primary |
| 200 /// difference is that it uses barback's logging code and, more importantly, it | 200 /// difference is that it uses barback's logging code and, more importantly, it |
| 201 /// handles missing source files more gracefully. | 201 /// handles missing source files more gracefully. |
| 202 class _BarbackCompilerProvider implements dart.CompilerProvider { | 202 class _BarbackCompilerProvider implements dart.CompilerProvider { |
| 203 Uri get libraryRoot => Uri.parse("${path.toUri(_libraryRootPath)}/"); | 203 Uri get libraryRoot => |
| 204 Uri.parse("${path.toUri(path.absolute(_libraryRootPath))}/"); |
| 204 | 205 |
| 205 final AssetEnvironment _environment; | 206 final AssetEnvironment _environment; |
| 206 final Transform _transform; | 207 final Transform _transform; |
| 207 String _libraryRootPath; | 208 String _libraryRootPath; |
| 208 | 209 |
| 209 /// The map of previously loaded files. | 210 /// The map of previously loaded files. |
| 210 /// | 211 /// |
| 211 /// Used to show where an error occurred in a source file. | 212 /// Used to show where an error occurred in a source file. |
| 212 final _sourceFiles = new Map<String, SourceFile>(); | 213 final _sourceFiles = new Map<String, SourceFile>(); |
| 213 | 214 |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 } | 411 } |
| 411 } | 412 } |
| 412 | 413 |
| 413 /// An [EventSink] that discards all data. Provided to dart2js when we don't | 414 /// An [EventSink] that discards all data. Provided to dart2js when we don't |
| 414 /// want an actual output. | 415 /// want an actual output. |
| 415 class NullSink<T> implements EventSink<T> { | 416 class NullSink<T> implements EventSink<T> { |
| 416 void add(T event) {} | 417 void add(T event) {} |
| 417 void addError(errorEvent, [StackTrace stackTrace]) {} | 418 void addError(errorEvent, [StackTrace stackTrace]) {} |
| 418 void close() {} | 419 void close() {} |
| 419 } | 420 } |
| OLD | NEW |