Commit Graph

90 Commits

Author SHA1 Message Date
Jenny Messerly 1ef4399df0 Run dartfmt --fix for dart2 on pkg/dev_compiler
This uses optional new/const and `=` in named argument defaults.

All changes are automated, except for:

- utils/dartdevc/BUILD.gn: run DDC build scripts with --preview-dart-2
- pkg/dev_compiler/tool/patch_sdk.dart: add a TODO that Analyzer doesn't
  supporting implicit const in libraries.dart
- pkg/dev_compiler/tool/input_sdk/libraries.dart: was not formatted due
  to the aforementioned Analyzer bug
- tools/bots/test_matrix.json: run DDC sourcemap suite in Dart 2 mode
- pkg/pkg.status: skip pkg/dev_compiler if running in Dart 1 mode

Change-Id: I9b80ccba0c2cc7b66efc662a0b16562e3660aee3
Reviewed-on: https://dart-review.googlesource.com/60402
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2018-06-15 00:28:13 +00:00
Jenny Messerly 976aa4074b Run dartdevk against its own compiled SDK and packages
Currently we test dartdevk against SDK/packages that were compiled with
dartdevc (DDC+Analyzer). This CL migrates to having those files compiled
with DDC+Kernel. dartdevc testing is unchanged.

Most of the fixes are around things like special optimized annotations
used in our SDK code, that were not understood by DDK. Also some inline
JS type annoations were not correct.

Change-Id: Iccf4427e4b9beffd6d97a4be654253d91f6cb89e
Reviewed-on: https://dart-review.googlesource.com/57800
Reviewed-by: Vijay Menon <vsm@google.com>
2018-06-08 19:18:34 +00:00
Jenny Messerly b07a4bc264 improve deduping of cached types in DDC/K
This works around broken FunctionTypeImpl.== in Analyzer. Also
makes DDK's type naming heuristic more consistent with DDC.

Change-Id: I09527fad681c3fdc6c66654e572e9b03c57491bd
Reviewed-on: https://dart-review.googlesource.com/37120
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Jenny Messerly <jmesserly@google.com>
2018-04-04 00:37:21 +00:00
Jenny Messerly dab7da78cd fix implicit casts in DDC
There are a few bug fixes here as well. Most notably, `.name.name`
instead of `.name` in DDK's analysis of virtual accessors. DDC/K's
handling of spread arguments in JS interop was also fairly broken
(it was generating a RestParameter instead of Spread). There's
also a lot of cleanup in js_ast as well, to make it a bit more
type safe.

Change-Id: Ia5333179e6dd0a62f20ce64a2b2b8bedf2ed7c49
Reviewed-on: https://dart-review.googlesource.com/44700
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2018-03-07 01:26:21 +00:00
Sigmund Cherem 22d3af523c Add worker support to DDK
Change-Id: I0ae333f1bd6776840b1377579377695a582c46ef
Reviewed-on: https://dart-review.googlesource.com/30623
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2017-12-20 21:16:46 +00:00
Jens Johansen b2dd8418d9 [DDC-kernel] Fix of various annoyances
* Fix possibly null-pointer at end of batch mode
 * Fix changed fileUri type in source map printer
 * Silence a few warnings in tests.

Bug:
Change-Id: Ief1b9b62205a7bc20924a9e5efc06b9c9c34896a
Reviewed-on: https://dart-review.googlesource.com/27945
Reviewed-by: Karl Klose <karlklose@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2017-12-11 08:42:17 +00:00
Jens Johansen 9bc232be12 [CFE/DDC] Create initial DDC-specific CFE entry point
This CL creates the initial DDC-specific CFE entry point.
It is currently mostly a matter of copying the DDC code for running the
front-end into the front-end, although it also applies a workaround for
making batch-mode faster.

Local timings of running
tools/test.py -mrelease -cdartdevk -rnone --strong --checked language_2
before and after change:

* Before: [05:49 | 100% | + 5136 | -    0]
* After: [00:20 | 100% | + 5136 | -    0]

