Commit Graph

1016 Commits

Author SHA1 Message Date
Jenny Messerly 44933e1f1e fix #33876, only use Object method null helpers if signature matches
toString and noSuchMethod are dispatched in a way that allows `null` to
be correctly handled. This code path was not checking if the argument
signature was compatible with the Object methods.

Change-Id: I25b5f11c32961b529660e2d49916053e1fab11df
Reviewed-on: https://dart-review.googlesource.com/65282
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2018-07-19 18:23:17 +00:00
Jenny Messerly 128ecff0c5 fix #33872, support typeArguments passed to reflectType
Change-Id: I84cfbeec89fa9bf3fa50b7df0ccb6861d364b802
Reviewed-on: https://dart-review.googlesource.com/65201
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2018-07-19 00:19:54 +00:00
Jenny Messerly 875abcea39 Remove experimental closure support from dartdevc
Change-Id: Id171cbfd220c4b504f13183ffdcad581c44fb41a
Reviewed-on: https://dart-review.googlesource.com/64826
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2018-07-16 19:32:44 +00:00
Jenny Messerly f601b9cd45 fix #33287, error in dartdevc if an int cannot be represented in JS
Also fixes #32585, Analyzer's int64 validation was rejecting integers
that are accepted by CFE/VM/int.parse.

Refactors DDC to allow us to emit errors from the CodeGenerator
(previously unsupported).

Change-Id: Ifd24ab90848cc42b226961e375167c557299c0b7
Reviewed-on: https://dart-review.googlesource.com/63023
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2018-07-12 00:47:01 +00:00
Devon Carew 6cc709e192 Avoid using deprecated apis and constants.
Change-Id: I471335e882817711c5d22ccb956dca5e33834679
Reviewed-on: https://dart-review.googlesource.com/64081
Reviewed-by: Jenny Messerly <jmesserly@google.com>
2018-07-10 22:35:58 +00:00
Devon Carew 2dd33c2a6c Have the package:analyzer strong mode option hard coded to on. Delete several spec mode only tests.
Change-Id: I5dffec68d9845fe75936d55100c03306b6eda363
Reviewed-on: https://dart-review.googlesource.com/64060
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-07-10 05:30:10 +00:00
Jens Johansen 6888bc2824 Compile time error for web int literals that cannot be represented exactly
Bug: #33351
Change-Id: I2b99858dfc276dc70c3a36c289030e801145af86
Reviewed-on: https://dart-review.googlesource.com/61180
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-06-22 10:47:54 +00:00
Jens Johansen 276598199e Make DDK interpret IntLiteral.value as uint64
As per bug #33351, and based upon what dart2js does.

Change-Id: I18fec2685b22b094d191f4c70a58553a9132b86c
Reviewed-on: https://dart-review.googlesource.com/60841
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-06-20 08:18:19 +00:00
Jenny Messerly d2a37231b3 optimize await in async* methods in dartdevc
Refactors async* implementation class to dart:async and ports it back to
Dart. Improves `await` to avoid zone registration at each await.

Change-Id: I15cac2a40bd56269c8ade1dc0810792c23459ef5
Reviewed-on: https://dart-review.googlesource.com/59260
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2018-06-15 01:54:03 +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 4ba41a4116 remove dead code from dartdevc/k JS gen
The function `_emitJSType` was unreachable because we already skip JS
interop classes.

Change-Id: I9ee563725d5b2bb539beaa38e61e4435e8e8fcd3
Reviewed-on: https://dart-review.googlesource.com/59561
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Jenny Messerly <jmesserly@google.com>
2018-06-12 23:36:03 +00:00
Paul Berry ec5a848588 Add the ability to create function types not associated with elements.
Previously, all FunctionTypeImpl objects needed to be associated with
an element in the element model, and the set of free type variables in
those types had to correspond to types declared in enclosing scopes.
This created problems because there are several instances during type
inference where the analyzer needs to create a synthetic function
type, and it can't easily associate it with an existing element.
Also, when the analyzer is integrated with the common front end, we
will need the ability to represent function types that aren't
associated with elements, since that's how function types are
represented in the common front end.

The new kind of FunctionTypeImpl is implemented by
_FunctionTypeImplStrict; the old behavior is implemented by
_FunctionTypeImplLazy.

Fixes #33159.

Change-Id: I17e5fef1e59837728faf5265b8b722a7afadfbf4
Reviewed-on: https://dart-review.googlesource.com/59160
Reviewed-by: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-06-08 19:43:03 +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 8cd33751c6 optimize string concat in dartdevc
String concat now uses + rather than tagged template strings.
Also refactors the JSTypeRep code into a shared location, and fixes a
bug in null inference for op assign expressions in Analyzer backend.

