| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'package:analyzer/src/generated/engine.dart'; | 5 import 'package:analyzer/src/generated/engine.dart'; |
| 6 import 'package:analyzer/src/generated/source.dart' show Source, UriKind; | 6 import 'package:analyzer/src/generated/source.dart' show Source, UriKind; |
| 7 import 'package:barback/barback.dart' show Asset, TimestampedData; | 7 import 'package:barback/barback.dart' show Asset, TimestampedData; |
| 8 import 'package:path/path.dart' as path; | 8 import 'package:path/path.dart' as path; |
| 9 | 9 |
| 10 class AssetSource implements Source { | 10 class AssetSource implements Source { |
| 11 final Uri uri; | 11 final Uri uri; |
| 12 final Asset asset; | 12 final Asset asset; |
| 13 final String contentString; | 13 final String contentString; |
| 14 AssetSource(this.uri, this.asset, this.contentString); | 14 AssetSource(this.uri, this.asset, this.contentString); |
| 15 | 15 |
| 16 @override toString() => 'AssetSource($uri, ${asset.id})'; | 16 @override |
| 17 toString() => 'AssetSource($uri, ${asset.id})'; |
| 17 | 18 |
| 18 @override | 19 @override |
| 19 TimestampedData<String> get contents => | 20 TimestampedData<String> get contents => |
| 20 new TimestampedData(modificationStamp, contentString); | 21 new TimestampedData(modificationStamp, contentString); |
| 21 | 22 |
| 22 @override | 23 @override |
| 23 String get encoding => null; | 24 String get encoding => null; |
| 24 | 25 |
| 25 @override | 26 @override |
| 26 bool exists() => true; | 27 bool exists() => true; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 56 return UriKind.DART_URI; | 57 return UriKind.DART_URI; |
| 57 | 58 |
| 58 case 'file': | 59 case 'file': |
| 59 return UriKind.FILE_URI; | 60 return UriKind.FILE_URI; |
| 60 | 61 |
| 61 default: | 62 default: |
| 62 throw new StateError(uri.toString()); | 63 throw new StateError(uri.toString()); |
| 63 } | 64 } |
| 64 } | 65 } |
| 65 } | 66 } |
| OLD | NEW |