Johnni Winther
1683fd5c16
[_fe_analyzer_shared] Ensure beginToken on class, enum, mixin, extension and extension type
...
This passes the first token of these top level declaration directly
to the endX listener method.
In the CFE this is used to ensure that can handle the new modifiers in
the textual outline. Furthermore, support for extension types is added
and having an "unknown chunk" now results in an error. The latter should
help us keep the textual outline up-to-date wrt new features.
Change-Id: I813d6162b6cba0a2bf550ed33a6091abf9bf49f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324702
Commit-Queue: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
Reviewed-by: Jens Johansen <jensj@google.com >
2023-09-15 13:01:10 +00:00
Johnni Winther
b745fa8923
[cfe] Avoid "Instance of " in parser intertwined test expectations
...
Change-Id: I7d7b1c9a001c43ec160d26c478bd71b41505f273
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323361
Reviewed-by: Jens Johansen <jensj@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
2023-09-04 13:06:29 +00:00
Johnni Winther
e3621561aa
[parser] Refactor BlockKind
...
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 >
2023-09-04 09:40:21 +00:00
Johnni Winther
b1594fa130
[parser] Handle invalid extension type header in error recovery
...
This expands the existing recovery for class headers to handle
invalid, out-of-order, and duplicate clauses in extension type
declaration headers.
Change-Id: I7b33b91cc718e4c0673137121b8d083fa0ef1562
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/321900
Reviewed-by: Jens Johansen <jensj@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
2023-08-24 11:20:18 +00:00
Johnni Winther
7e9c1c8018
[parser] Add error recovery to extension type declaration parsing
...
This changes the parser to always interpret `extension type` as the
start of an extension type declaration.
Recovery is added to handle missing identifier, primary constructor,
parameter constructor parameters, and extension type declaration body.
Change-Id: I98cac0b2641167c4708fa20b22f0de0a70336457
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/321704
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Reviewed-by: Jens Johansen <jensj@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
2023-08-22 12:05:10 +00:00
Johnni Winther
29003657e2
[parser] Remove support for 'inline class' syntax
...
+ removes tests using 'inline class' syntax or replace them with
extension type syntax.
TEST=existing
Change-Id: Ic98178c4df9a1585ad0167cfd8847caa7b771e3e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/321120
Commit-Queue: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com >
Reviewed-by: Paul Berry <paulberry@google.com >
Reviewed-by: Alexander Markov <alexmarkov@google.com >
2023-08-22 11:26:54 +00:00
Johnni Winther
74fa24d4c0
[cfe,analyzer] Remove 'extension-types' experimental flag
...
This is not the flag you're looking for.
The 'extension-types' flag was used for an early experiment that is
not directly related to the Extension Types feature currently being
developed. The current feature uses the 'inline-class' flag.
Change-Id: Icbb6c3828c41e743e726161b17da4c7784a2c677
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316380
Reviewed-by: William Hesse <whesse@google.com >
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
2023-07-27 09:30:36 +00:00
Jens Johansen
b535072a07
[parser] Fix issue 52365 about parsing parenthesised functions followed by >> etc
...
Record parsing is generally done by accepting what comes after as
something that can follow a record type.
To support something like `List<List<(int, int)>>` we have to accept
`>>` after a record type.
When parsing something like `(whatever here) >> 42;` we thus say that
it's a record --- even if the stuff inside is a recovered type. We
inherit the `recovered` mark, but will say we're a record type.
This CL fixes parsing this by returning that it's _not_ a record type
when seing the `>>` (an a few others) if what's inside is recovered.
This _might_ mean worse recovery in some situations but fixes parsing
valid code such as `(() => print("hello")) >> 42;`.
Fix: https://github.com/dart-lang/sdk/issues/52365
Change-Id: Ie56958f5503e74d37c181c0b71003b8e61209c6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303242
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Paul Berry <paulberry@google.com >
Commit-Queue: Jens Johansen <jensj@google.com >
2023-05-16 06:09:47 +00:00
Paul Berry
8aa48712be
Patterns parsing: recover from patternVariableDeclaration non-statement.
...
Previously, if a pattern variable declaration appeared outside of a
function or method, the parser would get very confused. Now it
recognizes the situation, issues a comprehensible error message, and
replaces the pattern with a synthetic identifier token so that the
analyzer AST is somewhat sensible.
Fixes #51322 .
Bug: https://github.com/dart-lang/sdk/issues/51322
Change-Id: Ica5f060cb483a39c4e50942d639939b1fab40bea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/293087
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Commit-Queue: Paul Berry <paulberry@google.com >
2023-04-04 14:55:00 +00:00
Brian Wilkerson
101a2b4287
Add documentation for new diagnostics
...
I have not yet run the analyzer's generators just to keep the generated
version of the changes out of the review.
There are 10 parser diagnostics that are not being documented:
- ParserErrorCode.INVALID_CONSTANT_CONST_PREFIX
- ParserErrorCode.INVALID_CONSTANT_PATTERN_BINARY
- ParserErrorCode.INVALID_CONSTANT_PATTERN_DUPLICATE_CONST
- ParserErrorCode.INVALID_CONSTANT_PATTERN_EMPTY_RECORD_LITERAL
- ParserErrorCode.INVALID_CONSTANT_PATTERN_GENERIC
- ParserErrorCode.INVALID_CONSTANT_PATTERN_NEGATION
- ParserErrorCode.INVALID_CONSTANT_PATTERN_UNARY
- ParserErrorCode.FINAL_MIXIN_CLASS
- ParserErrorCode.INTERFACE_MIXIN_CLASS
- ParserErrorCode.SEALED_MIXIN_CLASS
Let me know if you think any of those need documentation.
Change-Id: I904ecaeb07383fedcdc5c7c286f36d635ed8684e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286524
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com >
Reviewed-by: Marya Belanger <mbelanger@google.com >
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
2023-03-21 00:36:23 +00:00
Johnni Winther
bd02ce7a7f
[cfe] Report error on : for default values
...
Closes #51576
TEST=pkg/front_end/testcases/general/colon_default_value
Change-Id: Ia8ccdf697d876dbefcbf2c5ed98d01634c075e74
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286183
Reviewed-by: Alexander Markov <alexmarkov@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
Reviewed-by: Nicholas Shahan <nshahan@google.com >
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com >
2023-03-06 19:04:55 +00:00
Johnni Winther
d4a73e3b82
[cfe] Report errors on invalid const patterns with explicit 'const'.
...
Change-Id: I4f5994fd1f0d5e5289684e0da2f03720706f6d28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281840
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Reviewed-by: Jens Johansen <jensj@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
2023-02-15 10:34:28 +00:00
Johnni Winther
d89ae3c2c6
[parser] Report error on invalid const patterns
...
This handles the restriction imposed on the expression occurring
within a constant pattern.
Change-Id: I946d85f908609340a61e060c6bdbee143666fd91
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280460
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Reviewed-by: Jens Johansen <jensj@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
2023-02-09 12:43:31 +00:00
Lasse R.H. Nielsen
bee7ab2b32
Make record positional field getters start at $1.
...
An update for co19 is available at https://github.com/dart-lang/co19/pull/1759
TEST=Existing tests run after change, two new tests for edge cases.
Change-Id: I408e398d532ba2c2e8e60777bb4f7bd0057e27fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278912
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Nicholas Shahan <nshahan@google.com >
Reviewed-by: Stephen Adams <sra@google.com >
Reviewed-by: Aske Simon Christensen <askesc@google.com >
2023-01-30 08:14:28 +00:00
Kallen Tu
ca974e5c4f
[analyzer/cfe] Reland: Parse final class modifier.
...
Reland same files as https://dart-review.googlesource.com/c/sdk/+/278090
The only major change is parser_impl.dart parsing changes for 'final'
This change should allow 'final' for classes and mixins and maintain prior final behaviour for other constructs such as enums, typedefs, or the breaking line which was 'final library = ...;'
Change-Id: I3d84fc47479f39df6d5b0dcbe8f92d1fb78a826a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279076
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
Commit-Queue: Kallen Tu <kallentu@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
2023-01-19 16:08:28 +00:00
Josh Soref
9e4dc755cb
Spelling pkg
...
Closes https://github.com/dart-lang/sdk/pull/50921
GitOrigin-RevId: 6b1ca502b6722b0a987f33ace66f65cbd2c24e23
Change-Id: I74e4ff3c8e759c576036d6b791bd7734ebd215d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278536
Reviewed-by: Alexander Thomas <athom@google.com >
Commit-Queue: Alexander Thomas <athom@google.com >
2023-01-19 10:06:29 +00:00
Kallen Tu
ed1157acc4
Revert "[analyzer/cfe] Parse final class modifier."
...
This reverts commit 2f1372b460 .
Reason for revert: Breaks the build. Unsure if there are other affected failures.
Original change's description:
> [analyzer/cfe] Parse final class modifier.
>
> Change-Id: Ia554c4f8f9617cc883a472eeb819aab2fd849077
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278090
> Reviewed-by: Johnni Winther <johnniwinther@google.com >
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
> Commit-Queue: Kallen Tu <kallentu@google.com >
TBR=scheglov@google.com ,johnniwinther@google.com ,kallentu@google.com ,dart-scoped@luci-project-accounts.iam.gserviceaccount.com
Change-Id: I5dd74202bd46d69b7261d6d30d8cf3b1a40dbc99
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279040
Reviewed-by: Jake Macdonald <jakemac@google.com >
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
2023-01-13 21:04:01 +00:00
Kallen Tu
2f1372b460
[analyzer/cfe] Parse final class modifier.
...
Change-Id: Ia554c4f8f9617cc883a472eeb819aab2fd849077
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278090
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
Commit-Queue: Kallen Tu <kallentu@google.com >
2023-01-13 19:16:20 +00:00
Kallen Tu
4aaf1a2cb1
[analyzer/cfe] Parse base and interface class modifiers
...
Change-Id: I52f8ac53ec504b4c1d07c04744b4b079a1163dfd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277721
Commit-Queue: Kallen Tu <kallentu@google.com >
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
2023-01-12 18:47:39 +00:00
Jens Johansen
82e1b443a6
[parser] Recover when there's space between metadata and parenthesis
...
In https://dart-review.googlesource.com/c/sdk/+/272600 the change to
disallow spaces between metadata and parenthesis is the parenthesis
is supposed to be arguments for the metadata. Recovery was requested
on that CL and this is it.
Change-Id: I26c809f09cf8411365a2b758f635a494e7ebbd49
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278516
Commit-Queue: Jens Johansen <jensj@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
2023-01-11 07:56:47 +00:00
Jens Johansen
79fd3dde08
[parser] 'on' after 'try' is always an on-clause
...
https://github.com/dart-lang/language/blob/master/accepted/future-releases/records/records-feature-specification.md#ambiguity-with-on-clauses
Fixes https://github.com/dart-lang/sdk/issues/49980
Change-Id: I0dadbdd5bf7ac1fef69191e38eaaa705cda60f2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275922
Commit-Queue: Jens Johansen <jensj@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
2023-01-06 11:11:59 +00:00
Jens Johansen
6bce0d6b7a
[parser] Breaking change for metadata parsing
...
https://github.com/dart-lang/language/blob/master/accepted/future-releases/records/records-feature-specification.md#ambiguity-with-metadata-annotations
Change-Id: I47e584868f2a12a2553cbd57e3e5b8fbacaa5f27
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272600
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Commit-Queue: Jens Johansen <jensj@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2022-12-20 11:22:58 +00:00
Kallen Tu
120bfdc076
[analyzer/cfe] Parse 'mixin class' behind sealed flag.
...
Allow 'mixin class' modifier which allows a class to be used as a mixin.
https://github.com/dart-lang/language/blob/master/working/base-interface-final/feature-specification.md
Change-Id: I6b4dac75f2ff09b7ef833c5e015b1baf7fa3883b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275144
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Commit-Queue: Kallen Tu <kallentu@google.com >
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
2022-12-14 15:41:58 +00:00
Paul Berry
e9a1248fc2
Add parser support for patterns in for-in statements and collection elements.
...
Bug: https://github.com/dart-lang/sdk/issues/50035
Change-Id: I9eda03c1501cf3164cfb09cf9084576a5d1141cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273122
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
Reviewed-by: Jens Johansen <jensj@google.com >
Commit-Queue: Paul Berry <paulberry@google.com >
2022-12-02 15:22:38 +00:00
Paul Berry
599911d197
Add parser support for for (var pattern = expression; ...; ...)
...
Bug: https://github.com/dart-lang/sdk/issues/50035
Change-Id: I5f07b848ba06be403e56538a4cc64f6de51bd668
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273005
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
Commit-Queue: Paul Berry <paulberry@google.com >
2022-12-01 21:49:47 +00:00
Kallen Tu
835317d7da
[cfe] Add initial parser support for sealed classes.
...
Basic support for the `sealed` keyword and added a few tests.
Change-Id: I5adedda22b1e8ce6d4b61136ad8e6d38bdf05043
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268366
Commit-Queue: Kallen Tu <kallentu@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
2022-11-09 17:39:59 +00:00
Johnni Winther
5baa4af7d8
[analyzer,cfe] Add 'views' feature and support for 'view class'
...
This adds the 'views' feature flag together with parser support
for 'view class'. If the feature is not enabled, an error is reported.
TEST=pkg/front_end/parser_testcases/views/...
Change-Id: I813ac86a0e7de9f0a5729c6d7ae35b82d1258ae5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/265780
Commit-Queue: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Alexander Markov <alexmarkov@google.com >
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
Reviewed-by: Jens Johansen <jensj@google.com >
Reviewed-by: William Hesse <whesse@google.com >
2022-11-02 11:09:59 +00:00
Paul Berry
4cf63fb382
Parser and listener API changes for supporting pattern guards.
...
These are in their own CL so that it's easy to verify that no
functionalty has changed, even though a lot of parser expectations
files are affected.
In a follow-up CL, I'll add code that actually parses pattern guards.
Bug: https://github.com/dart-lang/sdk/issues/50035
Change-Id: I79f5a02df45e29b69aa4d8348cfdf27042ada9d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/264020
Reviewed-by: Jens Johansen <jensj@google.com >
Commit-Queue: Paul Berry <paulberry@google.com >
2022-10-14 15:42:12 +00:00
Jens Johansen
27e0e84cc3
[parser] Allow parsing top-level getter called get that's async/async*/sync*
...
Change-Id: I07e9759cdf61e1b633bbc0e7cd961d80ecfedf8e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/263129
Commit-Queue: Jens Johansen <jensj@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2022-10-14 11:21:48 +00:00
Jens Johansen
b3dbaadc83
[parser] More corner cases for record types
...
* required is a modifier when followed by [record type] `?`.
* Parse record type as record type if followed by `super` or `?` `super`
or `?` `this`.
* Typedef with record type follow by `?`.
* Parse record type as record type in get/set with async/sync/sync*.
* Parse record type as record type when followed by `>>=` or `>>>=`
(for weird formatted use in typedefs).
Change-Id: I19e208497e28780fb1505139c488e943751cce25
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/263123
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Jens Johansen <jensj@google.com >
2022-10-14 09:33:58 +00:00
Jens Johansen
c784cc7500
[parser] Don't always parse question as part of record type
...
Change-Id: I48468c2531e01a9f535e9d973c57911c28967bcb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262605
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Jens Johansen <jensj@google.com >
2022-10-07 10:11:34 +00:00
Jens Johansen
97cdb043da
[parser] Parse record type return type for operators
...
Change-Id: I23b5ef38a9bfd58c327303198e59d9b50ace323b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262681
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Commit-Queue: Jens Johansen <jensj@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2022-10-07 08:59:39 +00:00
Jens Johansen
575ae24207
[parser] Parse record type question after modifier
...
Change-Id: If2dd018a79719bd0f5a9a44f46fb102c3595d08e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261644
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Commit-Queue: Jens Johansen <jensj@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2022-10-07 08:52:04 +00:00
Jens Johansen
af2f4e2d29
[parser] Parse record type used in optional and named parameters
...
Fixes https://github.com/dart-lang/sdk/issues/50136
Change-Id: If02c0d86244ef9cd3685256e583b987d438307d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262961
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Commit-Queue: Jens Johansen <jensj@google.com >
2022-10-07 06:39:08 +00:00
Jens Johansen
eb80f37103
[parser] Parse record type in for in
...
Change-Id: I96773ecf597685bd6cdfe7da9971b42aea1488e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262940
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Commit-Queue: Jens Johansen <jensj@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2022-10-07 06:37:42 +00:00
Jens Johansen
e860cf241b
[parser] Empty record
...
https://github.com/dart-lang/language/pull/2535
Change-Id: I8241119ee858ce39673472056b88c9393799e1a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262600
Commit-Queue: Jens Johansen <jensj@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
2022-10-06 06:34:58 +00:00
Jens Johansen
92b97fe6fb
[parser] Field formal parameter with explicit record type
...
Fixes https://github.com/dart-lang/sdk/issues/50007
Change-Id: I4cce2fd49db9a71b344d5d3e3ea1e0a941a434ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262200
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Jens Johansen <jensj@google.com >
2022-10-03 07:14:26 +00:00
Jens Johansen
a2466e26c5
[parser] Parse nested generics with records
...
Fixes https://github.com/dart-lang/sdk/issues/50005
Fixes https://github.com/dart-lang/sdk/issues/50057
Change-Id: I6c84f20093b27c4d2f51e7058295257b5d82288e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261642
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Jens Johansen <jensj@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
2022-09-29 07:28:47 +00:00
Jens Johansen
f9e508a0cc
[parser] Parse typedef with record return type
...
Fixes https://github.com/dart-lang/sdk/issues/49994
Change-Id: I5212b780bdd4e28c7c3afcabc72c9e65f7caecfc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261604
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Jens Johansen <jensj@google.com >
2022-09-29 06:28:36 +00:00
Paul Berry
9eb5544ec1
Parser: split some pattern/expression parsing logic.
...
This change restores `parseParenthesizedExpressionOrRecordLiteral`,
`parseArguments`, and `parseArgumentsRest` to the way they looked
prior to adding parser support, and instead adds new methods
`parseParenthesizedPatternOrRecordPattern` and
`parseExtractorPatternRest` that are specialized for patterns parsing.
Bug: https://github.com/dart-lang/sdk/issues/50035
Change-Id: I104e031a796ef7f217cd427e1a9ae94a04dafa7b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261620
Commit-Queue: Paul Berry <paulberry@google.com >
Reviewed-by: Jens Johansen <jensj@google.com >
2022-09-28 12:50:56 +00:00
Paul Berry
d7e130e930
Patterns parsing: update expectations (no functional change).
...
For ease in code review, I've made all the changes that affect test
expectations files here, in a way that can easily be confirmed during
code review to have no functional effect on parser semantics.
This will be followed by a change that introduces parser support for
patterns, but doesn't affect test expectations.
Change-Id: I830600c1ae89447c7745bfae6fd91c379b6e05d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261022
Commit-Queue: Paul Berry <paulberry@google.com >
Reviewed-by: Jens Johansen <jensj@google.com >
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
2022-09-27 12:56:54 +00:00
Jens Johansen
cec94a1446
[parser] Empty record types, record types with 1 element
...
This should bring parsing of record types up-to-date with v1.6 of
https://github.com/dart-lang/language/blob/master/working/0546-patterns/records-feature-specification.md
Also fixes https://github.com/dart-lang/sdk/issues/49826
Change-Id: I3737a72ddee49a957bd55f86cc200fb77f23e2a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256660
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Jens Johansen <jensj@google.com >
2022-08-30 11:04:10 +00:00
Jens Johansen
a4352d09e1
[parser] Record literals can be const and one-element only
...
This should bring parsing of record literals up-to-date with v1.6 of
https://github.com/dart-lang/language/blob/master/working/0546-patterns/records-feature-specification.md
Change-Id: If39bb1834137da55ef8bd1923106bbc614ea319b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256461
Commit-Queue: Jens Johansen <jensj@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
2022-08-30 10:54:08 +00:00
Jens Johansen
7aeea765d8
[parser] Parse record type return types for functions taking type parameters
...
Fixes https://github.com/dart-lang/sdk/issues/49794
Change-Id: Ie80497bcfcda42cfb082240346ed547586742598
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256203
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Commit-Queue: Jens Johansen <jensj@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2022-08-25 06:10:03 +00:00
Jens Johansen
bba453b798
[parser] Record type type arguments
...
Fixes https://github.com/dart-lang/sdk/issues/49769
Change-Id: Icffa2dcfae95d950c00e72aa01121b6d6ebd147d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256065
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Jens Johansen <jensj@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
2022-08-24 08:25:38 +00:00
Jens Johansen
cf8f47df4f
[parser] Support RecordType for setter/getters and static methods
...
Fixes https://github.com/dart-lang/sdk/issues/49709
Change-Id: I710e687ce7e1066eef8439f541f2e5fe2771db36
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255988
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Jens Johansen <jensj@google.com >
2022-08-24 07:42:51 +00:00
Johnni Winther
6751831ac6
[parser] Add hasNamedFields parameter to endRecordType
...
This makes it possible to handle named record fields without peeking
at the last record field (list) on the stack.
Change-Id: I96e2009cf5933ef505459ac8722d5bcbeb67db83
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255983
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Jens Johansen <jensj@google.com >
2022-08-23 15:43:10 +00:00
Jens Johansen
38e5b8f9e0
[parser] Parse Record Types
...
This is the first stab at implementing the record types from
https://github.com/dart-lang/language/blob/master/working/0546-patterns/records-feature-specification.md
Change-Id: I15c07e05c32a95206d177521c5f2b7fed69b4fbc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255244
Commit-Queue: Jens Johansen <jensj@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2022-08-19 07:04:44 +00:00
Jens Johansen
8a1dbb160f
[parser] Parse record literals
...
This is the first stab at implementing the record expressions from
https://github.com/dart-lang/language/blob/master/working/0546-patterns/records-feature-specification.md
Change-Id: I2adb6cb3cd50d4ee45e144e86ec7011d046f6170
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253783
Commit-Queue: Jens Johansen <jensj@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Michael Thomsen <mit@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2022-08-16 06:36:36 +00:00