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

Side by Side Diff: lib/src/transformer/asset_source.dart

Issue 1788973002: Remove code that requires whole-program compile (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: merged Created 4 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
« no previous file with comments | « lib/src/summary.dart ('k') | lib/src/transformer/asset_universe.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'package:analyzer/src/generated/engine.dart';
6 import 'package:analyzer/src/generated/source.dart' show Source, UriKind;
7 import 'package:barback/barback.dart' show Asset, TimestampedData;
8 import 'package:path/path.dart' as path;
9
10 class AssetSource implements Source {
11 final Uri uri;
12 final Asset asset;
13 final String contentString;
14 AssetSource(this.uri, this.asset, this.contentString);
15
16 @override
17 toString() => 'AssetSource($uri, ${asset.id})';
18
19 @override
20 TimestampedData<String> get contents =>
21 new TimestampedData(modificationStamp, contentString);
22
23 @override
24 String get encoding => null;
25
26 @override
27 bool exists() => true;
28
29 @override
30 String get fullName => uri.toString();
31
32 @override
33 bool get isInSystemLibrary => uriKind == UriKind.DART_URI;
34
35 @override
36 int get modificationStamp => 0;
37
38 @override
39 Uri resolveRelativeUri(Uri relativeUri) {
40 var resolvedPath = path.join(path.dirname(uri.path), relativeUri.path);
41 return new Uri(scheme: uri.scheme, path: resolvedPath);
42 }
43
44 @override
45 String get shortName => uri.toString();
46
47 @override
48 Source get source => this;
49
50 @override
51 UriKind get uriKind {
52 switch (uri.scheme) {
53 case 'package':
54 return UriKind.PACKAGE_URI;
55
56 case 'dart':
57 return UriKind.DART_URI;
58
59 case 'file':
60 return UriKind.FILE_URI;
61
62 default:
63 throw new StateError(uri.toString());
64 }
65 }
66 }
OLDNEW
« no previous file with comments | « lib/src/summary.dart ('k') | lib/src/transformer/asset_universe.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698