Commit Graph

1956 Commits

Author SHA1 Message Date
Nicholas Shahan 825b59ae6d [ddc] Source map fixes for debugger calls
- Fixes calls that pass `when` or `message` arguments
- Updates location information on the expression statement versions to
  point to the beginning of the `debugger()` call instead of the `;` at
  the end of the line.

Change-Id: I56e6d3358a4a4f0f04b4087d062c513fa6729bd3

Issue: https://github.com/dart-lang/sdk/issues/45544
Change-Id: I31838b5877d139554e3aa39c9833fd83ae729a0e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195053
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2021-04-13 19:40:46 +00:00
Nicholas Shahan aaa66ed77e [ddc] Fix sourcemap on debugger statements
Add test file exercising the lack of distinct sourcemaps.

Change-Id: I35e099b2a91d5b6516adaa3cb034ab0b84262fed
Fixes: https://github.com/dart-lang/sdk/issues/45544
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194019
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2021-04-07 18:04:27 +00:00
Nicholas Shahan 7f009e528d [ddc] Fix private class exposed by typedef
- Ensure public fields of private classes exposed by typedef are
  properly treated as virtual.
- Add modular test that exercises the errors fixed by this change.

Change-Id: If97f66de5b0742612024a2f727d83ca9dc73389c
Fixes: https://github.com/dart-lang/sdk/issues/45512
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193899
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2021-04-05 18:54:56 +00:00
Nicholas Shahan eb2c982c15 [ddc] Optimize triple shift operations
Change-Id: Ib3c636ba9a36e427ca5209da6a1eba26e1e16e63
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193746
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2021-04-02 17:10:52 +00:00
Nicholas Shahan 38e5e9bc19 [ddc] Update pedantic version to 1.11.0
Apply new lints, cleanup violations, and ignore in `lib/src/js_ast` to
avoid adding additional diffs with the version it was forked from.

Change-Id: I1def25865bf195120c594223ebdc0f59139e75b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192241
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2021-03-24 17:35:32 +00:00
Sam Rawlins 78121c713e dev_compiler: Remove unused imports
Bug: https://github.com/dart-lang/sdk/issues/44569
Change-Id: I3fe1093fbd0a01e1dc5e99750c4c7e9441c3d056
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192610
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-03-23 20:13:13 +00:00
Johnni Winther 92e237c835 [cfe,dartdevc,dart2js] Use InstanceGetterInvocation for getter/field invocation
The web compilers don't support getter/field invocation encoded as a
FunctionInvocation on an InstanceGet because it doesn't work for
getter/field invocation of js-interop properties, since the InstanceGet
wouldn't result in a Dart function but just JavaScript function.

To support this in the new method invocation encoding, a special
expression, InstanceGetterInvocation, is used to encode getter/field
invocations in dart2js and ddc.

Change-Id: I21da8e8686f66ae4ce4d44245073b9e424f975b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192181
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-03-23 09:49:06 +00:00
Anna Gringauze 9b901bc21f Communicate start failures from ExpressionCompilerWorker to the consumer
In some cases, such as file system exceptions,  ExpressionCompilerWorker
fails to start but does not close its receiver port, which causes the
consumer to wait indefinitely for responses.

Make ExpressionCompilerWorker communicate the failure to the consumer,
close the receiver port, and exit.

Added tests to verify graceful exit.

Issue that uncovered the bug: https://b.corp.google.com/issues/183218372

Change-Id: I54a9c3620cfc5f77c101b26b4e98b6eeb03ad7e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192260
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Gary Roumanis <grouma@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2021-03-23 02:27:55 +00:00
Brian Wilkerson ec04c1f335 Remove some unnecessary ignore comments
Change-Id: Iafa4b9c8aa5dc696c5746248a8701b4f6e875979
TEST=Existing tests.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191980
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2021-03-18 19:58:43 +00:00
Anna Gringauze e2baf16ebd Support ddc module format in expression compilation in ddc.
Closes: https://github.com/dart-lang/sdk/issues/45303
Change-Id: I2b1eb9d149c03c138150d126c108ad86af8584c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191023
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Gary Roumanis <grouma@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2021-03-15 23:58:44 +00:00
Dmitry Stefantsov 8ddc7465a8 [cfe] Move ExtensionType into pkg/kernel/lib/ast.dart
Change-Id: I2e8231dad00accafb09d1ec88416242d3d5815a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190483
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-03-12 19:02:27 +00:00
Anna Gringauze cf7e990233 Add default value for module format in ExpressionCompilerWorker
Current version of dwds does not supply module format to the
expression compiler worker, resulting in initialization failures.
Add default 'amd' format so dwds continues to work with new SDK
version before a matching update that passes format to dwds
lands.

