Commit Graph

22 Commits

Author SHA1 Message Date
Johnni Winther e30cd0322c [cfe][Contexts] Split VariableDeclaration and VariableStatement
This separates VariableDeclaration from Statement. VariableDeclaration no longer implements Statement and variable declared in a block or in a for-statement are now wrapped by a VariableStatement.

Currently there are two VariableStatement implementations; LegacyVariableStatement for variables in the current model, called LegacyVariable, and VariableInitialization for variables used in the new, still experimental, encoding that supports scope computation.

This CL is a step towards realigning the AST nodes to the new model in which each kind of variable has its own distinct subclass. (LocalVariable, PositionalParameter, NamedParameter, SyntheticVariable, etc.)

Note that it is not the intent to use VariableStatement in ForStatement going forward but that will be handled in a follow-up.

TEST=existing.

Change-Id: I5b309cd62c9b138f95b74fb054686edffa49a393
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/502681
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2026-05-18 05:49:28 -07:00
Paul Berry d810c7d0c0 [front_end] Bump language version to 3.9 and reformat.
This commit was generated by the following steps:

- Manually change the SDK constraint in `pkg/front_end/pubspec.yaml`

- Run `gclient sync`

- Run `find pkg/front_end/benchmarks pkg/front_end/lib
  pkg/front_end/presubmit_helper.dart
  pkg/front_end/presubmit_helper_spawn.dart pkg/front_end/test
  pkg/front_end/tool -iname '*.dart' | xargs
  tools/sdks/dart-sdk/bin/dart format`

- Manually fix remaining long lines and add dead code ignore comments.

- Fix coverage by running `dart --enable-asserts
  pkg/front_end/test/coverage_suite.dart --tasks=5
  --add-and-remove-comments`

- Fix `pkg/front_end/test/coverage_merger/assert_message_auto_ignored`
  by running `dart pkg/front_end/test/unit_test_suites.dart -p
  pkg/front_end/test/coverage_merger/assert_message_auto_ignored
  -DupdateExpectations=true`

The diff is large because the version bump causes the formatter to
switch into "tall mode".

Change-Id: I6a6a696410da8b168060acfe0e4d6e91e294c4f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/447628
Auto-Submit: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2025-08-29 07:31:41 -07:00
Johnni Winther 3c2f59da47 [cfe] Improve predicate helper for extension (type) members
This adds support for computing the qualified name for all extension and extension type members.

The `lowering_predicates_test.dart` is removed and testing is performed through `predicate_test.dart`.

Change-Id: I334bb85d48b6b1fd8fa01de6576f61168b3e96fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/424443
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2025-04-29 03:22:54 -07:00
Johnni Winther 0060b0f665 [cfe] Remove nnbd mode
TEST=existing

Change-Id: I30bbadb74e81c7f4aaa444d1e2f6f5ffc2005d4a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/412881
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2025-03-04 01:46:51 -08:00
Johnni Winther b48d4f224f [cfe] Cleanup imports
Change-Id: I60891b46119d6451810adf2846a05a66050bacd0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373246
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2024-06-27 08:54:39 +00:00
Johnni Winther 43db6c6ba8 [cfe] Split id-testing helpers
This prepares for adding id-test support in ddc.

Change-Id: I96d35b06e5e32f464cd487dc852ec114064afc9d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/334161
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2023-11-06 14:06:46 +00:00
Johnni Winther 6d2e6f9452 [cfe] Improve switch encoding
Addresses https://github.com/dart-lang/sdk/issues/51554#issuecomment-1466946211

Closes #51391

TEST=existing

Change-Id: Idec105dcfde4a91d0a21a1907777d6c07e5f01b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289224
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2023-03-20 15:21:52 +00:00
Johnni Winther 3e2f98d652 [cfe] Add support for custom data in id testing
This allows for using data created in the TestConfig in the computation
of test results.

