Commit Graph

3297 Commits

Author SHA1 Message Date
David Morgan 56f2e00fd6 [macros] Skip macro library augmentations when considering input sources.
Add `package:front_end/src/api_prototype/macros.dart` for utilities
related to compiling macros. Export `isMacroLibraryUri`.

Use `isMacroLibraryUri` instead of hard-coding in a few places.

Add TODO about need to handle macro deps to places that are currently
listing sources as deps.

R=jakemac@google.com, johnniwinther@google.com

Change-Id: I5d2473b810afd42f487178f0aad995804da945c4
Tested: Manually tested with Flutter; e2e tests will be added under tests/macro_build.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358700
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Morgan :) <davidmorgan@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Auto-Submit: Morgan :) <davidmorgan@google.com>
2024-03-21 15:54:19 +00:00
Jens Johansen 2bd74882e2 [package:testing] Various updates
* Delete unused stuff
 * rename 'path' to 'root'
 * accept 'includeEndsWith' as a plain text string so we often can avoid
   using regexp
 * accept 'subRoots' to filter to directories faster and more precisly
   than when using regexps in 'pattern'
 * make 'list' async instead of async* (no more yield stuff which we
   promptly turn into a list when actually using it)

Note that some changes in testing.json is not 100% semantic-preserving,
e.g. the "parser_all" suite previously had a pattern "/tests/.*\\.dart$"
which was probably meant to include all dart files in the "tests" folder
in the root, but in fact included all dart files in a "tests" folder
anywhere. The updated version does not.

Change-Id: Idd014274f86bf6214dee0753a7738ec80bc6a49e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358442
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2024-03-21 06:58:32 +00:00
Jake Macdonald 25071fc448 revert dart:_macros, going with SDK vendored package
Change-Id: Iaaf80a44cdbd073b01132d04c0426e8acc28341f
Tested: Revert only
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358501
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Jacob Richman <jacobr@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
2024-03-21 02:40:58 +00:00
Johnni Winther dcaf91ae59 [dartdec] Update dev_compiler/macros_test
Updated cf. comments in https://dart-review.googlesource.com/c/sdk/+/346000

Change-Id: I3dff79bcd9b5eed7133cbeead8deaec856857fa7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353700
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2024-03-15 10:19:48 +00:00
Nicholas Shahan 1cb4f090c3 [ddc] Refactor visitRecord(Index|Name)Get
Stop passing `null` as the member parameter of `_emitPropertyGet`.

Avoids the use of one method with multiple code paths and returns
to handle any situation because it becomes very hard to reason 
about what original source code leads to each path.

Issue: https://github.com/dart-lang/sdk/issues/54463
Change-Id: I31ada0647816e8c7db2dac56a0a56fd50d9bd0a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357205
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2024-03-14 15:11:48 +00:00
David Morgan 078532a6a9 [ddc] Fix flaky test, move timeout to explicit arg.
R=nshahan@google.com

Change-Id: I720b3154c2c5768213027849ab6b06bc91b9b840
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357300
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Morgan :) <davidmorgan@google.com>
Auto-Submit: Morgan :) <davidmorgan@google.com>
2024-03-13 18:06:16 +00:00
Sigmund Cherem 4a065c649d [ddc] speed up asset_file_system_test.
While working on the e2e tests, I noticed this test was taking a
long time. Turns out this was because it fully exercises an http
client retry logic using exponential backoff and up to 4 retries.

To reduce the costs, I changed the test to use controlled
environment instead. This still hits the same code-paths but
provides a faster turnaround by using at most 1 retry, and issuing
retries immediately.

With these changes, the test completes in 3s (instead of 28s).

I noticed that some of the tests to check an "unreliable" server
where non-deterministic (multiple parallel requests that sometimes
fail or succeed). The changes here also make it deterministic. While
this test seems to have some flakes due to other reasons, my hope is
that these changes will reduce the chances of this test being flaky
on the bots.

Change-Id: I8eb2a00c7a489ab4e5a46e2b5cdbee40d1ffb8d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/356623
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2024-03-11 18:32:19 +00:00
Nicholas Shahan 0402fa606b [ddc] Add support for simple DAG compiles to ddb
This enables some compiling and running with multiple modules
and simple import graphs.