Change-Id: I10e8ddc09b48b91c9c085a6d7579ad01c6e13399
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190820
Reviewed-by: Gary Roumanis <grouma@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2021-03-12 18:37:07 +00:00
Johnni Winther 1aa6f00107 [kernel] Refactor CanonicalName/Reference integration
The CL is a step towards have a more restricted and wellstructured
handled of references and canonical names.

The CL moves Reference to canonical_name.dart and makes
CanonicalName.reference private, and replaces CanonicalName.getReference
with a 'reference' getter.

It also removes NamedNode.canonicalName, Field.getterCanonicalName and
Field.setterCanonicalName so that these can only be accessed through the
corresponding reference. This is to reduce the reliance on the
canonical names which, ideally, should only be part of serialization and
deserialization.

TEST=existing

Change-Id: I955fb7d52d4e112d8741f7c12dcf38b74ae0c91a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190442
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-03-10 15:39:28 +00:00
Anna Gringauze 14eeb7507f First version of incremental DDC mode for expression compilation
- Support evaluate() calls from VM service in expression compiler
  - emit all accessed symbols, types, constants, extension symbols,
    and imports as part of synthetic evaluation function
    - Note: this fixes missing symbol issues in evaluateInFrame()
      as well
  - update expression evaluation tests
  - fix expression compilation broken after hot reload

See widget inspector layout explorer, a result of evaluate() call:
https://drive.google.com/file/d/16UdSE5_V1ZRXAf2KeBxNwYNHMfo1RbnT/view?usp=sharing&resourcekey=0-HZcPm68VbsVzrZ672CApvA

Closes: https://github.com/dart-lang/sdk/issues/41480
Closes: https://github.com/dart-lang/sdk/issues/44979
Closes: https://github.com/dart-lang/sdk/issues/44713
Closes: https://github.com/dart-lang/sdk/issues/44933
Closes: https://github.com/dart-lang/sdk/issues/44813
Closes: https://github.com/dart-lang/sdk/issues/44686
Change-Id: I96c74578c51503adbc4bfe6d6e6112319addc959
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188400
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2021-03-09 17:23:05 +00:00
Johnni Winther 01b0947a6d [kernel] Update kernel encodings
* Add InstanceGetterInvocation for getter/field invocation in web
  backends
* Add localFunction getter to LocalFunctionInvocation
* Remove isNot from EqualsCall and EqualsNull - the encoding didn't
  carry its weight.
* Remove uses of Name.name
* Remove BottomType code from VM

TEST=existing

Change-Id: I99d05d35b9ef193d092cc151c99ad472dbd60834
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188725
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-03-08 11:29:51 +00:00
Riley Porter bfaf674479 Optimize js_util getProperty calls to lowered call to native JS.
No change in the generated JavaScript for dart2js based on both a small
foo.dart sample file and tests/lib/js/js_util/properties_test.dart

All changes in generated JavaScript for DDC are smaller and clearer:
  - foo.dart: https://paste.googleplex.com/4738045023617024
  - properties_test.dart: https://paste.googleplex.com/5107699705446400

Bug: #44533
Change-Id: I670f0226fbef90d05a95c51d918831bea58d6aa3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187840
Commit-Queue: Riley Porter <rileyporter@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2021-03-06 01:16:24 +00:00
Jens Johansen 93f4ac0a83 [cfe] Actually have both ansi and plain text formatted messages (2nd try)
The CFEs FormattedMessage always had two getters to get the text inside
one that would supposedly give an ansi formated version of the message
and one that would supposedly give a plaintext formated version of the
message. They both returned the same string, though, which would either
be with ansi escape codes or plain text depending on the environment at
compile time.

