Commit graph

2864 commits

Author SHA1 Message Date
Johnni Winther b3af778a38 [cfe] Add UnresolvedKind for fine grained unresolved reporting
- including tests for issues 46719 and 46887

Change-Id: I601fcfcb956e059f502cbece29fb2a6a00f68846
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210464
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-08-25 09:51:54 +00:00
Nicholas Shahan 5b3cadc7e6 [ddc] Add getter to accompany setter from mixin
When a mixin introduces a forwarding stub setter in the class
hierarchy there also needs to be the accompanying getter in the same
class if a getter is present further up the class hierarchy. This
is because the setter is represented as a property with only a setter
and the lack of a getter will not cause a lookup further up the
prototype chain.

Fixes: https://github.com/dart-lang/sdk/issues/46867
Change-Id: I8e41eb9d2569f0819200a82367ab7c723a1011cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209854
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2021-08-17 18:26:02 +00:00
Nicholas Shahan 7760548a4b [ddc] Track more dependencies on runtime library
Migrate member accesses of the ddc runtime library to the
`runtimeCall()` and `runtimeStatement()` methods. These properly
track the use of the library when compiling in the expression
compiler.

This fixes an issue where the `dart` library top level name could be
missing if an expression doesn't happen to trigger a code path that
tracks the use of the library.

Change-Id: I44e99d1b424059c0ce63f6df21fca804dafdb05c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210064
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2021-08-13 17:27:51 +00:00
Mark Zhou 86655608c0 [dartdevc] Refactoring expression eval tests.
* Splitting expression eval tests into separate tests per module system to avoid timeouts
* Adding some extra timeouts to various Chrome operations in the e2e suite
* Running in non-headless Chrome on Windows to avoid strange flakiness problems
* Minor test suite reformatting

For timeouts, see: https://dart-review.googlesource.com/c/sdk/+/208347/21..22

Fixes #45713

Change-Id: Id51d412da1ffc66b443c73cdb50daa777bdce929
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207562
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2021-08-04 16:46:28 +00:00
Anna Gringauze 388e365d2f Fix failures in expression compiler worker test
Closes: https://github.com/dart-lang/sdk/issues/46786
Change-Id: Ib2ec6130908fb6d4327a49d1b32c3789d52633ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208720
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2021-08-03 18:41:31 +00:00
Riley Porter b36dcbf00b [ddc] Print AST of compiled libraries with summarize-text flag.
Moves dart2js DebugPrinter and Indentation to pkg/kernel/lib/text
and produces the AST of compiled libraries when ddc is run using
the --summarize-text flag.

Change-Id: I195ff99a0929ac12791b4f7b6c5e755b19065c23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208460
Commit-Queue: Riley Porter <rileyporter@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-08-02 17:36:10 +00:00
Anna Gringauze d135395e21 Limit simultaneous connections on http client in AssetFileSystem
- Use one client to communicate to asset server in AssetFileSystem
- Set maxConnectionsLimit to 200 on the client to prevent broken sockets.
- Lower the retry count on the http client in AssetFileSystem to 4 to
  for faster turnaround, now that we have less breaking connections.
- Update tests not to hold onto all the connections while waiting for
  simultaneous reads to finish.

Related: https://github.com/dart-lang/webdev/issues/1345
Related: https://github.com/dart-lang/sdk/issues/46647
Change-Id: I36a453c3889353c66b8939d3d44868cf63badc17
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208243
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2021-07-30 19:19:07 +00:00
Srujan Gaddam f5a98e7676 [ddc] Unify pkg:js types and allow subtyping between them
Removes the lazy loading of the underlying type in LazyJSTypes.
As such, this removes the need to keep AnonymousJSType and
LazyJSType separate, and is therefore refactored to
PackageJSType. Similarly, subtyping is fixed such that
PackageJSTypes are all subtypes of each other.

Change-Id: If489defdbeb5cb932db802a7d146ad2fc393b12c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207982
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-07-30 00:33:54 +00:00
Nicholas Shahan 7a2f1adebe [ddc] Add function symbol information
- Collects `FunctionSymbols` for top level functions, getters, setters,
  as well as class methods, getters and setters.
- Add test cases.

Change-Id: If26c59e920c3e6e914c7f06e3b725afdf048c4e1
Issue: https://github.com/dart-lang/sdk/issues/40273
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207100
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2021-07-29 16:46:45 +00:00
Johnni Winther cb3a9b0043 [cfe] Remove old method invocation encoding nodes
TEST=existing

