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

Side by Side Diff: pkg/fletchc/lib/src/verbs/create_verb.dart

Issue 1659163007: Rename fletch -> dartino (Closed) Base URL: https://github.com/dartino/sdk.git@master
Patch Set: address comments Created 4 years, 10 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 | « pkg/fletchc/lib/src/verbs/compile_verb.dart ('k') | pkg/fletchc/lib/src/verbs/debug_verb.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) 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.create_verb;
6
7 import 'infrastructure.dart';
8
9 import '../worker/developer.dart' show
10 Settings,
11 allocateWorker,
12 configFileUri,
13 createSessionState,
14 createSettings;
15
16 import 'documentation.dart' show
17 createDocumentation;
18
19 const Action createAction = const Action(
20 create, createDocumentation, requiresTargetSession: true,
21 supportsWithUri: true);
22
23 Future<int> create(AnalyzedSentence sentence, VerbContext context) async {
24 IsolatePool pool = context.pool;
25 String name = sentence.targetName;
26
27 UserSession session = await createSession(name, () => allocateWorker(pool));
28
29 context = context.copyWithSession(session);
30
31 return await context.performTaskInWorker(
32 new CreateSessionTask(
33 name, sentence.withUri, sentence.base, configFileUri));
34 }
35
36 class CreateSessionTask extends SharedTask {
37 // Keep this class simple, see note in superclass.
38
39 final String name;
40
41 final Uri settingsUri;
42
43 final Uri base;
44
45 final Uri configFileUri;
46
47 const CreateSessionTask(
48 this.name, this.settingsUri, this.base, this.configFileUri);
49
50 Future<int> call(
51 CommandSender commandSender,
52 StreamIterator<ClientCommand> commandIterator) {
53 return createSessionTask(
54 commandSender, commandIterator, name, settingsUri, base, configFileUri);
55 }
56 }
57
58 Future<int> createSessionTask(
59 CommandSender commandSender,
60 StreamIterator<ClientCommand> commandIterator,
61 String name,
62 Uri settingsUri,
63 Uri base,
64 Uri configFileUri) async {
65 assert(SessionState.internalCurrent == null);
66 Settings settings = await createSettings(
67 name, settingsUri, base, configFileUri, commandSender, commandIterator);
68 SessionState state = createSessionState(name, settings);
69 SessionState.internalCurrent = state;
70 if (settingsUri != null) {
71 state.log("created session with $settingsUri $settings");
72 } else {
73 state.log("created session with settings $settings");
74 }
75 return 0;
76 }
OLDNEW
« no previous file with comments | « pkg/fletchc/lib/src/verbs/compile_verb.dart ('k') | pkg/fletchc/lib/src/verbs/debug_verb.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698