This CL fixes that by having both messages, and letting the reporting
(i.e. whenever the message is read) decide which to use. That way we
can - for instance - report errors with color if the terminal supports
it correctly when reusing a dill (and reissuing problems, but where the
terminal support changes) and if printing the problem to an html <pre>
field (like observatory does).

It also cleans up two different implementations of whether we think
the terminal supports colors or not, by deleting one of them.

This is the second try. Patchset #1 is the original.
Patchset #2(and possibly beyond) is the changes.

TEST=Existing test suites.

Change-Id: I8e483049ce81ce1bd8e5396b588a31e0ad3a8630
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187402
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-02-26 13:06:17 +00:00
Nicholas Shahan ab789de75b [ddc] Add full .dill uri to metadata
Change-Id: I0333b41298c5556d6ce72e339c9eec061b620866
Fixes: https://github.com/dart-lang/sdk/issues/43684
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181861
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2021-02-25 19:35:41 +00:00
Dmitry Stefantsov c191551fac [cfe] Remove BottomType
TEST=Covered by existing tests.

Change-Id: Ied8be1874164e68e0a3a48e1b2f9a33310071381
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183009
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-24 13:21:55 +00:00
Jens Johansen 3a4a4f53d0 Revert "[cfe] Actually have both ansi and plain text formatted messages"
This reverts commit f63f7736c5.

Reason for revert: This somehow breaks the Windows bots. `python tools/test.py -n dartk-win-release-x64 standalone_2/io/process_shell_test`.

Original change's description:
> [cfe] Actually have both ansi and plain text formatted messages
>
> The CFEs FormattedMessage always had two getters to get the text inside
> one that would supposedly give an ansi formated version of the message
> and one that would supposedly give a plaintext formated version of the
> message. They both returned the same string, though, which would either
> be with ansi escape codes or plain text depending on the environment at
> compile time.
>
> This CL fixes that by having both messages, and letting the reporting
> (i.e. whenever the message is read) decide which to use. That way we
> can - for instance - report errors with color if the terminal supports
> it correctly when reusing a dill (and reissuing problems, but where the
> terminal support changes) and if printing the problem to an html <pre>
> field (like observatory does (1)).
>
> It also cleans up two different implementations of whether we think
> the terminal supports colors or not, by deleting one of them.
>
> (1) At least sometimes. It works - I think - only for 'evaluateInFrame',
>     but that's another story (and will be fixed in a follow-up CL).
>
> TEST=Existing test suites.
>
> Change-Id: Iedaedd9a5c41458d40c23ed4b706324c004ae943
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186291
> Commit-Queue: Jens Johansen <jensj@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>

Change-Id: I0b53f943a61f76705badfead30d9e1ee35baff57
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186941
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-02-24 12:30:18 +00:00
Jens Johansen f63f7736c5 [cfe] Actually have both ansi and plain text formatted messages
The CFEs FormattedMessage always had two getters to get the text inside
one that would supposedly give an ansi formated version of the message
and one that would supposedly give a plaintext formated version of the
message. They both returned the same string, though, which would either
be with ansi escape codes or plain text depending on the environment at
compile time.

This CL fixes that by having both messages, and letting the reporting
(i.e. whenever the message is read) decide which to use. That way we
can - for instance - report errors with color if the terminal supports
it correctly when reusing a dill (and reissuing problems, but where the
terminal support changes) and if printing the problem to an html <pre>
field (like observatory does (1)).

It also cleans up two different implementations of whether we think
the terminal supports colors or not, by deleting one of them.

(1) At least sometimes. It works - I think - only for 'evaluateInFrame',
    but that's another story (and will be fixed in a follow-up CL).

TEST=Existing test suites.

Change-Id: Iedaedd9a5c41458d40c23ed4b706324c004ae943
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186291
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-02-24 10:33:45 +00:00
Alexander Markov 9d4ad8a14b [core lib] Add unimplemented int.operator >>>
This change adds a placeholder for int.operator >>>.
No implementation is added yet.