Change-Id: I05ee649ecfa7945e2e0f5e5d09441d8916a9c46e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208185
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-07-28 15:44:04 +00:00
Johnni Winther 5c96846d8e [dartdevc] Migrate DevCompilerTarget and dependencies to null safety
Change-Id: I75ebd85b745f55bc4ca4111e97a0ec2d787098a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207135
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-07-26 20:49:06 +00:00
Nicholas Shahan 5668791399 [ddc] Bump browser_launcher dep to v1.0.0
- Supports sound null safety.

Change-Id: I5778d1e0b47b97a24f7433509963f945d702d6b2
Issue: https://github.com/dart-lang/sdk/issues/46617
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207920
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2021-07-23 19:24:20 +00:00
Nicholas Shahan 9cf61baf57 [ddc] Update webkit_inspection_protocol dep
- New version has been migrated to null safety.
- Update tests that are currently broken. It looks like a CFE bug
  was fixed and now the private static fields are accessible.

Change-Id: I3d9bde85b65c0e219f756df2d9531539eb7f732b
Issue: https://github.com/dart-lang/sdk/issues/46617
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207382
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2021-07-20 19:44:01 +00:00
Nicholas Shahan 325e7b277c [ddc] Add name and version to module symbols
Change-Id: I1d1b1c47efa5b8b653493ed0e097999872cacbd7
Issue: https://github.com/dart-lang/sdk/issues/40273
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207240
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2021-07-19 19:16:17 +00:00
Johnni Winther faed4bacb3 [cfe] Add RedirectingFactoryTearOff(Constant)
+ rename RedirectingFactoryConstructor to RedirectingFactory
+ change encoding of RedirectingFactory to use FunctionNode

TEST=existing

Change-Id: I80778acc215a36ab6b87518824389a293b96f0a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/206780
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-07-19 16:46:29 +00:00
Nicholas Shahan dbfbc7e373 [ddc] Bump minimum sdk version
Preparation to begin migrating dev_compiler libraries to null safety.
With this change any file we remove the old language version comment
from will be opted into null safety.

Change-Id: I567d139a6c6bfa0b8f820b16e3eb87a2f49228b3
Issue: https://github.com/dart-lang/sdk/issues/46617
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/206961
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2021-07-15 22:01:26 +00:00
Sam Rawlins e681abace9 Remove unnecessary imports
TEST=N/A

Change-Id: I7440c1165a7403aad023f002a97c90572cb66c59
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205820
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2021-07-15 16:57:21 +00:00
Anna Gringauze bf991997f9 Make RetryTimeoutCient retry requests on 500
We use `package:shelf/shelf_io.dart` to serve the requests,
which in turn uses `package:shelf_proxy/shelf_proxy.dart` as
an inner request handler.

On exception (such as seen in the webdev CI failures) the shelf_io
returns 500 response, which is currently is not causing a retry in
RetryTimeoutClient.

This change adds retries on 500.

Add tests with server returning InternalServerError.

