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

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

Issue 2184303002: Make pub strong-mode clean. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Code review changes 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
« no previous file with comments | « lib/src/command_runner.dart ('k') | lib/src/entrypoint.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 /// A library for compiling Dart code and manipulating analyzer parse trees. 5 /// A library for compiling Dart code and manipulating analyzer parse trees.
6 import 'dart:async'; 6 import 'dart:async';
7 import 'dart:io'; 7 import 'dart:io';
8 import 'dart:isolate'; 8 import 'dart:isolate';
9 9
10 import 'package:analyzer/analyzer.dart'; 10 import 'package:analyzer/analyzer.dart';
(...skipping 16 matching lines...) Expand all
27 /// The URI to the root directory where "dart:" libraries can be found. 27 /// The URI to the root directory where "dart:" libraries can be found.
28 /// 28 ///
29 /// This is used as the base URL to generate library URLs that are then sent 29 /// This is used as the base URL to generate library URLs that are then sent
30 /// back to [provideInput]. 30 /// back to [provideInput].
31 Uri get libraryRoot; 31 Uri get libraryRoot;
32 32
33 /// Given [uri], responds with a future that completes to the contents of 33 /// Given [uri], responds with a future that completes to the contents of
34 /// the input file at that URI. 34 /// the input file at that URI.
35 /// 35 ///
36 /// The future can complete to a string or a list of bytes. 36 /// The future can complete to a string or a list of bytes.
37 Future/*<String | List<int>>*/ provideInput(Uri uri); 37 Future provideInput(Uri uri);
38 38
39 /// Reports a diagnostic message from dart2js to the user. 39 /// Reports a diagnostic message from dart2js to the user.
40 void handleDiagnostic(Uri uri, int begin, int end, String message, 40 void handleDiagnostic(Uri uri, int begin, int end, String message,
41 compiler.Diagnostic kind); 41 compiler.Diagnostic kind);
42 42
43 /// Given a [name] (which will be "" for the entrypoint) and a file extension, 43 /// Given a [name] (which will be "" for the entrypoint) and a file extension,
44 /// returns an [EventSink] that dart2js can write to to emit an output file. 44 /// returns an [EventSink] that dart2js can write to to emit an output file.
45 EventSink<String> provideOutput(String name, String extension); 45 EventSink<String> provideOutput(String name, String extension);
46 } 46 }
47 47
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 }); 185 });
186 186
187 var response = await port.first; 187 var response = await port.first;
188 if (response['type'] == 'error') { 188 if (response['type'] == 'error') {
189 throw new CrossIsolateException.deserialize(response['error']); 189 throw new CrossIsolateException.deserialize(response['error']);
190 } 190 }
191 191
192 if (snapshot == null) return; 192 if (snapshot == null) return;
193 193
194 ensureDir(p.dirname(snapshot)); 194 ensureDir(p.dirname(snapshot));
195 var snapshotArgs = []; 195 var snapshotArgs = <String>[];
196 if (packageRoot != null) snapshotArgs.add('--package-root=$packageRoot'); 196 if (packageRoot != null) snapshotArgs.add('--package-root=$packageRoot');
197 snapshotArgs.addAll(['--snapshot=$snapshot', dartPath]); 197 snapshotArgs.addAll(['--snapshot=$snapshot', dartPath]);
198 var result = await runProcess(Platform.executable, snapshotArgs); 198 var result = await runProcess(Platform.executable, snapshotArgs);
199 199
200 if (result.success) return; 200 if (result.success) return;
201 201
202 // Don't emit a fatal error here, since we don't want to crash the 202 // Don't emit a fatal error here, since we don't want to crash the
203 // otherwise successful isolate load. 203 // otherwise successful isolate load.
204 log.warning("Failed to compile a snapshot to " 204 log.warning("Failed to compile a snapshot to "
205 "${p.relative(snapshot)}:\n" + result.stderr.join("\n")); 205 "${p.relative(snapshot)}:\n" + result.stderr.join("\n"));
(...skipping 13 matching lines...) Expand all
219 Isolate.spawnUri(Uri.parse(message['uri']), [], message['message'], 219 Isolate.spawnUri(Uri.parse(message['uri']), [], message['message'],
220 packageRoot: packageRoot) 220 packageRoot: packageRoot)
221 .then((_) => replyTo.send({'type': 'success'})) 221 .then((_) => replyTo.send({'type': 'success'}))
222 .catchError((e, stack) { 222 .catchError((e, stack) {
223 replyTo.send({ 223 replyTo.send({
224 'type': 'error', 224 'type': 'error',
225 'error': CrossIsolateException.serialize(e, stack) 225 'error': CrossIsolateException.serialize(e, stack)
226 }); 226 });
227 }); 227 });
228 } 228 }
OLDNEW
« no previous file with comments | « lib/src/command_runner.dart ('k') | lib/src/entrypoint.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698