This change unblocks implementation of this operator in
the backends (VM, dart2js, DDC).

Issue: https://github.com/dart-lang/sdk/issues/44912
Issue: https://github.com/dart-lang/sdk/issues/30892
Change-Id: I9912ca9f44d594e9c5fa91f5fc65e807fe48cc7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185480
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2021-02-22 00:02:47 +00:00
Johnni Winther 07ddd00e1b [cfe] Remove unneeded hide combinators
The front end previously enforced a stricter-than-spec requirement on
conflicting imports on its own code. The check was included of the
kernel snapshot and therefore always enforced, even in published sdks.

The extra check was removed a month ago and now tools/sdks/ have been
updated to use a later version of the sdk, so the unneeded hide
combinators can now be removed from the source code.

Closes #44667

TEST=existing

Change-Id: I1d1053b1ef9a40b6a918eef515a02d7b404906c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185084
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-18 14:23:10 +00:00
Gary Roumanis dfd52f60a1 Use async reads if possible
Change-Id: Ib7ae51e5f79e10797376cc3e4ca1a5bf6708fa30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185307
Auto-Submit: Gary Roumanis <grouma@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-02-17 19:30:30 +00:00
Sam Rawlins 82c87aefbf dev_compiler: Remove unnecessary import
Bug: https://github.com/dart-lang/sdk/issues/44569
Change-Id: I903be88485200af4929fde78a575ff40c039da39
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185303
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2021-02-17 17:42:27 +00:00
Nicholas Shahan f0ec362a1c [ddc] Use .futureValueType from CFE
The CFE FunctionNode has a new getter for the Future value type that
can be used in null safe libraries.

Legacy libraries will still rely on flatten to get the type of the
Future.

Change-Id: I54ad3bc096fdb981f7f499f2ba3ddfcb01fd97d6
Issue: https://github.com/dart-lang/sdk/issues/44745
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185240
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2021-02-17 17:07:18 +00:00
Nicholas Shahan 16ca849c65 [ddc] Don't let null sources invalidate the dart size
Null sources appear to come from files that contain only external
declarations. These sources can simply be ignored in the summation
of the sizes of dart files that make up a module.

Change-Id: I38864c7f4a3e208b19e26d5a887445fdf4622479
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184901
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2021-02-16 18:57:09 +00:00
Nicholas Shahan 8eda75fc1a [ddc] Allow dynamic, Null, and void in assert
This assertion fails when compiling the SDK because the types
dynamic, Null, and void all have `Nullability.nullable`.

They are safe to allow through unchanged because each has their own
visitor that avoids the nullability wrapper at runtime.

Change-Id: I0ce345ce11dddb345eab3708804cbde6a540fdd1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184880
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2021-02-12 22:32:29 +00:00
Gary Roumanis 0bdd0b4fad Load in parallel
Improve the performance by loading resources in parallel if possible.

Change-Id: Ibf93b7aa7510a110740399eef825f3c140c6dfd5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184203
Auto-Submit: Gary Roumanis <grouma@google.com>
Commit-Queue: Gary Roumanis <grouma@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
2021-02-10 20:12:45 +00:00
Johnni Winther ee0c0bcd57 Reland "[kernel] Ensure that visitors don't implicitly returns null"
This is in preparation to migrate package:kernel to null safety.
For the visitor interfaces to support non-nullable return types, the
implementations must avoid using `null` as return value in its base case.

TEST=Refactoring

Change-Id: Ie8fa5d41b99850d9e4abb59634c72920c64128d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183691
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-02-10 07:51:52 +00:00
Nicholas Shahan 9c2d9b6831 [ddc] Enforce unnecessary_this lint
- Fix violations
- Ignore lint in js_ast directory. Still holding onto hope that we will
  merge this with dart2js version and move out of the ddc package.
- Import all lints from pedantic 1.9.0

Change-Id: I834b4b197dcf0b6924417cdd337cda9a1b6249d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183043
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2021-02-09 20:19:15 +00:00
Johnni Winther b60e0aa5a1 Revert "[kernel] Ensure that visitors don't implicitly returns null"
This reverts commit ce81216885.