Change-Id: I467c0dd0c4f5b41b19353ae5114bae20547b94f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/355508
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2024-03-08 17:55:58 +00:00
Nicholas Shahan 206222265f [ddc] Add flag to ddb script for ddc module format
The flag allows for overriding the default (amd) with the ddc module
format when using `--runtime=chrome`.

This is intended to make it easier to test and debug changes to
the ddc module system.

Change-Id: I34767e2e80e9c80af5870bb7f51bf9ebaf438336
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/355507
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2024-03-08 17:35:00 +00:00
Nicholas Shahan 98a3605562 [ddc] Fix assert location in expression eval
When assertions appear in a debugger expression they now have a
synthetic source location available. This also allows for the lookup
of the actual source.

Issue: https://github.com/dart-lang/sdk/issues/43986
Fixes: https://github.com/dart-lang/sdk/issues/54956
Change-Id: I34ae5f810593b40282929d02cb290de86603922f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/356287
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2024-03-08 17:05:10 +00:00
David Morgan 6f7f571989 [macros] Fix basic macro compile with DDC, add e2e test.
The e2e test is for "how DDC is used in the language tests", more
realistic setupts to follow.

R=jakemac@google.com, nshahan@google.com

Change-Id: Iece44740d2e4d91748a7deef59f4e18ad42ac853
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/356241
Auto-Submit: Morgan :) <davidmorgan@google.com>
Commit-Queue: Morgan :) <davidmorgan@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2024-03-08 11:37:46 +00:00
Sigmund Cherem 8103f36f34 [ddc] cluster e2e tests together.
Ideally we would write each source next to each test to make tests more
readable, but clustering all tests to use a common test file really
helps boost the runtime of the end2end tests now that we reuse the same
page between tests that share the same code.

This CL refactos the tests to mostly use one shared test file. Doing so
speeds up tests between 2x-4x depending on the test.

Change-Id: I9afd00c6a42226899969e3f605ac18e0d2b1a906
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/356285
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2024-03-08 02:11:10 +00:00
Sigmund Cherem 866ed84158 [ddc] reuse the same page/script if possible on e2e tests.
Since we changed how the test driver sets up breakpoints, we now we
have the ability to reuse a page for multiple tests.

Before, the test harness would follow this sequence:
* on each group of tests, it would call `_initSource`, which sets up
  a boostraper and code to execute on the browser. This code was
  reused by all tests in the group.
* on each test, it would indirectly call `_loadScript`, which
  navigated to brand new page for each test. If there were multiple
  tests in a group, this would load the boostraper and code once per
  test.

This CL keeps the sequence of operations the same, except, that
`_loadScript` will reuse the existing page if it already loaded the
boostraper and DDC code needed by the next test.

This greatly reduces the total running time of some of the
expresison compiler shards. On my local machine one such test took
24s before both this and the parent CL, but now takes about 5s.

Change-Id: I7774df9e83142b42efc4ad523f589758a2a4660c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/356301
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2024-03-08 02:11:10 +00:00
Sigmund Cherem c8d6acbfd0 [ddc] remove the preemptive breakpoint from e2e tests.
Instead of pausing the application while loading, this
changes the bootstrap logic to not invoke main immediately.

Later the test harness uses an expression evaluation to
trigger the start of the application when it is ready for
it.

This change will enable the ability to reuse the same page
and script across multiple tests, which will save a lot of
test execution time (see related child CL).

Change-Id: Ifa1050ac777aabb3e21b69953e85c6578b3e0cc0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/356281
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2024-03-08 02:11:10 +00:00
Sigmund Cherem 376f9dcf6b [ddc] increase timeout of steps in e2e suite.
The data shows a lot of variation by machine. The slowest test samples
bring the p90 above 4s, which explains that we often hit the limit.

I expect that we'll continue seeing flakes, but less often as a result
of this change. That said, some of the e2e test are taking close to 4
minutes, so we may need additional sharding or switch our approach if
that ocurrs more often.

Change-Id: I47c0dbce6f766edf7c2845d26f11ae7c6372a7bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/355980
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2024-03-06 18:07:03 +00:00
David Morgan 1c3bd1d0f9 [macros] Increase timeout for test flakiness.
Example flake

