Separate the subtype search entry points by result shape and caller
intent. Use `directSubtypeReferences` for reference locations in subtype
clauses, and use `directSubtypesWithMembersOfType` /
`directSubtypesWithMembersOfSubtype` for indexed direct subtypes with
their declared instance members.
Rename `SubtypeResult` to `DirectSubtypeWithMembers` so the model
matches what the search result actually represents. Update the server
member-collection logic to start from direct subtypes of the target type
and then walk direct subtypes by subtype id.
Introduce `SubtypeIndexElementId` as the single representation of
subtype index ids. This keeps id construction consistent between index
building and search, preserves the declaration file for declarations in
parts, and still exposes the element name separately for file-state
prefiltering.
Also make the subtype index expectations text-based so the expected
supertype id, subtype name, and member list are easier to read and
update.
Change-Id: Ice71d9b116aca83372bf595f6e58a8ce4aa9e9d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507780
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
The assist was originall written as a fix, but it's on the list of new
assists that we think users would find useful, so I made it also work
as an assist. The tests are just a copy of the tests for the fix.
The assist is available when the cursor is inside the name of a field
on the left side of a field initializer.
Unlike the lint, which only flags initializers if there is a reference
to a constructor parameter on the right side, the assist will move any
initialization expression. I think that's reasonable, but let me know
if you think we should limit it.
Change-Id: I4f6d90dbd510d5c93f0087933741d298939d4a49
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508680
Reviewed-by: Samuel Rawlins <srawlins@google.com>
This code seemed a little out of date and non-idiomatic. I used a few modern language features to help it to better comply with our team styles.
* Make declarations private if they can be.
* Make declarations final if they can be.
* Use factory constructors over static methods.
* Do not use type annotations that would be inferred.
* Use patterns for matching JSON data.
* Use extension type when appropriate.
Change-Id: Ib7ecbe51b6d8a94e56a51f84772952362c64049f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508424
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Replace the local marker-based _AstTest helper in ast_test.dart with
ParserDiagnosticsTest parsing and the shared findNode utilities. This
keeps the tests aligned with the inline diagnostics style used by other
parser tests, and avoids a second way to locate AST nodes from marked
source snippets.
Update the affected tests to parse normal source text, then locate the
expected node through findNode single-node accessors. Add a
singleConstructorName accessor so constructor-name tests can use the
same shared lookup path.
Change-Id: Ib8c7c2e7c2c1b320c95810ce148b5a27e68dda43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508421
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This adds an internal class hierarch for patterns. This allows for the internal nodes to use InternalVariable rather than Variable and only contain the fields created during body building. This is a step towards separating Variable and InternalVariable fully.
Change-Id: I0e5241bc7163e0771d3420496b1f5ea02b433c87
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508561
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Initializers of late local variables are wrapped into closures.
The result type of a closure is a static type of the variable.
So initializer of a late variable with static type Never have a call
to a closure with static result type Never.
TFA summary collector handles calls with static result type Never
specially, treating all subsequent code as unreachable (by setting
control-dependent condition to empty). As a result, all subsequent
code after late variable with static type Never (and initializer) is
tree-shaken.
The fix is to avoid propagating control-dependent condition out of
the late variable initializers.
TEST=pkg/vm/testcases/transformations/type_flow/transformer/regress_63478.dart
Fixes https://github.com/dart-lang/sdk/issues/63478
Change-Id: If41221777c9d249dd21ce5827c586b0f531cbce8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508363
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
The only actual change required to the profiler service is appropriately
retrieving the source position for interpreted frames during processing.
Otherwise, most of the tests just need small changes to account for the
slightly different stack trace generated by interpreted code when
walking the stack as code instead of functions:
* Interpreted code calls the runtime entry DRT_AllocateObject directly
for slow-path allocation instead of via the AllocateObjectSlow stub.
* The current name for bytecode frames when walked as code starts with
"[Bytecode]" instead of "[Unoptimized]".
The test vm/cc/Profiler_GetSourceReport is skipped since:
* It tests compiled code-specific features like classifying source
positions.
* Inserting fake samples for interpreted functions is messier since
many PC offsets may map to the same source position.
The other skipped tests are specific to inlining and/or optimized
compiled code, so there's no point in running them on interpreted code.
TEST=vm/cc/Profiler
Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try
Change-Id: I3e73f42b2562eb6e3e73fe8d5c3f14389039ee04
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507082
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
The debugger assumes a null suspend state variable in an asynchronous
function means that the function is still in the prologue prior
to setting up the suspend state. However, the interpreter clears the
suspend state variable before returning, and the debugger needs to be
able to pause before returning when single stepping, so earlier a hack
was added to the debugger that detects being at the direct call of the
async return method and/or the return instruction with a null suspend
state variable.
However, there's a much simpler way of ensuring the debugger pauses
before returning: just emit the source position for the return prior to
clearing the suspend state variable. This also ensures that the debugger
still has access to the function's suspend state when pausing before
the return, instead of waiting until it has been cleared and thus is no
longer accessible.
TEST=ci (should not change the result of any current tests)
Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try
Change-Id: I401cceb169d8692ac379cdc5a531e07cafbe9a65
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/500740
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Given that the standalone target for dart2wasm is feature-complete now,
it makes sense to include it in released SDKs.
This adds the platform and outline files to built SDKs and exposes the
`--standalone` flag in `dart compile wasm`.
It also documents the standalone target in `pkg/dart2wasm/doc`, which
should be helpful as a starting point to use these compiled modules.
Change-Id: I5bd86e9670f03f2955e31789095dd5c462bf149e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/506920
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Because non-late field initializers in classes with primary constructors have access to the parameters of the primary constructor, field initializers are be moved to the initializer list of this constructor, so the generated AST will no access these parameters out of scope.
This CL add an exception to this rule for mixin classes:
In the non-erroneous cases, these can't have parameters, so the field initializers can stay in the field declaration. This is done to ensure that mixin transformation can
simply clone the mixin class fields, instead of having to fetch the initializer from the initializer list of the constructor.
For mixin classes with parameters in the primary constructor, which is an erroneous case, the initializers are moved to the constructor like for other
primary constructors to avoid generating an AST where the parameters are accessed out of scope.
Change-Id: Iff64992bce88368a524437c1856f50d779bf6a58
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507423
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This updates the handling of initializers in primary constructor body declarations. The parser is updated to pass the `:` token, similar to what is done for the regular constructors. The CFE is updated to use a boolean, rather that the `:` token (or a synthetic token), to determine whether initializers should be processed as part of building the outline. The parsing of initializers is done using the `:` token, if any, now pass both from regular constructors and primary constructor body declarations.
Closes#63468
Change-Id: Ia266dea7946b30b02d56f9f3cedf40848c4ee440
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507401
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
dartfuzz has been taking ~35 min to finish the build and upload steps even with 100% RBE cache hit rate, causing it to fail to finish before the first wave of nightly builders trigger.
Change-Id: I932facd77bc08f4d7236ae8c760013406a69fb0e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507267
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
`dart:test` compiles a wrapper file that it places _outside_ all
packages defined in the `package_config.json`.
Technically, the `package_config.json` is only used to resolve the
imports that are _not_ the entry-points. So, it should be valid to
pass an entry-point outside the `package_config.json`.
However, we do need to specify what root-package to use for running
hooks. So, add a CLI option for this.
See discussion on https://github.com/dart-lang/test/pull/2660
Change-Id: I381a61490e69eb5757126b017f07779917837851
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-win-release-arm64-try,pkg-mac-release-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508122
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
This fixes a bug where an interactive form where all fields have defaults would be considered complete immediately, so we'd never present the fields to the client.
It also includes some minor refactoring extracted from a future CL that implements command/resolve and supports Interactive Forms in refactors in an attempt to reduce the size of that change to aid reviewing.
Change-Id: I176fe25dbb0b610d69617fa04562b0d3ce571642
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508220
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
This will make GN notice conflicting copy_tree destinations.
It may also fix a race when two copy_tree's with a common parent directory create that parent directory.
Change-Id: I1783ea170f0390d4026123ed43c00cd15eb0b1c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508241
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
This updates the interactive forms classes to reflect recent changes.
Previously, we would only send back the outstanding fields to the client, and it would only provide answers for the same.
Now, the server will always send all fields to the client, and the client will always provide all answers. Answers are looked up IDs (a new field on `FormField`, and `FormAnswer` which wraps the answer) rather than rely on indexes.
Fields can also now be required.
Change-Id: If4aa1f9a18fa873e83cb0ea1fd74c2e42cd2fa1f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508103
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
For closures generated from both FunctionDeclarations and
FunctionExpressions, the starting file offset of the generated closure
function should be the file offset of the node itself, not the file
offset of the FunctionNode.
(This matches the logic in KernelLoader::LoadClosureFunction.)
TEST=pkg/vm_service/test/coverage_extension_methods_test
Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try
Change-Id: I25a0cd0aa6505e122a215237ca6ef7e8edb031af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507424
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Some instance calls involving numbers in bytecode are converted to
specialized bytecode instead of generating an InstanceCall instruction.
When emitting RecordCoverage instructions, add them prior to these
specialized bytecodes as well.
TEST=ci
Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try
Change-Id: Ic1ab6be4123766d7ce583966dfde393a5df77579
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507421
Reviewed-by: Alexander Markov <alexmarkov@google.com>