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

Side by Side Diff: lib/src/barback/transformer_id.dart

Issue 2256623003: Fix more strong mode errors and warnings. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Created 4 years, 4 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
OLDNEW
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 import 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:barback/barback.dart'; 7 import 'package:barback/barback.dart';
8 import 'package:source_span/source_span.dart'; 8 import 'package:source_span/source_span.dart';
9 9
10 import '../utils.dart'; 10 import '../utils.dart';
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 String serialize() => path == null ? package : '$package/$path'; 73 String serialize() => path == null ? package : '$package/$path';
74 74
75 String toString() => serialize(); 75 String toString() => serialize();
76 76
77 /// Returns the asset id for the library identified by this transformer id. 77 /// Returns the asset id for the library identified by this transformer id.
78 /// 78 ///
79 /// If `path` is null, this will determine which library to load. Unlike 79 /// If `path` is null, this will determine which library to load. Unlike
80 /// [getAssetId], this doesn't take generated assets into account; it's used 80 /// [getAssetId], this doesn't take generated assets into account; it's used
81 /// to determine transformers' dependencies, which requires looking at files 81 /// to determine transformers' dependencies, which requires looking at files
82 /// on disk. 82 /// on disk.
83 Future<AssetId> getAssetId(Barback barback) { 83 Future<AssetId> getAssetId(Barback barback) async {
84 if (path != null) { 84 if (path != null) {
85 return new Future.value(new AssetId(package, 'lib/$path.dart')); 85 return new AssetId(package, 'lib/$path.dart');
86 } 86 }
87 87
88 var transformerAsset = new AssetId(package, 'lib/transformer.dart'); 88 var transformerAsset = new AssetId(package, 'lib/transformer.dart');
89 return barback.getAssetById(transformerAsset).then((_) => transformerAsset) 89 try {
90 .catchError((e) => new AssetId(package, 'lib/$package.dart'), 90 await barback.getAssetById(transformerAsset);
91 test: (e) => e is AssetNotFoundException); 91 return transformerAsset;
92 } on AssetNotFoundException catch (_) {
93 return new AssetId(package, 'lib/$package.dart');
94 }
92 } 95 }
93 } 96 }
OLDNEW
« no previous file with comments | « lib/src/asset/dart/serialize/get_input_transform.dart ('k') | lib/src/barback/web_socket_api.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698