https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket/8754695045701063905/+/u/test_results/ignored_flaky_test_failure_logs

R=nshahan@google.com

Change-Id: I78c3ef26bf635dd8bb9e0d7c28c05e68a5ce9a18
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/355700
Commit-Queue: Morgan :) <davidmorgan@google.com>
Auto-Submit: Morgan :) <davidmorgan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2024-03-06 16:14:19 +00:00
Nicholas Shahan 5e03c497e9 [ddc] Cleanup dynamic calls in native_typed_data
Change-Id: I6a3b709addf59fbde09d829efed43028d71ef7d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/355620
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2024-03-06 00:51:15 +00:00
Nicholas Shahan 59ad7082cc [ddc] Cleanup dynamic calls in debugger helper lib
Change-Id: Ie31f398f8c438ebf64700b631dff25d6d01bb1e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/355545
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2024-03-05 20:32:23 +00:00
MarkZ 210e120fbd [ddc] Creating a hot reload and hot restart test suite.
The hot reload runner currently only supports d8, but I plan to add support for Chrome and VM execution.

Notable changes:
* Creates `package:reload_test` with helpers for running this suite.
* Updates the module loader with D8-specific branches and hooks for hot reload/restart.
* Exposes DDC runtime variables via a `HotReloadTestRuntime` API.
* Ports constant equality hot restart tests from webdev/dwds (validated to fail if either cache-clearing mechanism fails).
* Partially rolls DDC's d8 preamble forward (towards dart2js's).
* Wraps D8's timer implementation with custom timeout logic to better match Chrome's timing semantics when executing with native JS async.

Tests for the framework and matrix updates will be added in an upcoming change.

Change-Id: I2773b29f464cfd0330e4c653c05e117ae150b4a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350021
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2024-03-05 00:12:18 +00:00
Lasse R.H. Nielsen 9d933d1281 Retire 3.3 experiments in the 3.4 release.
Tested: No new tests.
Change-Id: Idf19ce8b6743b221841e6cef6b2a80e8ab37860e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/354260
Auto-Submit: Lasse Nielsen <lrn@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2024-03-04 16:09:31 +00:00
Sigmund Cherem b6b3ac8549 [ddc] add helper script to easily test hot reload behavior.
This adds a helper library to help us try out small hot reload behaviors
easily on the VM.

Change-Id: I01c76d3c4be8a77e5efe5b934e8c26de09a3a771
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/355260
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2024-03-01 01:27:32 +00:00
Sigmund Cherem c01ce3d3c0 [ddc] Log more data in expression-compiler tests.
Multiple end-to-end tests are failing in the bots because some steps
during the test execution are timing out. We currently have a
timeout of 5 seconds for these steps, but it's unclear if the
timeout is because of conditions in the bot machines (e.g. they are
slow), one off exceptions, or something else.

To address the flakiness, I expect we will want to increase the timeout,
but before we do it may be valuable to start measuring what is the
current distribution of timing in the bots to figure out the best value
to use.

This CL adds logging for timing data for that purpose. I've added
tracking for some interesting steps in the expresson-compiler test
framework, including the top two steps that usually hit a timeout in
practice (find-script and pause-event-for-line).

Example output on my local machine:
```
init-source: 233ms (avg), 121ms (p50), 696ms (p90), 696ms (max), 7 (total)
find-script: 18ms (avg), 18ms (p50), 21ms (p90), 25ms (max), 52 (total)
load-script: 22ms (avg), 22ms (p50), 27ms (p90), 30ms (max), 52 (total)
set-breakpoint: 0ms (avg), 1ms (p50), 1ms (p90), 2ms (max), 52 (total)
pause-event-for-line: 422ms (avg), 410ms (p50), 440ms (p90), 658ms (max), 52 (total)
check-in-frame: 459ms (avg), 446ms (p50), 480ms (p90), 695ms (max), 51 (total)
```

Change-Id: I04734b9905da8e1b4c9d06451be65a2dee32ba1c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352988
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2024-02-27 01:01:45 +00:00
Johnni Winther 6ce7ec657e [cfe] Recognize indirect use of macros
When a macro declaration is supplied as dill, the macro api library
is not directly needed by the source libraries. Therefore, in order
to determine whether macro declarations are available, we need to also
look up the macro api library in the dill loader.