Change-Id: I74fb6950c1d739efb977a03bd639a07afe453eb6
Reviewed-on: https://dart-review.googlesource.com/57522
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2018-06-07 01:28:02 +00:00
Alexander Markov 1ca17b6d03 [vm/kernel] Recognize desugared mixin applications in dart:mirrors
Kernel mixin transformation desugars mixin applications into normal
classes. Mixed-in type is pulled into interfaces list.
However, dart:mirrors needs to know the original mixed-in type of
a mixin application.

This change solves this problem by propagating a 'isTransformedMixinApplication'
attribute of a class through kernel AST, kernel binary and VM objects
into dart:mirrors implementation.

Fixes: https://github.com/dart-lang/sdk/issues/33240
Change-Id: I98ca69294e1ad445402a5ca91d90c30447aabcb2
Reviewed-on: https://dart-review.googlesource.com/56721
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-05-29 18:12:26 +00:00
Vijay Menon 30ad3f66ce Set DDK to run on Dart-2 VM
Change-Id: I0c0558996c5d6d6c739ded5e5c8b2554a4cd7b04
Reviewed-on: https://dart-review.googlesource.com/53320
Reviewed-by: Jenny Messerly <jmesserly@google.com>
Commit-Queue: Vijay Menon <vsm@google.com>
2018-05-24 21:51:25 +00:00
Sigmund Cherem 8c0f5747a0 Add build_integration package and move multi_root_file_system there.
This is following the design discussion we had a few months ago.

Change-Id: I48b2e82af33d10b9cd1e599e1b3a4e8e419417c8
Reviewed-on: https://dart-review.googlesource.com/56035
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-05-22 20:09:24 +00:00
Jenny Messerly 21fbf7d767 fix #33103, switch dartdevk to use Kernel nSM stubs
Change-Id: I383b36809b1e8b43f9f7a36ca84d8db5da7cef67
Reviewed-on: https://dart-review.googlesource.com/55266
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2018-05-18 23:43:58 +00:00
Jenny Messerly 393a47441f fix #33138, local class name should not conflict with inline-JS in SDK
Also this removes the workaround for dart:html that used a RegExp to
attempt to match inline-JS code that might trigger the problem.

Change-Id: I74b447928aaeaca43b3a9241d42526c284dbeffa
Reviewed-on: https://dart-review.googlesource.com/55504
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Jenny Messerly <jmesserly@google.com>
2018-05-16 22:04:05 +00:00
Jenny Messerly 29afbf8f12 Implement constant evaluation for dartdevk
This builds on the VM's support for constants, and brings dartdevk to
parity with dartdevc. Also, constants are computed with arithmetic
operations that match runtime behavior (JS numbers).

Constants are limited in some cases right now: when building outline
kernel files (via pkg/dev_compiler/tool/build_pkgs.dart), constant field
initializers are not preserved, and this fact is not recorded, making
these fields appear to be implicitly null. dartdevk will recognize this
and avoid inlining the constant in these cases.

Change-Id: I5e6d95ccc32799da3bec1667ed16078a1a87d0bd
Reviewed-on: https://dart-review.googlesource.com/53121
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2018-05-15 06:04:18 +00:00
Jenny Messerly 7359d4ee10 fix #33019, noSuchMethod should receive default values for optional args
Change-Id: If692a68d20c88139a88de8c9701314ae53becd03
Reviewed-on: https://dart-review.googlesource.com/54340
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-05-12 04:18:40 +00:00
Jenny Messerly 147bd68ad3 disable dart:mirrors in DDC unless emit-metadata is set
fixes #32294

Change-Id: I5fde124a9da61e512ea0aa41cc84574e27a50d48
Reviewed-on: https://dart-review.googlesource.com/53163
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2018-05-11 23:13:30 +00:00
Jenny Messerly e998c56a72 fix #32980, better error messages for type errors at runtime
Change-Id: I4666c82b706dcaa963f4acf1c1c5d770e0ab1c6a
Reviewed-on: https://dart-review.googlesource.com/54101
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2018-05-10 00:13:27 +00:00
Jenny Messerly 0fde28b2dd fix #31393, port utf8 decoder optimizations from dart2js to ddc
The dart2js changes were made in:
https://github.com/dart-lang/sdk/commit/3836c70a8150bc33a695788deee346b940b40769

