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

Side by Side Diff: USAGE.md

Issue 1157093004: Added Usage instructions (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Minor fix Created 5 years, 6 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 | « README.md ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Usage
2
3 The [Dart Dev Compiler](README.md) (DDC) is an **experimental**
4 development tool and transpiler. In particular, the ES6 backend is
5 still incomplete, under heavy development, and not yet ready for
6 production use.
7
8 With those caveats, we welcome feedback.
9
10 ## Installation
11
12 You can install DDC via pub:
13
14 $ pub global activate -sgit https://github.com/dart-lang/dev_compiler.git
15
16 The above will install a `dartdevc` executable. To update to the
17 latest DDC, you can just re-run this step.
18
19 ## Running the static checker
20
21 By default, DDC runs in static checking mode. The DDC checker is strictly stron ger than the standard Dart
22 analyzer: it reports extra errors and warnings. For example, given the followin g `main.dart`:
23
24 ```dart
25 void main() {
26 List<String> list = ["hello", "world"];
27
28 for (var item in list) {
29 print(item + 42);
30 }
31 }
32 ```
33
34 the Dart analyzer will not report a static error or warning even
35 though the program will clearly fail (in checked mode). Running DDC:
36
37 $ dartdevc main.dart
38
39 will display a severe error. Modifying `42` to `'42'` will
40 correct the error.
41
42 ## Generating ES6
43
44 For code that statically type checks, DDC can be used to generate EcmaScript 6 ( ES6) code:
45
46 $ dartdevc -o out main.dart
47
48 The generated output will be in 'out/foo.js'. DDC generates one ES6
49 file per library. It is a modular compiler: the whole program is not
50 necessary.
51
52 ## Running in Server Mode
53
54 DDC output may be tested most easily in [Chrome
55 Canary](https://www.google.com/chrome/browser/canary.html). Launch a
56 local server via:
57
58 $ dartdevc --server main.dart
59
60 ## Testing in Chrome Canary
61
62 Launch Chrome Canary at the URL shown by the above. You will need to
63 explicitly enable ES6 (harmony) features: this can be done via the
64 command line. E.g., on a Mac:
65
66 $ /Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Ca nary --js-flags="--harmony-arrow-functions --harmony-classes --harmony-computed- property-names" http://localhost:8080
67
68 Remember to open the Developer Tools to see the output of a print.
69
70 DDC does not yet support ```dart:html```, but it does allow raw access
71 to the JavaScript DOM. See our [modified version](https://github.com/dart-lang/ dev_compiler/blob/master/test/codegen/sunflower/sunflower.dart) of Dart Sunflowe r for
72 an example.
73
74 ## Feedback
75
76 Please file issues in our [GitHub issue tracker](https://github.com/dart-lang/de v_compiler/issues).
77
78 You can also view or join our [mailing list](https://groups.google.com/a/dartlan g.org/forum/#!forum/dev-compiler).
79
80
81
OLDNEW
« no previous file with comments | « README.md ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698