Change-Id: Ia4820d0b739b01272f10d2c2561fcf77ae007031
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/225731
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-12-31 15:12:32 +00:00
Johnni Winther 28e8f04f8e [cfe] Export tear-off lowering predicates in api_prototype
Change-Id: Iba3d68af13f866500015bf755dfca27add8c59cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/221628
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2021-12-01 14:21:38 +00:00
Johnni Winther 450ff2976d [cfe] Migrate (more) CFE tests (part 11)
Change-Id: I905adcd2125ce66d6ba9923d996354657b679cec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220965
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-11-24 11:15:41 +00:00
Jens Johansen 1197e15a7e [CFE] Enable avoid_void_async lint
This CL enables the avoid_void_async lint in the CFE, makes the needed
changes and adds the missing `await` (because the lint
`unawaited_futures` doesn't react to void async methods).

Change-Id: Iffc1f173badd3c2d48356ee02e81a9aed492ce5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213481
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-09-23 11:58:18 +00:00
Sam Rawlins 9f0c408376 Remove redundant imports from front_end
Very often there were two imports of the same URI, one of which also
had a `show` combinator. I opted to remove the other one.

Bug: https://github.com/dart-lang/sdk/issues/44569
Change-Id: I1263c892f94f0645fda6dee371dfc1fcddcd2344
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213846
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-09-20 15:33:43 +00:00
Johnni Winther a6cc772b67 [cfe] Add always_declare_return_types lint
Change-Id: I206a7a8132b5ea79dc019acf5c2e0cd800307bcf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212161
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-09-02 08:07:23 +00:00
Johnni Winther 3eac19026b [cfe] Add annotate_overrides lint
Change-Id: I90a6d5c7d64ed23acd94b9a8dda58d53da4fe8df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212041
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-09-01 16:24:16 +00:00
Johnni Winther 93c531f1a0 [cfe] Move force* flags from TargetFlags to TestTargetFlags
TEST=existing

Change-Id: I3db6f5bdd72ca6303766b6524df19e66b1ba1cc7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212001
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-09-01 13:29:26 +00:00
Johnni Winther 34fb48bb8a [kernel,front_end] Migrate first wave of pkg/kernel and pkg/front_end
Migrates libraries dependent only on already migrated libraries.

Change-Id: I0e85ee8dbc2afce031b92e0009e71c206a55af28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179502
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-01-18 15:40:21 +00:00
Johnni Winther e7b15e9486 [cfe] Add more late lowering helpers
Adds helpers for extracting original name of a lowered late field, the
original initializer and the field used to hold the value of the lowered
field.

This helps backends to customize late field encoding while still using
the lowering provided by the cfe.

Change-Id: Ib42af539efad84a08a6e32acd29d2efaff129cd7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178989
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-01-14 12:46:52 +00:00
Johnni Winther 3d19493f2d [cfe] Add flag to identify lowered locals
+ add predicate helpers to identify these and extract their
original names.

TEST=pkg/front_end/test/predicates/predicate_test.dart

Change-Id: I4d94c575d010b6b01c985eaf5392b9e0e979d044
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175250
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-12-08 14:53:14 +00:00
Johnni Winther 2fafa55d90 [cfe] Add predicate functions for detecting locals created for late lowering encodings
Change-Id: If9c53d4002f6e3cd85c116fb04ea93244a872a71
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174123
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-12-02 09:15:18 +00:00
Johnni Winther 7b89827956 [cfe] Support bit mask for enabling specific late lowerings
TEST=pkg/front_end/testcases/late_lowering/late_lowering_bitmasks.dart

Closes #43993

Change-Id: I47d238dd7cf0ea22983a38bed86e415330070596
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171580
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-11-11 14:06:30 +00:00
Johnni Winther b42f954364 [cfe] Use experiment release version when non-nullable is enabled explicitly
Even when non-nullable is enabled by default, enabling the experiment
explicitly should result in the experiment release version (and not
the experiment enabled version) to be used for opting in.

For this change, the semantics of parseExperimentalFlags was change
to _not_ normalize the flags to a full mapping including default values.
For this reason all uses of such maps are renamed to
'explicitExperimentalFlags'.

Closes #43879

Change-Id: I0d0262e68ec1403549abcfd305ae3a4404fe93e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168654
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-10-22 06:17:39 +00:00
Johnni Winther 6708394f03 [cfe] Add predicates to detect late lowered fields.
Needed for https://github.com/dart-lang/sdk/issues/41892

Change-Id: I049e76655cf62a5558c18319e80ab9702c7a3c22
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148321
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-05-19 08:55:20 +00:00