Closes: https://github.com/dart-lang/webdev/issues/1345
Change-Id: I73470d73fb5651edee4bf2033ae514930bfe28c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/206581
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
2021-07-13 02:43:15 +00:00
Johnni Winther a0d57b0a4d [cfe] Initial implementation for constructor tear off lowering
TEST=pkg/front_end/testcases/constructor_tearoffs/lowering/*

Change-Id: Ie8a36df4068093dc4d239b48c31f47d03054ba2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/206080
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-07-08 11:05:04 +00:00
Anna Gringauze c32bc3c99f Make AssetFileSystem fault-tolerant
Recent flakes in webdev CI show failures to load dill files
due to broken sockets (most likely caused by connection timeouts).
This change adds retries and timeouts to the asset server file
system to make it tolerant to breaking connections.

- Add RetryTimeoutClient wrapper for HttpClient that performs
  retries with delays and connection/response timeouts, based
  on the idea in
  https://github.com/dart-lang/http/blob/master/lib/retry.dart
- Make AssetFileSystem use the RetryTimeoutClient.
- Add tests for reading multiple files concurrently.
- Add tests for ExpressionCompilerWorker reading assets using
  standard, multiroot, and asset file systems.
- Simplify uri that AssetFileSystem uses to query the asset
  server, since we no longer need to load package uris.
  This will eliminate a step in uri translation in dwds.

- Validated that changes do not break google3 manually.

Change-Id: I2ff163b8d99cd0b7551f3f33a71e6b306540e3c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204880
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2021-07-07 23:27:13 +00:00
Nicholas Shahan c4c7ef5e7d [ddc] Fix debug symbol id for private instance fields
There was an error in the test hiding the fact that we were not
collecting the names for private instance fields correctly.

Change-Id: I1af3d3c2cc9afb92844bc8ec657be1599f1d5b8a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205761
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2021-07-02 15:52:19 +00:00
Dmitry Stefantsov d3e1cdfb16 [cfe] Add more Kernel nodes to support constructor tear-off feature
TEST=Covered by existing tests.

Change-Id: Idb6451ec66bd89a5abc7c4f799a1e66fd26697cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204980
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-06-30 11:27:42 +00:00
Mark Zhou a44b4f5b62 [dartdevc] Updating eval tests that check for internal Future state.
Fixes #46451

Change-Id: Iacf1b115d3c1b9372d0061c6dcbe370c36cea865
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204924
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2021-06-25 05:23:55 +00:00
Nicholas Shahan 8ff5176a77 [ddc] Avoid source maps on logical Not operator
Adding explicit source maps to the operator created a breakable location
when viewing source-mapped dart code in chrome devtools. There isn't a
breakable point in the javascript for a `!` operator so trying to enable
the breakpoint visible in the dart code would trigger some "other
breakpoint".

Recent changes in the V8 debugger have changed which "other breakpoint"
would be triggered.
16b0767adc

This causes our tests to fail and makes the user
interaction a little confusing. Removing the extra source map here seems
to be the most reasonable solution because it prevents a possible
breakpoint from appearing where there isn't a breakable location.

Now, the ! operator doesn't introduce any new source mapping it simply
continues the previous mapping.

Change-Id: I5903bfeaf1bcb2e2a3ce883433153575aa1fd05a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204742
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2021-06-24 21:29:29 +00:00
Nicholas Shahan a076fc2ad0 [ddc] Add variable symbol information
- Collects `VariableSymbols` for global variables and class fields.
- Add test cases.

Change-Id: Id79d60d01f84948c4c7b0bf9e54fbdd232da63da
Issue: https://github.com/dart-lang/sdk/issues/40273
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204086
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2021-06-21 22:15:10 +00:00
Anna Gringauze 387333c5bb Keep connection open until http response is read in HttpAwareFileSystem
We are seeing CI flakes in webdev when using expression_compiler_worker
in tests involving expression evaluation, for example, see linux tests
for dwds in the following PR:

https://github.com/dart-lang/webdev/pull/1343

The logs show that HttpFileSystemEntity.exists fails due to a broken
pipe, which we suspect is due to http client closed too early.

This change is an attempt to fix the problem by
- logging exceptions thrown in expression compiler worker
- awaiting for the request to be read before closing http client in
  HttpFileSystemEntity.

TEST=pkg/dev_compiler/test/expression_compiler/asset_file_system_test.dart

See investigation of the CI issue in:
https://github.com/dart-lang/webdev/issues/1345


Closes: https://github.com/dart-lang/sdk/issues/46388

Change-Id: Iaf98f08e8ebb618bf8365bd497f01ae685f0d3f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203841
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-06-18 01:56:21 +00:00
Nicholas Shahan e36fbfd978 [ddc] Add basic symbol information for classes
Module symbol information now includes basic details the classes
compiled in the module.

Add tests and refactor to share some of the options for running the
incremental frontend compiler and ddc.

Change-Id: I6d3eb16bd6fb70c4c0af46de93a0f7bf96151c4f
Issue: https://github.com/dart-lang/sdk/issues/40273
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202865
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
2021-06-16 23:48:28 +00:00
Dmitry Stefantsov 7985e8b038 [cfe] Add ConstructorTearOff Kernel AST node
TEST=Adding new node id. Conflicts should be detected by existing tests.

Change-Id: I49791188345b6b8cfc7cad2fef9983d499d326ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202764
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-06-16 15:20:17 +00:00
Nicholas Shahan 303f96d3f3 [ddc] Fix crash on unspecified nullability
When encountering a FutureOr<T> where both the type argument and
FutureOr have unspecified nullability, compile the FutureOr type
without any nullability wrappers.

Change-Id: Ic822e9d5cb74864a424963d5e624c4e2bf311b33
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203122
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-06-10 20:18:53 +00:00
Anna Gringauze 375dc2889b Reland "Emit empty symbols file under --emit-debug-symbols flag"
This reverts commit bca8a053e6.

Reason for revert: Issue found, fixed in this CL (by closing a file sink)..

Original change's description:
> Revert "Emit empty symbols file under --emit-debug-symbols flag"
>
> This reverts commit b666964948.
>
> Reason for revert: <Broke pkg-win-release bot, investigating>
>
> Original change's description:
> > Emit empty symbols file under --emit-debug-symbols flag
> >
> > Towards: https://github.com/dart-lang/sdk/issues/40273:
> > Change-Id: I9e735d7e77588ab6bc1c7e30176e2d96a0265a13
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202731
> > Reviewed-by: Nicholas Shahan <nshahan@google.com>
> > Commit-Queue: Anna Gringauze <annagrin@google.com>
>
> TBR=sigmund@google.com,nshahan@google.com,annagrin@google.com
>
> Change-Id: I4b26c26b6404519a1b46c1eca919455cb60ca5e8
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202869
> Reviewed-by: Anna Gringauze <annagrin@google.com>
> Reviewed-by: Nicholas Shahan <nshahan@google.com>
> Commit-Queue: Anna Gringauze <annagrin@google.com>


Change-Id: Iaba56e82a5c5500437b98c3f69066a2f53f6ee4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203000
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2021-06-09 20:57:02 +00:00
Anna Gringauze bca8a053e6 Revert "Emit empty symbols file under --emit-debug-symbols flag"
This reverts commit b666964948.

Reason for revert: <Broke pkg-win-release bot, investigating>

Original change's description:
> Emit empty symbols file under --emit-debug-symbols flag
>
> Towards: https://github.com/dart-lang/sdk/issues/40273:
> Change-Id: I9e735d7e77588ab6bc1c7e30176e2d96a0265a13
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202731
> Reviewed-by: Nicholas Shahan <nshahan@google.com>
> Commit-Queue: Anna Gringauze <annagrin@google.com>

TBR=sigmund@google.com,nshahan@google.com,annagrin@google.com

Change-Id: I4b26c26b6404519a1b46c1eca919455cb60ca5e8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202869
Reviewed-by: Anna Gringauze <annagrin@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2021-06-09 16:45:13 +00:00
Anna Gringauze b666964948 Emit empty symbols file under --emit-debug-symbols flag
Towards: https://github.com/dart-lang/sdk/issues/40273:
Change-Id: I9e735d7e77588ab6bc1c7e30176e2d96a0265a13
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202731
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2021-06-08 16:44:37 +00:00
Riley Porter 30b3552ee3 Use static DartType for js_util optimizations.
Change-Id: I294af3925f15a438f8ad76b538de4ca3a227749e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202440
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Riley Porter <rileyporter@google.com>
2021-06-07 17:27:42 +00:00
Anna Gringauze 9b56b4b858 Initial symbols format version and tests
Towards: https://github.com/dart-lang/sdk/issues/40273
Change-Id: Id784e1341ed2d41111a71aaafd849325335a9e21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202303
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2021-06-04 18:21:27 +00:00
Riley Porter f08edad8ce Optimize js_util setProperty calls for non-function values to
_setPropertyUnchecked version that can be inlined.

No change in the generated JavaScript for dart2js.

Change-Id: Ie4a8e5a34826b6c9083d34656aaa27050635cb21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200933
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Riley Porter <rileyporter@google.com>
2021-05-25 19:28:01 +00:00
Nicholas Shahan 37902c8c6d [ddc] Add the prefix '__t$' to the names of types
This is a temporary fix to give debug tools a recognizable string so
they can hide the type variables from the current scope.

The prefix is only applied when the type appears outside of the
top level type table.

This will require a change in dwds to filter variables with names that
begin with this string.

Change-Id: I2942f462280195d81a7de2b710e6b958770d152a
Issue: https://github.com/dart-lang/sdk/issues/45649
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199581
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2021-05-19 23:52:12 +00:00
Riley Porter eb14bf2472 [ddc] Limit DDC to only skip reifying tearoffs in foreign JS when in the SDK.
Change-Id: I4a671b7064da89d7595e74b22135dc9817523622
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199540
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Riley Porter <rileyporter@google.com>
2021-05-12 20:46:51 +00:00
Sigmund Cherem c47ad2789e [ddc] Avoid collision of a top-level function name with parameter names.
Safari has a bug that makes it a syntax error for a function name
to overlap with names of parameters in functions with default
parameter values.

This CL changes DDC to generates code to circumvent this issue
when emitting top-level methods.  Fortunately, the Safari bug
doesn't trigger with ES6 methods, so we don't need to do anything
for Dart instance methods.

The only other occurrence of named functions in DDC are
`function*` generators that we emit. Those take no arguments,
so we don't need any additional renaming there.

Fixes #43520

Change-Id: I2e4588701a294a8f3c5b47956826ada4ed973e6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198200
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2021-05-06 18:06:05 +00:00
Lasse R.H. Nielsen 3e9cdc5644 Seal typed-data types.
Change-Id: Ic20b68fc258ddbf5c007f9d357366d8a41d1f1e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192186
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2021-05-05 18:04:05 +00:00
Nicholas Shahan 13943449b5 [ddc] Add missing nullability on FutureOr types
FutureOr types now to emit nullability when they are contained inside a
deferred type.

Issue: https://github.com/dart-lang/sdk/issues/45767
Fixes: https://github.com/dart-lang/sdk/issues/45870

Change-Id: I103b575e898b3d7754adbd272df6c4a7e03e50d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/197902
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2021-05-04 19:46:51 +00:00
Nicholas Shahan 18e88e35b7 [ddc] Refactor _normalizeFutureOr return type
Allows the method to be called in other places to get the normalized
type without emitting any code.

Change-Id: Ib05c27560f565a04cf48920f6a1eb392cfc5c82c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/197901
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-05-04 19:46:51 +00:00
Nicholas Shahan ec48e8f323 [ddc] Fix missing nullability on deferred types
Emits legacy and nullable wrappers to the types that appear in
circular hierarchies.

There is still missing nullability information if FutureOr appears
in the type hierarchy but that fix uncovers a larger issue with the
FutureOr type. See https://github.com/dart-lang/sdk/issues/45870.

Change-Id: If5894eaff632c5a961f1316d8803032fae2a0ec5
Fixes: https://github.com/dart-lang/sdk/issues/45767
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196600
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2021-05-03 17:54:19 +00:00
Johnni Winther 8f92864ca3 [kernel] Rename MapEntry to MapLiteralEntry
- to avoid collisions with MapEntry from dart:core

TEST=existing

Change-Id: I7b9592844345313e79ac18d18017c74de7c02106
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196930
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-04-27 10:36:38 +00:00
Emmanuel Pellereau 335f55a601 Revert "Optimize js_util setProperty calls for non-function value types."
This reverts commit 853597a978.

Reason for revert: Breaks google3 (b/186088197)

Original change's description:
> Optimize js_util setProperty calls for non-function value types.
>
> No change in the generated JavaScript for dart2js base on a sample
> foo.dart file and tests/lib/js/js_util/properties_test.dart
>
> Bug: #44533
> Change-Id: Ib6866fa7fca1f13b03c75dd4f1eac904b18811e3
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193838
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Commit-Queue: Riley Porter <rileyporter@google.com>

TBR=sigmund@google.com,srujzs@google.com,rileyporter@google.com

Change-Id: I3f08d29e2d6a1a7846b8d67fadc314ad947f54cf
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: #44533
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196484
Reviewed-by: David Morgan <davidmorgan@google.com>
Commit-Queue: David Morgan <davidmorgan@google.com>
2021-04-22 09:27:29 +00:00
Riley Porter 853597a978 Optimize js_util setProperty calls for non-function value types.
No change in the generated JavaScript for dart2js base on a sample
foo.dart file and tests/lib/js/js_util/properties_test.dart

Bug: #44533
Change-Id: Ib6866fa7fca1f13b03c75dd4f1eac904b18811e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193838
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Riley Porter <rileyporter@google.com>
2021-04-21 19:01:11 +00:00
pq 46909507a6 fix sort_directives violations
See: https://dart-review.googlesource.com/c/sdk/+/196026

TEST=Code cleanup exclusively (sorting imports); no new tests.

Change-Id: I0d419bbeb73f0763175dd29eadfd84e3d0290af5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196223
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2021-04-21 00:13:48 +00:00
pq a6e3008ded fix sort_directives violations
See: https://dart-review.googlesource.com/c/sdk/+/196026

TEST=Code cleanup exclusively (sorting imports); no new tests.


Change-Id: Ib07a82ff418138c542d6a83cfab9aabbb285f866
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196180
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2021-04-20 22:21:28 +00:00
Nicholas Shahan 8e2539d24c [ddc] Fix equality tests for Functions
Marks `Function` as an extensible type so that DDC knows to use the
symbolized version of the equals operator.

The `Function` class at runtime already has its equals method attached
as the "symbolized" version. Consider `a == b`. When DDC knows `a` is
statically a raw `Function` and non-nullable (more likely with sound
null safety) the generated code should call the symbolized equals
member ex: `a[$_equals](b)`. Without this change the generated code
would be `a.equals(b)` and fail at runtime because the method does
not exist.

With this change co19_2/LibTest/core/Function/operator_eq_A01_t01
starts passing.

Change-Id: I80dd2abbbb04f1b7ab7e21dd14561a45f6e81459
Fixes: https://github.com/dart-lang/sdk/issues/45601
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194204
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-04-15 22:02:07 +00:00
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