Change-Id: I5476c10e3734fa8ab0c027dd258b2fa5ef43287b
Reviewed-on: https://dart-review.googlesource.com/54529
Reviewed-by: Vijay Menon <vsm@google.com>
2018-05-10 00:06:12 +00:00
Jenny Messerly d87642df9c fix #33036, dartdevk now uses CFE for patching its SDK
Change-Id: I65e7df5373c359019b4b7c5714ae71a80d60df13
Reviewed-on: https://dart-review.googlesource.com/53682
Reviewed-by: Vijay Menon <vsm@google.com>
2018-05-07 22:01:52 +00:00
Jenny Messerly cbca4006f8 fix #30907, add library constants for all SDK libraries
Change-Id: I34669398e9bd7dfb2c9c5130279e88c772b3a5b3
Reviewed-on: https://dart-review.googlesource.com/53162
Reviewed-by: Vijay Menon <vsm@google.com>
2018-05-02 19:33:36 +00:00
Jenny Messerly 2df8db486d fix #30184, private symbols in DDC
Change-Id: I77fe11b49b3f19b0241c8e08c313cb051c4d019b
Reviewed-on: https://dart-review.googlesource.com/52281
Reviewed-by: Vijay Menon <vsm@google.com>
2018-04-30 21:20:40 +00:00
Jenny Messerly bd76221d58 fix #31489, JS interop to prototype getter in dartdevk
Change-Id: I6a3e1e25e0113bfcc49de19f250c23027ea3a69f
Reviewed-on: https://dart-review.googlesource.com/52865
Reviewed-by: Vijay Menon <vsm@google.com>
2018-04-27 00:17:29 +00:00
Jenny Messerly f6db874416 fix some dartdevk behavior to match dartdevc in more cases
Most notably this fixes mixins, but a few others issues were discovered
as well. Fixes #32428.

This gets dartdevk closer to producing a valid Dart SDK file

Change-Id: I2973baef279d6b71ed29b97bec758b2d3209c275
Reviewed-on: https://dart-review.googlesource.com/51760
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2018-04-26 01:13:52 +00:00
Jenny Messerly a3e8a6db98 fix DDC mocks for undefined optional parameters
This reverts part of https://dart-review.googlesource.com/c/sdk/+/48940
while keeping the fix for named arguments. The cleaner fix from that CL
doesn't work for some obscure uses of mocks and optional parameters and
interop scenarios.

Change-Id: I7d7e7ed50574401a70f720a1b4c15578854b2297
Reviewed-on: https://dart-review.googlesource.com/51422
Reviewed-by: Vijay Menon <vsm@google.com>
2018-04-17 18:18:47 +00:00
Jenny Messerly e22e3a1884 fix DDC's REPL support functions
these are used by the debugger extension code

Change-Id: If5b9d1aca38fa2f120580d2dbfd02523c6eaa5cf
Reviewed-on: https://dart-review.googlesource.com/51440
Reviewed-by: Vijay Menon <vsm@google.com>
2018-04-17 18:15:49 +00:00
Jenny Messerly 5474ce01d5 fix DDC lazy function tagging (used for mirrors) and tearoffs
It's possible for `dart.fn` (tearoff) to be called after `dart.lazyFn`,
so lazyFn needs to support a setter.

Change-Id: Iaba1a1d6145d94501c77de6a6a2c107eac2d92d7
Reviewed-on: https://dart-review.googlesource.com/51441
Reviewed-by: Vijay Menon <vsm@google.com>
2018-04-17 18:03:28 +00:00
Jenny Messerly 6de5da1f58 fix #32649, add an option to disable asserts in DDC/K
Change-Id: I1cd4c3a568fb2721be04199ed404835f949e1084
Reviewed-on: https://dart-review.googlesource.com/51360
Reviewed-by: Vijay Menon <vsm@google.com>
2018-04-16 20:17:30 +00:00
Jenny Messerly 5dd283e783 fix #32270, DDC tests can now work with preview-dart-2
Also removes unsafe-force-compile for DDC's selfhost during snapshot
build, and fixes DDK's snapshot to train by selfhosting.

This does not enable preview-dart-2 for DDC/DDK's snapshots or on
the buildbots yet.

Change-Id: Id0b395eb67677d0e69dc5e827536a9039bc95816
Reviewed-on: https://dart-review.googlesource.com/51206
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-04-16 07:03:07 +00:00
Jenny Messerly 782cfe04d1 fix #32756, DDC dynamic calls to generics will work with emit-metadata
Also fixes DDK to disable metadata by default.

Change-Id: Ic5fd637c1048cb5ccfd035b8e0dd07b0985c1364
Reviewed-on: https://dart-review.googlesource.com/51040
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Jenny Messerly <jmesserly@google.com>
2018-04-13 03:01:06 +00:00
Jenny Messerly 8613938e33 fix DDK to track mock setters correctly.
Also fix nosuchmethod_forwarding_arguments_test to work in dart4web compilers

