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

Side by Side Diff: samples/pond/compiler.dart

Issue 10204007: Remove many things that depend on frog. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « samples/pond/build_pond.sh ('k') | samples/pond/editors.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) 2011, 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 /** Embeds the frog compiler as a worker isolate. */
6 #library('compiler');
7
8 #import('dart:isolate', prefix: 'isolate');
9 #import("../../frog/file_system_dom.dart");
10 #import("../../frog/lang.dart", prefix: 'frog');
11
12 main() {
13 final fileSystem = new DomFileSystem();
14 isolate.port.receive((input, replyTo) {
15 final watch = new Stopwatch.start();
16 // Each message is a compilation request.
17 fileSystem.writeString("user.dart", input['code']);
18 frog.parseOptions('../../frog', ['dummyArg1', 'dummyArg2', 'user.dart'],
19 fileSystem);
20 frog.options.useColors = false;
21 frog.options.warningsAsErrors = input['warningsAsErrors'];
22 frog.initializeWorld(fileSystem);
23
24 // Collect compilation messages
25 final warnings = [];
26 frog.world.messageHandler = (prefix, msg, span) {
27 final warning = { 'prefix': prefix, 'msg': msg};
28
29 if (span != null) {
30 warning['filename'] = span.file.filename;
31 warning['line'] = span.line;
32 warning['column'] = span.column;
33 warning['endLine'] = span.endLine;
34 warning['endColumn'] = span.endColumn;
35 warning['locationText'] = span.locationText;
36 }
37 warnings.add(warning);
38 };
39
40 bool success = frog.world.compile();
41 watch.stop();
42
43 // Send results back to the requester isolate.
44 String output = success ? frog.world.getGeneratedCode() : null;
45 replyTo.send({
46 'success': success,
47 'code': output,
48 'warnings': warnings,
49 'time': watch.elapsedInMs()});
50 });
51 }
OLDNEW
« no previous file with comments | « samples/pond/build_pond.sh ('k') | samples/pond/editors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698