Reason for revert: Flutter dependency

Original change's description:
> [kernel] Ensure that visitors don't implicitly returns `null`
>
> This is in preparation to migrate package:kernel to null safety.
> For the visitor interfaces to support non-nullable return types, the
> implementations must avoid using `null` as return value in its base case.
>
> TEST=Refactoring
>
> Change-Id: Ie5e4153f8d3779d94957bb13b3d2d2a942040ff2
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179760
> Commit-Queue: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Jens Johansen <jensj@google.com>

TBR=jensj@google.com,johnniwinther@google.com

Change-Id: I61b838d3371e6b1de2427716d056324c120be499
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183689
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-02-09 12:41:12 +00:00
Johnni Winther ce81216885 [kernel] Ensure that visitors don't implicitly returns null
This is in preparation to migrate package:kernel to null safety.
For the visitor interfaces to support non-nullable return types, the
implementations must avoid using `null` as return value in its base case.

TEST=Refactoring

Change-Id: Ie5e4153f8d3779d94957bb13b3d2d2a942040ff2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179760
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-09 09:46:46 +00:00
Ben Konyi 848121e6d4 Reland "[ CLI ] Improved consistency of -D and --define across tools and commands"
- Added support for --define to the VM and dart2js
- Added support for -D and --define for `dart run` and `dart compile js`

Remaining improvements:
- Add support for providing multiple comma separated values for `dart
  run`, `dart`, and `dart2js`

Related issue: https://github.com/dart-lang/sdk/issues/44562

TEST=Updated CLI tests and added new dart2js tests.

This reverts commit e49937769f.

Change-Id: I5f9275b829665eb5e8695403d67f230e752ab0e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183180
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-02-05 23:53:28 +00:00
Sigmund Cherem 912005267d [web] rename suite dart2js -> web.
Change-Id: I46be49b2effec3e38a3dc44cd45cfe736f77fa78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182680
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2021-02-04 23:11:32 +00:00
Nicholas Shahan 2b4a3b082b [ddc] Merge remaining diffs in dart_library.js
- Copy the internal version of dart_library.js without any changes.
- Unblocks syncing this file again.
- Update ddb script to use the dart2js preamble for d8 which includes
  assignment of a global `self` and the fake event loop for better
  error handling.

Change-Id: I01c2ad82fe7c36bb393f9eab897f558daabf6b8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181522
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2021-02-01 19:55:49 +00:00
Anna Gringauze d6cf6b6bc9 Pass type parameters to expression evaluation function
- Pass type parameters to the synthetic expression evaluation
  function
- Add tests

Closes: https://github.com/dart-lang/sdk/issues/44755
Change-Id: Ifbc859b72c616d8f47a76ad9de2cc2aeef67e636
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181660
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2021-01-29 01:24:05 +00:00
Mark Zhou f09a5d4243 [dartdevc] Avoid caching constants during eval.
Avoids masking the issue underlying #44713.

Change-Id: I107c1ea3aab18a97ac08e868741fa0929e2292b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181304
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2021-01-27 20:25:45 +00:00
Nicholas Shahan f5743e6c66 [ddc] Fix async methods with Object return type
The sound null safety spec includes a change in the calculation of
static types of return values in async methods. The "Future value
type" should be `Object?` when the declared return type of the
async method is `Object`.

See https://github.com/dart-lang/language/blob/master/accepted/future-releases/nnbd/feature-specification.md#the-future-value-type-of-an-asynchronous-non-generator-function

With this change,
co19/LanguageFeatures/nnbd/future_value_type_A05_t01 is now passing
in sound mode.

Change-Id: Ia7d4cb2fd57c1d2e50dbf8e59658a70124b0c8b3
Fixes: https://github.com/dart-lang/sdk/issues/44745
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181303
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2021-01-27 18:17:40 +00:00
Nicholas Shahan 0551fdc7f1 [ddc] Format dart_library.js
Just some preliminary formatting to make it easier to see the diffs
when I merge the changes from the version in google3. The diff
algorithm gerrit uses doesn't handle the change in indentation very
well.