Closes #54560

Change-Id: I131d3881f557566871d9e8c9f38c19029637c534
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346000
Reviewed-by: Morgan :) <davidmorgan@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2024-02-22 10:30:31 +00:00
Nicholas Shahan 0231b2ae1f [ddc] Remove more unnecessary code
After the switch to the new type system more code is unnecessary.
- Clean up logic for deferring classes because the new type system
  allows us to flatten the search to just the immediate superclass.
- Delete more `emit<xxx>Type` helper methods.
- Further differentiate emitting a Type vs a reference to a Class.

Fixes: https://github.com/dart-lang/sdk/issues/54745
Change-Id: Ia6e1accb4c9c993967cd5444c18c65938954f7d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/348766
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2024-02-21 23:04:43 +00:00
Sam Rawlins cda9755918 dev_compiler: prepare for curly_braces lint change
This aligns this code better with Effective Dart and prepares for the
upcoming lint rule change at https://dart-review.googlesource.com/c/sdk/+/353140.

Change-Id: I1b3ff4a4f85ec2182d06a67acf0e43fbc45129f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353220
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2024-02-20 16:04:30 +00:00
Johnni Winther 6e4674d445 [kerne] Remove type parameter from RecursiveVisitor
The type parameter was a left-over from a pre-nnbd encoding of the visitors, but Flutter dependency on the code prevented its removal.

TEST=existing

Change-Id: I02657a469290f169077faa1167cf59b75de13c9c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350840
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2024-02-19 07:51:43 +00:00
Nicholas Shahan 3c13e9f273 [ddc] Cleanup dead code from the runtime library
This code is no longer used now that the new runtime types are always
enabled.

Change-Id: I0c7d627199a10e023d5d1afa581812b360e9a0f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/344609
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2024-02-16 22:33:54 +00:00
Nicholas Shahan 528e1092bc [ddc] Cleanup dead code from the compiler
This code is no longer used now that the new runtime types are always
enabled.

Change-Id: Ic8e59ed43931fc89efeee48269c7da388a6c6553
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/344606
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2024-02-16 17:40:08 +00:00
Nicholas Shahan 48dd473c21 [ddc] Delete new runtime types flag from compiler
Cleanup branches that are no longer reachable.

Change-Id: If53a80915f3c7dc444e7027a8287395add23165b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/344605
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2024-02-15 22:24:27 +00:00
Nicholas Shahan f6ffe00f28 [ddc] Avoid calling addTypeCaches with new types
Some preparation for deleting all the old type system code.

Change-Id: I9319064100ce19a4122612c36781c7e4a71094aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352724
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2024-02-15 18:28:49 +00:00
Nicholas Shahan a92ac0237a [ddc] Delete tests requiring the old type system
These are tests for the specific apis of the old runtime type system
and they will never pass in the new type system.

Change-Id: I740fc06411cdc621b072782d22ec630c5b6bf96a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341784
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2024-02-14 00:13:57 +00:00
Sigmund Cherem 955c8d63f6 [ddc] shard runtime_debugger_api_test.
This test appears to be timing out consistently in windows.

We split the test in two shards (sound vs unsound null safety)
as an attempt to address this issue.

Fixes https://github.com/dart-lang/sdk/issues/54894

Change-Id: I2230be95b1685ef1e5656eae2e740a94a0eeb320
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352049
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2024-02-13 20:10:17 +00:00
Martin Kustermann c0371169b0 Cleanup some code regarding deprecated native syntax
The VM target no longer supports the `foo() native "foo";` syntax. See
final removal in [0].

Dart2Wasm has never really been using it.

* In the sdk dart2wasm uses `external` functions with
  recognizion in the compiler based on the name of the method.
* JS interop is using `@JS` based mechanism.
* Wasm to Wasm interop is based on `@Native<>()` annotations.

This means that only dart2js/ddc are remaining users of the
`foo() native;` syntax (without following string).

So we can clean up some code.

[0] https://dart-review.googlesource.com/c/sdk/+/266387

Issue https://github.com/dart-lang/sdk/issues/28791
TEST=ci