Change-Id: I799b54b406970c4aa8653b71aaffa2ba476ee9d9
Reviewed-on: https://dart-review.googlesource.com/24921
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2017-12-04 14:35:02 +00:00
Jenny Messerly 384678e4b3 port DDC's code_generator to Kernel
Change-Id: I2b6a5f56a69f5d3a965aefc3f8d4550d5940ac5a
Reviewed-on: https://dart-review.googlesource.com/17980
Reviewed-by: Vijay Menon <vsm@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2017-11-04 22:17:56 +00:00
Bob Nystrom 9c0a6fd27c Add rudimentary support for dartdevk to test.dart.
It's added as a new compiler, so pass "-c dartdevk" to use it.

It doesn't support any test packages yet, so tests that, say, import
package expect won't compile. I'll work on that next, but it will
require adding some stuff to the build scripts to build .dill files for
those packages.

This does get test.dart invoking the compiler, running the resulting
test, and correctly reporting the result:

- A test that doesn't throw an exception and stays within the bounds of
  what is currently implemented in dartdevk passes.

- A test that compiles correctly but fails at runtime fails with a
  RuntimeError.

- A test that contains a compile error fails with a non-zero exit code
  and is reported as a CompileTimeError.

Change-Id: Icacbf1ff54dfe7aa4d245382d3b0aeb375cf105b
Reviewed-on: https://dart-review.googlesource.com/15420
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2017-10-20 16:00:28 +00:00
Jenny Messerly ef3ac59dd6 add a dartdevk command that compiles with the new front end
This ports a fairly large part of DDC's Analyzer-based code generator,
however most nodes are not supported yet.

The goal is to preserve all functionality of code that was ported,
except for deprecated features (e.g. mirrors, fuzzy arrows, libraryRoot).

Change-Id: I3b10d5773c7c10a740fa336720243b03c6b82529
Reviewed-on: https://dart-review.googlesource.com/10705
Reviewed-by: Vijay Menon <vsm@google.com>
2017-10-16 21:13:52 +00:00
Leaf Petersen 19a1393ae7 Address additional comments on nullability
Address some post-submit comments on a previous CL, and fix some
unrelated analyzer hints in passing.

BUG=
R=jmesserly@google.com

Review-Url: https://codereview.chromium.org/3007533002 .
2017-08-24 15:37:43 -07:00
Jennifer Messerly 62303b6711 enable batch mode for dartdevc tests, also fix status so ddc bots pass
R=rnystrom@google.com

Review-Url: https://codereview.chromium.org/2987393002 .
2017-08-03 14:39:45 -07:00
Dan Rubel 5aa30397d7 update DDC and analyzer cli preprocessArgs
* refactor Analyzer CLI and DDC to use common preprocessArgs method
* throw clear exception if trailing @file not found or cannot be read
* update preprocessArgs method to always return new list

R=brianwilkerson@google.com, vsm@google.com

Review-Url: https://codereview.chromium.org/2572813002 .
2016-12-13 14:37:22 -05:00
John Messerly 36273565e3 fixes #610, incorrect help output
R=nweiz@google.com

Review URL: https://codereview.chromium.org/2244703003 .
2016-08-12 15:06:41 -07:00
John Messerly fe360a9321 make "compile" command optional to address #505 2016-06-14 14:45:00 -07:00
John Messerly f0517c4deb Enable strong mode in DDC, fix all warnings/errors
R=leafp@google.com

