Commit Graph

41 Commits

Author SHA1 Message Date
Jenny Messerly 472c898c87 [dartdevc] fix for-in loop variable shadowing a var used in initialzer
Dart for-in loops allow `var x = [1]; for (var x in x) {}`, which is not
allowed in JS. If this pattern is detected, a temporary variable is
introduced so the for-in initializer expression is evaluated outside of
the JS for-of loop.

(This issue seems to be unique to for-in loops. For loops and other
kinds of variable declarations of the form `var x = ...` are not
allowed to use `x` in the initializer, even if `x` is declared in an
outer scope.)

Also fixes an out-of-date comment in the DDC+Analyzer backend.

Change-Id: I35b272a5a311f7b6f104cc82a99cc83a6ed5c247
Reviewed-on: https://dart-review.googlesource.com/c/79142
Commit-Queue: Alan Knight <alanknight@google.com>
Auto-Submit: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Alan Knight <alanknight@google.com>
2018-10-11 17:07:39 +00:00
Jenny Messerly f320477ff9 [dartdevc] add module-name option to kernel backend
This name is not used by most module formats, but we do use it with the
legacy format.

Change-Id: I8d2f36b12a60b37d0460b57d5a360ba21b4e0476
Reviewed-on: https://dart-review.googlesource.com/c/78923
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jenny Messerly <jmesserly@google.com>
2018-10-10 18:09:03 +00:00
Jenny Messerly 1a122e3ac0 Deprecate module-root option in dartdevc, part of #32272
Adds an option for specifying the output JS module name if that is
needed (only applies for some module formats).