Change-Id: I929789f7a1ea5ed5423b0db0c6a306406e2db2af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351083
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2024-02-13 10:41:32 +00:00
Mayank Patke 85037bf96d [dart2js, ddc] Clean up conditional imports in dart2js_runtime_metrics
This CL:
* adds empty dart:_dart2js_only and dart:_ddc_only libraries for use in
  conditional imports,
* updates pkg/dart2js_runtime_metrics to use the new libraries rather
  than dart:_dart2js_runtime_metrics and dart:js,
* and removes some unnecessary libraries, including VM-specific
  implementations in pkg/dart2js_runtime_metrics and the DDC
  implementation of dart:_dart2js_runtime_metrics.

Change-Id: I9500aa303fa5ad8aba0e1d413f69957c268f3f11
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350681
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2024-02-09 18:38:55 +00:00
Johnni Winther fe52b9bfe5 [macros] Add dart:_macros
This adds the dart:_macros library to the SDK and adds support for accessing dart:_macros from package:macros. The library is not used yet.

This change is needed as a prestep to adding the package:macros and using it in the CFE and analyzer, and needs to be rolled in as the checked in sdk before package:macros can be supported.

TEST=ci

Change-Id: Ife3ffd48527e3a196048d2ddf7387b8b7818f3a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/348680
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2024-02-02 07:47:59 +00:00
MarkZ 91d22a7e40 [ddc] Renaming dart_library.js to ddc_module_loader.js
This also removes deprecated references to the DDC module system as the "legacy" module system.

This is part of an ongoing effort to deprecate the AMD module system: https://github.com/dart-lang/sdk/issues/52361

Change-Id: Ic32c6c6a0b7bf2c3bf0326be42cc9a88db8e303e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/348183
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
2024-01-30 19:43:49 +00:00
Nicholas Shahan 29f5b4141f [ddc] Don't emit old type system variance
The variance information emitted here is only used in the old
type system so it can be skipped when using the new representation.

Change-Id: I43093c1742f9a89ef018dd76ec7a0bcd477414c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/348801
Reviewed-by: Kallen Tu <kallentu@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2024-01-29 20:08:28 +00:00
Srujan Gaddam 3b294fdab2 [dart:js_interop] Add isA helper
Closes https://github.com/dart-lang/sdk/issues/54138