Change-Id: I2a4daa50d0051140569d51bea5845a0366ba1dad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180700
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2021-01-25 18:47:53 +00:00
Sigmund Cherem 6854871069 [ddc] omit type constant literals without nullability in all contexts.
In non foreign-js calls this is immediatelly passed to wrapType which will
normalize it to the same value. So this is only added as a small optimization.

Change-Id: I145d58ad0244a2e7068a928b231f69a9491c465e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180444
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2021-01-22 02:24:17 +00:00
Sigmund Cherem 04d9240939 [ddc] recognize constant type literals in the compiler.
This change prepares for an upcoming CFE normalization.
Today kernel AST shows type literals as TypeLiteral nodes. Soon the CFE
will change the representation and canonicalize type literals and
represent them using constnats.

With this change, the compiler will recognize both the old and new
patterns.

Change-Id: I5aa3d99743c95c2dda04d299e586e77540fb7f7f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180266
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2021-01-22 02:24:17 +00:00
Nicholas Shahan c3e56519fc [ddc] Add getGenericClassStatic runtime helper
Used in the SDK runtime library like the getGenericClass helper but this
is intended to be used when we statically know the type of the class to
be retrieved. Helps avoid breaks caused by an upcoming CFE change that
turns type literals into constants.

Change-Id: I262dd2dae347170050d2fe5cd2722ab132951036
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180265
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-01-22 02:24:17 +00:00
Mark Zhou 0d275a6b7c [dartdevc] Clearing labeled statement caches before entering inline JS while statements.
Change-Id: I249913cebba553b8fad8a7646688807a968c2e85
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180443
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2021-01-21 23:55:57 +00:00
Mark Zhou 05d46af646 [dartdevc] Synchronizing dart_library.js with internal hot restart change.
See: cl/352082170
Change-Id: I6bb9cc27997d1ce2117c58d5e3b3ee3a299e7c2d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180260
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2021-01-21 00:39:13 +00:00
Anna Gringauze 599a265fdb Use full dill for main module and summaries for dependencies
- load summaries on updateDependencies and replace them by full
   kernel files for current module on expression evaluation

 - add tests for compiling expressions in various modules

 - add tests for compiling expressions after updating dependencies

 - test expression compilation in sound null safety mode

Change-Id: I243e8d1535e9510bc51f094545743d82bdbf23ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179404
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-01-20 23:26:33 +00:00
Sigmund Cherem 0845ebaad8 [ddc] Do not require a @JS annotation at the library level.
Dart2js allows to declare JS-interp members, even if the enclosing library
doesn't have a JS annotation. This relaxes DDC to do the same.

Change-Id: I733d1cbb308692d89b8cd443cbde0ed30637e48e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177780
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2021-01-20 22:11:23 +00:00
Mark Zhou dce8fcda1b [dartdevc] Unwrapping container objects.
These are causing aggregated containers to miss some fields.

Fixes #44685

Change-Id: I9d996bddbd10e7eb573f74fddf720a02fb1f4765
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180042
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2021-01-19 23:02:54 +00:00
Johnni Winther cad04f8604 [cfe,dart2js,dartdev] Show null safety mode for dart compile
This adds a new messages kind 'info' to the CFE for showing general
information during compilation. A 'configuration' options is added
to `CompilerOptions` for telling the CFE how it is run.

The configuration 'compile' is added for when the CFE is invoked to
produces an "executable" as when running `dart compile`. When
configuration is set, the CFE emits an info message about the
null safety compilation mode.

Support for `dart compile exe` and `dart compile js` is added in this
CL. Support for `dart compile kernel|app-jit|aot` is not included.

In response to https://github.com/dart-lang/sdk/issues/44234

TEST=pkg/dartdev/test/commands/compile_test.dart

Change-Id: I08f51e2a3f5ad4841c4d703bcd266b7afb63c7c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178982
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-01-15 11:28:13 +00:00
Sigmund Cherem 8d971e1bef [ddc] do not enforce assertInterop on native methods from native tests
Change-Id: I3819da5708bc8a7f21d14d5531d9178c05839f45
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178140
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2021-01-15 02:16:42 +00:00