Also removes repl-compile (it's set via API, not the command line).

Refactors dartdevk options to match dartdevc so we can migrate more
easily. Moves shared code into a shared location and removes copied
code.

Change-Id: I966343ecbbc962f5d0f14ea7e65d78660159f420
Reviewed-on: https://dart-review.googlesource.com/64823
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2018-07-26 02:43:48 +00:00
Nate Bosch 906647c046 Fix Dart 2 runtime issue on DDC for the web
`CommandRunner.run` will return a `Future<T>` and in this case the `T`
is `dynamic`.

Change-Id: Ief156cfc298d3747da805c26e81d34ed7628d00b
Reviewed-on: https://dart-review.googlesource.com/66520
Reviewed-by: Jenny Messerly <jmesserly@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
2018-07-25 00:54:11 +00:00
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 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 053a594c9e Remove package:browser usage in DDC repl extension code
Change-Id: I4433fd44daca07d7a2d8f405d5940341719ed3de
Reviewed-on: https://dart-review.googlesource.com/46704
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
2018-03-15 01:42:12 +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
Vijay Menon 34f8c356a3 Fix sdk stack trace mapping so tools recognize it
This should fix #32389

Change-Id: I1e6f1a7aea852abb9b2b4a9bf851941a8e0c91e7
Reviewed-on: https://dart-review.googlesource.com/44840
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Vijay Menon <vsm@google.com>
2018-03-02 19:46:49 +00:00
Vijay Menon ea7c7988e3 Don't inline source maps into the SDK
Change-Id: Ia4e8673cf0c023353b27a3c0a947b09e04ec09c0
Reviewed-on: https://dart-review.googlesource.com/44320
Reviewed-by: Jenny Messerly <jmesserly@google.com>
Commit-Queue: Vijay Menon <vsm@google.com>
2018-03-01 03:21:37 +00:00
Jacob MacDonald 0bda5c9015 get source_map_stack_trace working for the external world
Bug:
Change-Id: I7385f2f1f11742ce5f90cce67b863ba066074679
Reviewed-on: https://dart-review.googlesource.com/41921
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2018-02-15 22:45:26 +00:00
Alan Knight 19ac7a0df3 Add withCredentials: true to the SDK request in DDC web compilation
Bug:
Change-Id: Ica9e3e9f6160562090a62f584a5c9b2d851edf36
Reviewed-on: https://dart-review.googlesource.com/30628
Reviewed-by: Jacob Richman <jacobr@google.com>
Commit-Queue: Alan Knight <alanknight@google.com>
2017-12-20 19:05:42 +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
Vijay Menon f95daf6168 Fix DDC stack trace mapping
This supersedes https://dart-review.googlesource.com/c/sdk/+/4614.

Patch 1 is the unmodified source_map_stack_trace.dart. Patch 2 is my fixes for DDC.

Change-Id: I30c6fad4bdc75061edbacc5fc75482af98e29bbb
Reviewed-on: https://dart-review.googlesource.com/4960
Reviewed-by: Jacob Richman <jacobr@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Vijay Menon <vsm@google.com>
2017-09-11 21:52:41 +00:00
Konstantin Shcheglov 5b29ae48ad Don't record dependencies in SummaryDataStore.
It was added for DDC, but DDC does not use it anymore. At the same time,
URIs operations are expensive, and this code is showing in Observatory.

R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2996783002 .
2017-08-09 17:45:13 -07:00
Devon Carew a7c3358378 Remove an unused symbol analysis warning.
BUG=
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2911983009 .
2017-05-30 18:06:11 -07:00
Jacob Richman 65e0b8994e Add progress events for loading DDC summaries to make it clear to users whether loading a DDC application has timed out.
BUG=
R=alanknight@google.com

Review-Url: https://codereview.chromium.org/2879843004 .
2017-05-15 08:41:00 -07:00
Jacob Richman b280a7803d Dev compiler debugger related tweaks.
Optimize dynamic call tracking using random sampling.
Apply source maps to improve dynamic call tracking accuracy.
Dynamic calls within the sdk are now attributed correctly.

Fix bug formatting modules where we were incorrectly flagging them as JS.

BUG=
R=jmesserly@google.com, vsm@google.com

Review-Url: https://codereview.chromium.org/2811343002 .
2017-04-17 14:57:31 -07:00
Jennifer Messerly 132ddcaacf fix errors and warnings in DDC
TBR=vsm@google.com,jacobr@google.com

Review-Url: https://codereview.chromium.org/2768693003 .
2017-03-21 20:12:05 -07:00
Jacob Richman 9484ac8bdf Format all dart dev compiler files
BUG=
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2752163002 .
2017-03-15 21:34:25 -07:00
Jacob Richman 2ec1890ac4 Tweak location sdk summary is accessed from.
Bazel build rules now place the sdk summary in a different directory
than the summary root directory. Fix the ddc compiler running in the
browser to match.

BUG=
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2753723002 .
2017-03-14 17:41:50 -07:00
Devon Carew b80390d0f5 Have dartdevc support --version.
BUG=
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2747743003 .
2017-03-13 16:10:21 -07:00
Jacob Richman c9675aeefb Do not return the JSON as an escaped String to work around a strange v8 bug.
This makes the source files a little easier to read anyway and the JSON
is not typically that nested so there should be a minimal statup performance hit.

Do not return the JSON as an escaped String to work around a strange v8 bug.

BUG=
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2747733003 .
2017-03-13 15:49:09 -07:00
Jacob Richman 1f38879094 Inline source maps as part of each script.
Unfortunately this is required as even with ideal caching, performing
XHRs to load all source maps increased load times by ~5 seconds for large
applications. Performance hit is now minimal.

BUG=

Review-Url: https://codereview.chromium.org/2747513003 .
Review-Url: https://codereview.chromium.org/2746033003 .
2017-03-13 10:46:02 -07:00
Jacob Richman 7ba7e0cee6 Make all DDC internal stack traces apply source maps.
Make DDC a better platform for debugging by ensuring that stack traces
generated by DDC even when using the raw dart:core StackTrace class
apply JS source maps and benefit from the polish provided by the
stack_trace package.

stack_trace_mapper.dart needs to be compiled to js and included on your
page to benefit from this functionality. Otherwise you will still see
regular JS stack traces as usual.

BUG=
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2735303002 .
2017-03-08 19:13:00 -08:00
Jacob Richman a1b8c1c6d5 Extend the API exposed to JS to include a method that resolves urls against the summaryDataStore finding the closest match to a file with a summary or returning null if no urls match the path.
Update dev_compiler web project to work with latest analyzer changes.

Tweak API to work better with new summary paths and small polish items.

BUG=
R=jmesserly@google.com

Review-Url: https://codereview.chromium.org/2713773004 .
2017-02-23 11:29:10 -08:00
Vijay Menon d5e5feb686 Shut up bad analyzer warning
This is a workaround for #28507

TBR=leafp@google.com

Review-Url: https://codereview.chromium.org/2667753003 .
2017-01-31 10:08:47 -08:00
Dan Rubel 55ef6e193c support --options flag and other analysis options flags in DDC
This updates DDC options processing to support:
* --options /path/to/analysis/options/file.yaml
* --enable-strict-call-checks
* --supermixin
* --no-implicit-casts
* --no-implicit-dynamic

As well as general refactoring and cleanup of DDC options processing

R=vsm@google.com

Review-Url: https://codereview.chromium.org/2598593003 .
2017-01-04 18:15:21 -05:00
Dan Rubel 13bd1ad0bf DDC/AnalyzerCLI common cmdline option processing
Refactor DDC and Analyzer CLI command line option processing
to use common createContextBuilderOptions method
and ContextBuilderOptions to hold common options.

R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2584293003 .
2016-12-19 16:24:20 -05:00
Jennifer Messerly 2e8d011ca3 fix #27607, add dev_compiler summary to the SDK and move JS files
R=vsm@google.com

Review URL: https://codereview.chromium.org/2474523003 .
2016-11-01 18:17:43 -07:00
Jacob Richman 4f6ce11bc8 Emulate compiling a source file in the context of an existing library. Add --debugger-compile flag that performs permissive dynamic calls on private members. Polish web_command.dart adding the ability to evaluate code in the context of an existing library.
BUG=
R=brianwilkerson@google.com, jmesserly@google.com

Review URL: https://codereview.chromium.org/2423313002 .
2016-10-18 16:34:48 -07:00
Jacob Richman d858c4f2ae Fix build break.
BUG=
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/2346573002 .
2016-09-14 13:07:34 -07:00
Vijay Menon e52613f151 Fix error message
R=jacobr@google.com

Review URL: https://codereview.chromium.org/2329493002 .
2016-09-09 09:02:50 -07:00
John Messerly 48817e61f7 fix strong mode messages in pkg/dev_compiler
R=vsm@google.com

Review URL: https://codereview.chromium.org/2314193002 .
2016-09-07 09:06:24 -07:00
Jacob Richman 38724f0626 Update web_command code so that it continues to use the legacy module loader. Drive by removal of misleading comments.
BUG=
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/2303163002 .
2016-09-06 09:57:05 -07:00
Vijay Menon 2bc19eaa64 Remove deprecated code
Updating to the latest analyzer.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2289263004 .
2016-08-30 15:39:38 -07:00
John Messerly c1139934a7 fix #626, add AMD module format and make it default
R=nweiz@google.com, vsm@google.com

Review URL: https://codereview.chromium.org/2249233002 .
2016-08-25 09:39:36 -07:00
Priscilla Lee 386ad0aea4 Removed copy of dart sdk summaries. No longer needed to run the dev compiler in the browser.
BUG=

Review URL: https://codereview.chromium.org/2230743002 .
2016-08-10 10:01:16 -07:00
John Messerly 94085a662e a few cleanups to get IDE message clean
R=priscillalee@google.com

Review URL: https://codereview.chromium.org/2221253003 .
2016-08-09 13:40:45 -07:00
Priscilla Lee 1233b35daa Restructured the set up for the compiling function. Also added room for list of additional summaries.
BUG=
R=jacobr@google.com, jmesserly@google.com

Review URL: https://codereview.chromium.org/2208243002 .
2016-08-09 10:40:35 -07:00
Priscilla Lee d2ec49d1f7 Working compiler in browser.
BUG=
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/2183603003 .
2016-07-29 09:18:13 -07:00