Change-Id: If19bf74561c716845e24862c2400e0ab5cfc135c
Reviewed-on: https://dart-review.googlesource.com/48891
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-04-13 00:27:26 +00:00
Jenny Messerly 2ddc5495f8 Reduce DDC signature overhead
- changes top-level/static method tearoffs to work similar to instance
  method tearoffs (attach typeinfo at the tearoff location).
- changes getters/setter signatures to a more compact representation.
- fixes incorrect reification of tearoffs in DDC Kernel backend,
  causing a couple of tests to pass after the changes.
- module startup should also be faster, because we avoid using
  `defineLazyProperty` for signatures.

Change-Id: I9d1705adcd5101a99f0599120cb927396eae778a
Reviewed-on: https://dart-review.googlesource.com/48455
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-04-12 02:22:09 +00:00
Jenny Messerly 8df4042b2d fix #32088, DDC calls nSM for signature mismatch
also fixes #32653, DDC should call nSM for unexpected named arguments

Change-Id: Id1848cd5af87ac615fd96fbf2784a72f9286801d
Reviewed-on: https://dart-review.googlesource.com/48940
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-04-12 00:29:59 +00:00
Jenny Messerly 1eddbffe2e fix #32754, improve correctness/perf of operator []= with return
Change-Id: I80f5c7aec5606a415d8cba8c001b2aca24d04a8e
Reviewed-on: https://dart-review.googlesource.com/49581
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2018-04-05 19:08:07 +00:00
Jenny Messerly e064e5156e fix DDC to provide a library on temporary variables
When enclosingElement is `null` we fail to find the library. There are
several places in the compiler that depend on having a library available
for resolved elements.

Change-Id: I2746110d8caed97733c73e89e6baef3e96882563
Reviewed-on: https://dart-review.googlesource.com/49544
Reviewed-by: Vijay Menon <vsm@google.com>
2018-04-04 20:41:26 +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 a4c5607281 fix #32594, debugger() will work even if dart_sdk.js is blackboxed
Change-Id: I14b46939dbc1670610913e1a14c7045569601f5e
Reviewed-on: https://dart-review.googlesource.com/48824
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Jenny Messerly <jmesserly@google.com>
2018-04-04 00:24:11 +00:00
Jenny Messerly 60630ed80f fix #30540, define dart.library.mirrors and isolate false in DDC
Change-Id: I0d26d32724096bfbebd53f4a0adcbbd9194cb8ec
Reviewed-on: https://dart-review.googlesource.com/48885
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Jenny Messerly <jmesserly@google.com>
2018-03-30 19:16:05 +00:00
Jenny Messerly bed5debbeb Callable object support in Analyzer and DDC.
Fixes #32156
Fixes #32157
Fixes #32426

This also fixes `implements Function` so it has no effect in Dart 2
(it is ignored for the purposes of subtyping.)

Change-Id: Ibec9c77cd516b8b97fef68a579998598d0acf8c6
Reviewed-on: https://dart-review.googlesource.com/45141
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2018-03-30 18:14:55 +00:00
Jenny Messerly c9e9c1d8e9 Remove dart:isolate runtime support in DDC
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>
2018-03-28 19:42:08 +00:00
Jenny Messerly 192b4621ba Fix DDC shadowing bug with named arguments and async functions.
Change-Id: I4c01ab03bc02d0e533b6d27d43e824aad5d32fea
Reviewed-on: https://dart-review.googlesource.com/48458
Reviewed-by: Vijay Menon <vsm@google.com>
2018-03-27 00:34:46 +00:00
Jenny Messerly a914cac65e fix #32481, DDK signatures for mock members induced by nSM
This bug prevented various DDK features from working correctly at
runtime, such as tearoffs, dynamic call checking, generic methods, and
parameter type checks.

This was fixed for DDC in https://dart.googlesource.com/sdk/+/40738b8884e584f8b6fce26b71e9692c0067db18

Change-Id: I91fd12b3c167341c692d8d3e7ad2217dd78d2950
Reviewed-on: https://dart-review.googlesource.com/45964
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2018-03-27 00:25:32 +00:00
Jenny Messerly d9878ae0da fix regression in DDC handling of top-level field named 'name'
Also refactors the code to make this sort of issue less likely.

Change-Id: Iff72e53720ba78e84c3d219e69ccd0d6a47c09a0
Reviewed-on: https://dart-review.googlesource.com/47188
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2018-03-20 00:49:58 +00:00
Peter von der Ahé 4f2bdff90b Rename Program to Component
Change-Id: I1a3cc03fba9783807fa637a9d42fdbad68ee7686
Reviewed-on: https://dart-review.googlesource.com/31040
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-03-15 12:22:23 +00:00
Kevin Millikin 65b19ffa3c Translate asserts in the VM-specific async translation
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>
2018-03-14 19:41:09 +00:00