This disables most runtime features of dart:isolate, similar to dart:io.
For now, this supports `new ReceivePort()` and `ReceivePort.close` as
those are used by async tests to keep the Dart VM alive. Those are
no-ops in DDC. Also removes most of dart:_isolate_helper, except for
the JS API that's used to bootstrap DDC `main()`.
Change-Id: I84eab6cd39d05a70a6afe982e952076ddaaa8c0f
Reviewed-on: https://dart-review.googlesource.com/45754
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Translate assert statements in async functions. The translation of
the condition subexpression can produce a sequence of statements that
have been hoisted out of it. These need to be guarded so they are
executed only when asserts are enabled.
For this purpose, we introduce an AssertBlock. The semantics of the
assert block:
assert { s0; ...; sn; }
is the same as:
if (assertsEnabled) { s0; ...; sn; }
where assertsEnabled is a more primitive nullary expression that is
true iff. assertions are enabled. We chose not to encode this using a
construct like assertsEnabled because (1) we would have to support it
appearing as an arbitrary expression which we don't currently need
and (2) it requires deeper pattern matching to detect and skip the
guarded code when desired.
The translation is more complicated because if there is a message
subexpression in an assert, it is conditionally evaluated only if the
assert's condition is false.
Fixes https://github.com/dart-lang/sdk/issues/28498
Change-Id: I0912a57104ede3160533e49f65b6fb79b76f1500
Reviewed-on: https://dart-review.googlesource.com/46442
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
This bug prevented various DDC features from working correctly at
runtime, such as tearoffs, dynamic call checking, generic methods, and
parameter type checks.
Change-Id: I02cd27abbcb1d5f42b9d4ac504c7dd8bc80c866a
Reviewed-on: https://dart-review.googlesource.com/45960
Reviewed-by: Vijay Menon <vsm@google.com>
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>
We use renamable variables for Dart libraries, this ensures we still
export it with the correct name.
Change-Id: I96dc161e33d265c0ffbd07f8d642629504dffe62
Reviewed-on: https://dart-review.googlesource.com/42892
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
This generates string.length instead of string[dartx.length]. Will
do same kernel side if this looks good.
Change-Id: I1fed3ca3febfa441ba36a0be34d06ab9e2e103c8
Reviewed-on: https://dart-review.googlesource.com/44280
Commit-Queue: Vijay Menon <vsm@google.com>
Reviewed-by: Jenny Messerly <jmesserly@google.com>
We were avoiding it in most cases, but a few slipped in.
Also refactors a few `uri.toString() == value` to test the scheme and
path, avoiding the expensive `Uri.toString()` call.
Change-Id: I7500a1fa9139b0cc0f2d5bd6d899f6563ec402b8
Reviewed-on: https://dart-review.googlesource.com/42463
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Jenny Messerly <jmesserly@google.com>
For example, hover now works on `async` in `async.scheduleMicrotask`:
import 'dart:async' as async;
main() {
async.scheduleMicrotask(() { print('hi'); });
}
This does not change the import line or types, as neither of those
currently supports hover.
Change-Id: I4d9d61fb4e67ebda02cc6c1ce982b35b31d799bc
Reviewed-on: https://dart-review.googlesource.com/42086
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Vijay Menon <vsm@google.com>
We already do this in most cases when we have a constructor initializer
and the field initializer is side effect free (e.g. implicit null or a
literal). But `this.` fields were not recognized as being initialized
explicitly by the constructor.
This is already working in DDC+Kernel (because `this.` parameters are
desugared).
Change-Id: I2af1a71681451adf00c1807b2c41dad874a9465a
Reviewed-on: https://dart-review.googlesource.com/41961
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Jenny Messerly <jmesserly@google.com>
This change improves DDC/DDK source maps:
- fix Analyzer backend step locations to pass all of the tests
Kernel was passing. Also improves breakpoints and code coverage.
- fix Analyzer backend to mark hover spans where possible, such as
fields, parameters, locals, `this`, properties, methods, etc.
- refactor DDC/DDK backends to emit source locations, rather than
pointers to Analyzer/Kernel tree nodes.
- unify/simplify source_map_printer between Analyzer/Kernel backends.
- source_map_printer understands JS expression nesting, marking the
innermost JS expression offset corresponding to a given Dart offset.
This preserves hover tooltips, even for expressions with implicit
coercions (e.g. `dart.test(x)`)
- source_map_printer understands that JS end-of-function markings need
to be before the closing brace.
- merge _visitAndMarkExpression and _visitExpression to simplify
Analyzer & Kernel backends.
- fix test expectations where the column location was too specific.
- adds a message to the stepping test runner to help future debugging.
- removes optional destructuring support from Analyzer backend. This
was unused/untested and added complexity. Instead we should decide
if/when to fully switch to destructuring, and then do so.
Change-Id: Ic47b4e21447fffc8fb1809b7bf8ffceeeb61b43e
Reviewed-on: https://dart-review.googlesource.com/42028
Reviewed-by: Vijay Menon <vsm@google.com>
This gets DDC and DDK to handle the block body of functions/methods in a
similar way, eliminating it from the JS if it is not necessary, and fixes
a bug in DDC for cases where we do need to emit a nested block scope.
Change-Id: I37d3d69bfcf9b1204385cca7785601fb7d6edfc3
Reviewed-on: https://dart-review.googlesource.com/41565
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Jenny Messerly <jmesserly@google.com>
This was unintentionally regressed during a fix to field init order. It
does not typically show up in Dart code because undefined and null are
both handled, but it can break JS interop.
Change-Id: I771895826ee09bb6c5e2f9b016eb7673caf61cd1
Reviewed-on: https://dart-review.googlesource.com/40202
Reviewed-by: Vijay Menon <vsm@google.com>
Also fixes some issues with field initializers; stepping and hover
tooltips should work reasonably now.
Change-Id: I2d0e9e7e14a52ee8c020902f80f835a913f494f3
Reviewed-on: https://dart-review.googlesource.com/39860
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Changes signature of Iterable.singleWhere.
Makes LinkedHashMap no longer be a HashMap.
Change-Id: Ibd7e56e1ac03cb9fb10d19d1328d452fcd06d89f
Reviewed-on: https://dart-review.googlesource.com/32541
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
also fixes#31058, DDC failed to execute all field initializers
(already fixed this in DDK when porting code_generator).
also fixes assertion_initializer_test, it was not strong mode clean, so
it was not giving any meaningful results for runtime behavior.
Change-Id: I290b266ad77ed92851cc2d0617690c6c021182a3
Reviewed-on: https://dart-review.googlesource.com/37866
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Jenny Messerly <jmesserly@google.com>
This brings back the mixin unrolling code used by DDC's Analyzer backend,
because it handles features kernel's unrolling does not:
- constructor forwarding for all constructors
- mixin field initializers
- mixin constructor calls
- mixin aliases (mixin applications that are themselves valid mixins)
- covariance check stubs for mixin aliases
- mixable classes that have an unnamed factory constructor but no generative
constructors
Change-Id: Ibb49ec45d0feff0bd0a2a0ba18a346bda75db882
Reviewed-on: https://dart-review.googlesource.com/35810
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Jenny Messerly <jmesserly@google.com>
- fix let nodes used in top-level code
- fix super sets and gets of non-final field
- fix synthetic mixin class name using invalid characters
- add an error class to dart:core to prevent front end crash on duplicate field initializers
Change-Id: I552c8909ae2bcf957443e3dac3bd6c97c64f6ee1
Reviewed-on: https://dart-review.googlesource.com/35540
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
- fix all usage of `.name` when `.name.name` is required
- fix handling of inline-JS in the SDK
- fix casts on SDK nodes
Change-Id: Ic48e0b77e6e03515f16b8c30d3e274abbe2ed272
Reviewed-on: https://dart-review.googlesource.com/34540
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Conceptually this is a port of analyzer/nullable_type_inference.dart.
It contains some refactoring and other improvements, as well as tests.
Change-Id: I448440793f11e2e87583d9d47c0e6a1e54ae21f7
Reviewed-on: https://dart-review.googlesource.com/34308
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>