Removes the assumption from the code generator `call` helper method
that the called function has zero or one return value. This enables
the helper to be used for functions with multiple return values (e.g.
constructor initializer functions), allowing such functions to be
inlined.
Many places that explicitly called a function behind a reference using
`b.call(translator.functions.getFunction(reference))` are now using
the `call` helper like `call(reference)` such that those calls can be
inlined.
Also fixes a bug in the inlining heuristic that would allow inlining
of `async` functions, which would break.
Change-Id: I180d45de8ad36ef8ef1d27a71fc8ec473a25db8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324023
Reviewed-by: Jess Lally <jessicalally@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
This reverts commit cd8a3370e7.
Reason for revert: lint starts barking at the wrong tree: b/298917960
Original change's description:
> linter: Refactor prefer_collection_literals to use context type more
>
> There is a basic premise in this rule which we cannot satisfy exactly:
> we need to disallow `LinkedHashSet()` unless the context type requires
> the developer to use `LinkedHashSet`. But the context type is long
> gone when the lint rule is run.
>
> This CL adds some logic to try to attempt figuring out the context
> type in the cases where users have filed bugs, but it will never be
> super accurate.
>
> Fixes https://github.com/dart-lang/linter/issues/4736
> Fixes https://github.com/dart-lang/linter/issues/3057
> Fixes https://github.com/dart-lang/linter/issues/1649
> Fixes https://github.com/dart-lang/linter/issues/2795
>
> Change-Id: I3e6c6de81084dca2825488c89830ab3e7ea63186
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323680
> Reviewed-by: Phil Quitslund <pquitslund@google.com>
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
> Commit-Queue: Samuel Rawlins <srawlins@google.com>
Change-Id: I980053dd51ffd4447721e0ad7436b07ca704b554
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324021
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Ilya Yanok <yanok@google.com>
Most status updates have been copied blindly from the weak.status file.
Change-Id: I41c271c8658cb0d48d96ea6ace03279276528303
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324020
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Fixes the following:
When using `@pragma("wasm:import")` or `@pragma("wasm:export")` without the second argument (as documented in https://github.com/dart-lang/sdk/tree/main/pkg/dart2wasm#imports-and-exports), this would fail with the following error:
```
type 'NullConstant' is not a subtype of type 'String?' in type cast
#0 Translator.getPragma (package:dart2wasm/translator.dart:939)
#1 FunctionCollector._importOrExport (package:dart2wasm/functions.dart:52)
#2 List.forEach (dart:core-patch/growable_array.dart)
#3 FunctionCollector.collectImportsAndExports (package:dart2wasm/functions.dart:37)
#4 Translator.translate (package:dart2wasm/translator.dart:268)
#5 compileToModule (package:dart2wasm/compile.dart:138)
<asynchronous suspension>
#6 main (package:dart2wasm/dart2wasm.dart:134)
<asynchronous suspension>
...
```
Change-Id: Ie9b6766be10ced45ec360c7fb71cffa7097ee38a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323140
Commit-Queue: Jia Hao Goh <jiahaog@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Refactors BlockKind to pass an explicit template/message instead
of injecting words directly into the message which leads to
grammatically incorrect english in the output message.
Change-Id: I3b91abf2e5a748f3dfca2cc0a6c877e77b3ad7d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322121
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This is a reland of commit a9fc9ffc4d
Additional changes:
- Set incremental mode on generic class table
- fixes expression evaluation failure discovered by dwds tests
(generic class table was not always defined in compiled expression)
- Allow expression evaluation while the app is running in e2e suite
- Add regression tests for the expression evaluation failure.
Original change's description:
> [ddc] Add module local caches for new types
>
> - Provides fast access for types that are used multiple times in the
> same module.
> - Enable the existing type table cache when running with new types.
> - Add a similar cache for instantiated generic classes. This cache
> is used in the current type system as well to help keep the
> difference between types and classes more clear.
>
> Issue: https://github.com/dart-lang/sdk/issues/48585
> Change-Id: I32103cf0c0bcf9b9771e789c0d04e63a4365a066
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/321320
> Commit-Queue: Nicholas Shahan <nshahan@google.com>
> Reviewed-by: Mark Zhou <markzipan@google.com>
Change-Id: I9c31d1d07d7f9bb15645ac9aa6e91d35e8906e85
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323501
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Also re-order the skip checks, to avoid walking up ancestors on
every method call that isn't named 'toString'.
Change-Id: I69e9b58b1ae26d44498381546d5881c7e66d4935
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323681
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
I'm not certain all of these could be affected by new language features, but
it seems better to include them and do nothing than potentially miss something.
Change-Id: I4fc74e91511039b6679bc7b72dc3d90a1a45fc30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323661
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This changes the TypeBuilder to be a sealed class and changes
implementation to use exhaustive switch, including fixes for all
missing cases found.
Change-Id: I24436801c93ee43858d35ed6b396489fd13125be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322960
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Some customers use tools to preprocess this set of load IDs in order to optimize how code is loaded in their app. This flag allows us to emit this information as early as possible in the compiler without having to completely compile to JS.
Change-Id: I572d4f06ffd49a672767adc344819388a741e20c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323340
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
This avoids a crash from reading the this variable before it is
declared.
Change-Id: I604828c83e2179fa63f2037832e82db013fbfe4c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323580
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Static invocations of external factories are casted so that the
result, which is a @staticInterop type, can be treated as the erased
type instead. This CL fixes the issue where the type that it was
casted to was never replaced with the erased type.
Change-Id: Ic6eb529349ea2b5c42f91c2740d501d4f81bc38e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323505
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
No functional changes, just switching from `withoutMarkers()` and `positionFromMarker()` to use `TestCode` while I was in these files.
There are now approx 130 calls to `withoutMarkers()` remaining.
Change-Id: I71e7fa918d2ef00e7ad64820392920a1f28a7222
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323480
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This reverts commit a9fc9ffc4d.
Reason for revert: Breaks some expression evaluation tests in DWDS
Original change's description:
> [ddc] Add module local caches for new types
>
> - Provides fast access for types that are used multiple times in the
> same module.
> - Enable the existing type table cache when running with new types.
> - Add a similar cache for instantiated generic classes. This cache
> is used in the current type system as well to help keep the
> difference between types and classes more clear.
>
> Issue: https://github.com/dart-lang/sdk/issues/48585
> Change-Id: I32103cf0c0bcf9b9771e789c0d04e63a4365a066
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/321320
> Commit-Queue: Nicholas Shahan <nshahan@google.com>
> Reviewed-by: Mark Zhou <markzipan@google.com>
Issue: https://github.com/dart-lang/sdk/issues/48585
Change-Id: Ied36cd006249cce32426b8d0b52d3443fdbce59a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323500
Auto-Submit: Nicholas Shahan <nshahan@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>