Review URL: https://codereview.chromium.org/2016483002 .
2016-05-26 11:13:32 -07:00
Stephen Adams 4cf7ee3332 Use _extensionType for detecting prototype inheritance.
BUG=
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1988683004 .
2016-05-18 11:14:26 -07:00
Jacob MacDonald e18b291acd fix worker mode memory leak (#575) 2016-05-18 10:59:14 -07:00
Jacob MacDonald 486d9f50cc Move to AsyncWorkerLoop since CommandRunner.run returns a future. 2016-04-20 14:09:32 -07:00
Jacob MacDonald 4e54ff0181 Move all args to per-request for the worker, and add a test
BUG=
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1896613002 .
2016-04-18 11:17:08 -07:00
Harry Terkelsen 9f4ea0936c don't crash when given no arguments
BUG=
R=vsm@google.com

Review URL: https://codereview.chromium.org/1900693002 .
2016-04-18 09:26:10 -07:00
John Messerly 4e958f5f54 Support reading summaries in DDC
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1893603003 .
2016-04-15 13:52:18 -07:00
Jacob MacDonald 308fa5ccb4 Add bazel worker support to the dev compiler.
BUG=
R=jmesserly@google.com, vsm@google.com

Review URL: https://codereview.chromium.org/1884073003 .
2016-04-15 06:51:40 -07:00
John Messerly 0c148ecef4 Implement modular compilation
Highlights
* compile one module at a time
* use summaries to speed up compiles
* use command runner so we can add more commands later
* some long needed renames and file organization
* various other technical debt has been addressed

Lowlights
* lost node.js runner/tests (node output format still supported)
* possibly lost some closure support/workarounds (format still supported)
* needs more end-to-end tests of the new system

R=vsm@google.com

Review URL: https://codereview.chromium.org/1879373004 .
2016-04-14 11:28:12 -07:00
John Messerly 73159b6c1e Remove code that requires whole-program compile
This change removes functionality that is not part of the core Dart Dev
Compiler, in particular those features that were not designed for
incremental/modular compilation.

For a while, the primary way to use DDC will be as a compiler invoked by
a build system, e.g. make or bazel or some node.js based-build system.

We'd love to see the user functionality provided by these return.
In particular, a well designed server+watcher system would be a huge
boost to productivity!

I'll see about moving over HTML reporting to Analyzer CLI. It has a lovely UI.
Thanks to everyone who contributed these features.

The following features were removed:

* DDC transformer. Transformers require whole world, in memory files.
* DDC server. The server has its own mini-build system.
* Various kinds of reporting. These should be moved to Analyzer CLI.

Note: batch compiler and the node runner are left for now.

R=vsm@google.com

Review URL: https://codereview.chromium.org/1788973002 .
2016-03-15 11:30:50 -07:00
John Messerly aad19229e2 DDC: remove dumpInfo flag
I was hoping to get rid of SummaryReporter altogether, but it looks like it's still used by server mode.

R=vsm@google.com

Review URL: https://codereview.chromium.org/1778623002 .
2016-03-08 15:47:03 -08:00
John Messerly f43b756b2f fix #43, remove => workaround
also fixes node.js test to use a temp directory, instead of creating "tmp" under dev_compiler checkout

R=vsm@google.com

Review URL: https://codereview.chromium.org/1643523008 .
2016-02-01 12:54:58 -08:00
Olivier Chafik 07d3998cdc Before (for f(a, {b, c: c_default})):
function f(a, opts) {
    let b = opts && 'b' in opts ? opts.b : null;
    let c = opts && 'c' in opts ? opts.c : c_default;
    ...

After:
  function f(a, {b = null, c = c_default} = {}) {
    ...

Note:
- Still reverting to old code when any parameter clashes with reserved JS names (see discussion in https://github.com/dart-lang/dev_compiler/issues/392)
- When a parameter clashes with a Object.prototype property, using a clean default opts value (Object.create(null)).
- Passing opts through in aliased constructors, both for speed/concision and correctness (since default param value semantic is weird there)

BUG=
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1484263002 .
2015-12-02 21:56:35 +00:00
Vijay Menon ab19094dc8 Remove the checker and corresponding dead code
This is all logic now in the analyzer.

R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1406983003 .
2015-10-19 14:38:17 -07:00
Devon Carew 64af703b26 Implement --dump-info for batch mode.
BUG=
R=jmesserly@google.com, vsm@google.com

Review URL: https://codereview.chromium.org/1402713002 .
2015-10-13 10:31:08 -07:00
Devon Carew 318584b4ba add a --version option 2015-09-18 21:39:31 -07:00
Devon Carew 01ffd2684d finish rename of devc.dart to dartdevc.dart 2015-09-16 21:22:57 -07:00
Devon Carew 6f3710e317 catch parse exceptions from args 2015-09-16 16:33:29 -07:00
Devon Carew d3e6d3af24 support running the dev_compiler package directly 2015-09-16 16:13:11 -07:00
John Messerly 2535238ee8 fixes #276, path manipulation issues on windows. Also fixes server mode
R=leafp@google.com

Review URL: https://codereview.chromium.org/1270993002 .
2015-08-04 16:34:53 -07:00
John Messerly c5f4228119 format with dart_style 0.2.0
R=vsm@google.com

Review URL: https://codereview.chromium.org/1268813003 .
2015-07-31 09:28:05 -07:00
Olivier Chafik 8426fa9e17 Added bin/devrun.dart, which runs DDC's output with iojs or d8 (issue #225) 2015-07-29 14:17:56 +01:00
John Messerly 49d101c1c4 format with dart_style 0.2.0-rc.3
this unblocks null aware ops

R=vsm@google.com

Review URL: https://codereview.chromium.org/1266483003 .
2015-07-28 18:19:55 -07:00
John Messerly 60aba749ca fixes #219, able to compile multiple entry points
also speeds up codegen_test by reusing the analysis context
BatchCompiler is pretty close to how analyzer_cli works now (other than missing features)

R=vsm@google.com

Review URL: https://codereview.chromium.org/1235503010.
2015-07-16 17:41:33 -07:00
John Messerly c4267e5d35 analyzer fixes
found these in the "dart analysis" tool window
(after excluding test files and such)

R=vsm@google.com

Review URL: https://codereview.chromium.org/1239803005.
2015-07-15 10:00:20 -07:00
John Messerly b1e92bfcaf simplify computing of runtime file location
R=vsm@google.com

Review URL: https://codereview.chromium.org/1223113005.
2015-07-15 09:58:26 -07:00
John Messerly 8f4db8f514 expose strong checker API, for use by analyzer_cli
most of the changes here are around making options sane(r), which fixes #204

R=vsm@google.com

Review URL: https://codereview.chromium.org/1174643003.
2015-06-11 07:47:12 -07:00
John Messerly 01d39ba3f2 cleanup: simplify creation of AnalysisContext
removes TypeResolver class, introduces function to create analysis context, simplifies a few other things around mock vs real SDK sources.

R=vsm@google.com

Review URL: https://codereview.chromium.org/1143683002
2015-05-18 10:20:29 -07:00
John Messerly f728691ac8 Fixes #179 -- compile error if editing files during server mode
this avoids reloading file contents many times during a compile. `.contents.data` == bad!
also fixes #73, using Analyzer's LineInfo instead of FileSpan to avoid finding line breaks over and over
I did some manual testing on sunflower as well as diffing SDK messages before and after

The one baseline change (23 -> 22) seems more accurate than it was before.

R=vsm@google.com

Review URL: https://codereview.chromium.org/1141013002
2015-05-14 16:42:33 -07:00
Sigmund Cherem 6d9564b4ff Support browser caching using hashes in serverMode (fixes #93, fixes #92).
Now the HTML can include a hash in the URL for cachable resources, and the serve knows how to include cache-control headers.

In the process of doing so, I had to change a couple things that made it possible to fix #92 as well (producing different output in the command-line than in server mode).

R=vsm@google.com

Review URL: https://codereview.chromium.org/993213003
2015-03-10 18:27:23 -07:00
Sigmund Cherem 4e4dd98e6b Add widget to display errors, and report graph errors correctly.
This fixes the compiler so that all error messages in dependency_graph are reported via the reporter and unifies how errors are constructed in other places as well. With all errors reported together, we use a widget (adapted from polymer) to display the error messages as part of the app in server mode.

R=vsm@google.com

Review URL: https://codereview.chromium.org/988483006
2015-03-09 11:37:22 -07:00
John Messerly 6e824067a3 rename ddc -> dev_compiler, fixes #84
R=sigmund@google.com

Review URL: https://codereview.chromium.org/967933005
2015-03-04 11:12:19 -08:00
Sigmund Cherem 7dd29efd8f Initial cut for a development server
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/973433003
2015-03-04 09:40:06 -08:00
Sigmund Cherem 9b00a0ecd2 Move argument parsing also to the options.dart file, adds fields for flags we were not storing in the CompilerOptions object.
R=vsm@google.com

Review URL: https://codereview.chromium.org/961503002
2015-02-25 16:40:20 -08:00
Sigmund Cherem e57c960817 rename package:ddc to package:dev_compiler
BUG=
R=vsm@google.com

Review URL: https://codereview.chromium.org/954773003
2015-02-24 17:01:15 -08:00