Adds a helper to do better type-checks so that users don't
accidentally using is checks or have to manually do the right
typeof or instanceof checks. In order to do this, there is
some refactoring to make ExportCreator a SharedInteropTransformer
(as it's shared across all backends) so that we can reuse an
existing visitor. In the same class, we remove unnecessary setting
of parent pointers. We should clean up the fileOffsets as well,
but dart2js verifies that those are set, so we keep them as is
for now. Also adds some static errors for edge cases.

CoreLibraryReviewExempt: Helper for web-specific library.
Change-Id: I34d818ada1349b69afd15d170d3fafa0460f65fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347225
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2024-01-25 18:52:45 +00:00
Oleh Prypin 0da8f7a7b4 Remove unnecessary imports of 'package:collection' IterableExtension
* Replace `.whereNotNull()` with `.nonNulls` which is now in Dart core.
* `.firstOrNull`, `.lastOrNull`, `.singleOrNull` and `.elementAtOrNull(i)` are also in Dart core and even under the same name, so simply drop the import of 'package:collection' whenever possible.

Bug: b/322159291
Change-Id: I81eb93426680dc78a608bbcc714eb26c0eca5c62
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/348260
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Oleh Prypin <oprypin@google.com>
2024-01-25 11:07:28 +00:00
MarkZ dd680e3b35 [ddc] Fixing failing expression evaluation tests due to renamed legacy dirs.
Fix for breaks introduced in https://dart-review.googlesource.com/c/sdk/+/348085

Change-Id: I9876ad590161ebad6146954ae837d9beb1c2d2ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/348184
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2024-01-24 22:30:07 +00:00
MarkZ 8edbcacfb0 [ddc] Removing some references to "legacy" DDC modules.
"DDC" is now the accepted name for the module system.

Change-Id: I655219ccc7cff7ff99b1311518ef6ed6e7d1b2a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/348085
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2024-01-24 21:22:25 +00:00
Anna Gringauze 389d66a515 Fix inner DDC types display
Closes: https://github.com/dart-lang/sdk/issues/54694
Change-Id: Ie141959eedc9cdbb5c675d33da985eb1ac5588e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347761
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2024-01-23 18:26:43 +00:00
Nicholas Shahan b811ab5b04 [ddc] Reset all initialized consts on hot restart
Clear local caches storing const values in each module.

Change-Id: I7766e92df6b8d1f91bad5fbb2addb8ace7763646
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347220
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2024-01-22 23:25:18 +00:00
Anna Gringauze 67e052d7e9 [dev_compiler] Fix incorrect debugger information on record types.
Closes: https://github.com/dart-lang/sdk/issues/54609
Change-Id: Ib8a24974ab1a5865d00ee361a151afebdf8a5e65
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345825
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Elliott Brooks <elliottbrooks@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2024-01-19 18:13:39 +00:00
Chloe Stefantsova 970885b879 [cfe] Use TypeParameter in DDCTypeEnvironment, TypeParameterFinder
This CL is a part of the clean up for
https://dart-review.googlesource.com/c/sdk/+/312264

Change-Id: If9d892496af5498943694ad266ee6eb151fdc3e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346401
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2024-01-17 11:00:17 +00:00
Nicholas Shahan 95cad9c8a6 [ddc] Fix semantics of capturing loop variables
Fixes the for loop lowering to JavaScript when there are function
expressions in the loop initialization, condition, or updates.

Manually assign source mapping information on js_ast nodes to 
make stepping in the Dart debugger make as much sense as possible.
With these mappings three steps are required on each loop variable 
on each iteration but it ensures that the mapping always points to the
variable instead of some random line of code in or around the original
for loop.

Fixes the failure on language/loop/for_variable_capture_test.

Issue: https://github.com/dart-lang/language/issues/3539
Change-Id: I755b88faef11804986fb3d1b2c328da3dd08fe8d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345145
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2024-01-12 20:04:52 +00:00
Jens Johansen 7e792e7a8b [kernel/DDC] Fix failing DDC tests; if finding no scope for offset find for a close previous offset instead
When landing https://dart-review.googlesource.com/c/sdk/+/342400
the ddc-mac builder (but not Linux and Windows) started failing.
I could reproduce on Linux though so I'm not sure why those builders
didn't fail (nor why it wasn't caught by the try bot), either way this
fixes the issues:

* Test update: E.g. a breakpoint at the end of the scope doesn't work
  because it will not be inside the (wanted) scope.
* Test update: Evalating "this" now actually works.
* Scope finding update: DDC adds sourcemapping entries for the *end* of
  things so e.g. the getter "c" will have offset and offset+1 added as
  source mappings. When translating from javascript position to dart
  position we might pick that and thus ask for the scope of offset+1,
  but nothing will be found because no node has that offset.
  Here I add a fall-back saying that if we get no results we ask again
  for the nearest lower offset.

Change-Id: I7e4430d9954466494b514cf51d999358483c9f8c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345501
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
2024-01-12 08:21:00 +00:00
Nicholas Shahan 1572bb563f [ddc] Delete typeRep() and legacyTypeRep()
Replaces all uses with the equivalent `TYPE_REF()` and 
`LEGACY_TYPE_REF()` because they are used in the shared dart:_rti 
library and there is no need to support both.

Change-Id: I8c04eb12856cf6933a168f3e63351a45cd5d704e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/344608
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2024-01-12 00:45:47 +00:00
Nicholas Shahan 1f35476e63 [ddc] Delete compileTimeFlag()
Replaces all uses with the equivalent `JS_GET_FLAG` because it is
used in the shared dart:_rti library and there is no need to support
both.

Change-Id: I4e347d568444caab63e4217845c14353c429cb10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/344607
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2024-01-12 00:12:35 +00:00
Jens Johansen 39d68052a9 [frontend_server/DDC] Expression compilation for JavaScript can pass scriptUri
This allows using the new scope finder and facilitates expression
compilation with and in extension types.

For now the script uri is optional (and only passable in the new json
input via package:frontend_server), and only if the script uri is passed
we'll use the new scope finder.

Flutter etc should be updated to pass the new data.

Change-Id: I36eed1ea76a825e63e4c5b9ea60daf18aee39f3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/342400
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
2024-01-10 10:12:22 +00:00