OLD | NEW |
| (Empty) |
1 // Copyright (c) 2015, the Dartino 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.md file. | |
4 | |
5 library fletchc.verbs.export_verb; | |
6 | |
7 import 'infrastructure.dart'; | |
8 | |
9 import 'documentation.dart' show | |
10 exportDocumentation; | |
11 | |
12 import '../worker/developer.dart' show | |
13 compileAndAttachToVmThen; | |
14 | |
15 import '../worker/developer.dart' as developer; | |
16 | |
17 const Action exportAction = | |
18 const Action( | |
19 export, exportDocumentation, requiresSession: true, | |
20 requiresToUri: true, | |
21 supportedTargets: const <TargetKind>[TargetKind.FILE]); | |
22 | |
23 Future<int> export(AnalyzedSentence sentence, VerbContext context) { | |
24 return context.performTaskInWorker( | |
25 new ExportTask(sentence.targetUri, sentence.toTargetUri, sentence.base)); | |
26 } | |
27 | |
28 class ExportTask extends SharedTask { | |
29 // Keep this class simple, see note in superclass. | |
30 | |
31 final Uri script; | |
32 | |
33 final Uri snapshot; | |
34 | |
35 final Uri base; | |
36 | |
37 const ExportTask(this.script, this.snapshot, this.base); | |
38 | |
39 Future<int> call( | |
40 CommandSender commandSender, | |
41 StreamIterator<ClientCommand> commandIterator) { | |
42 return exportTask( | |
43 commandSender, commandIterator, SessionState.current, script, snapshot, | |
44 base); | |
45 } | |
46 } | |
47 | |
48 Future<int> exportTask( | |
49 CommandSender commandSender, | |
50 StreamIterator<ClientCommand> commandIterator, | |
51 SessionState state, | |
52 Uri script, | |
53 Uri snapshot, | |
54 Uri base) async { | |
55 return compileAndAttachToVmThen( | |
56 commandSender, | |
57 commandIterator, | |
58 state, | |
59 script, | |
60 base, | |
61 true, | |
62 () => developer.export(state, snapshot)); | |
63 } | |
OLD | NEW |