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
5e29849393
Parser: consolidate handleCaseMatch and endCaseExpression.
...
There was no need for both of these listener callbacks, because they
were always called together. Since `beginCaseExpression` is actually
used, it makes sense to keep `endCaseExpression` and get rid of
`handleCaseMatch`.
Change-Id: I544096b2c2b2814e8cc0c8606455855cb77c9e60
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/264102
Reviewed-by: Jens Johansen <jensj@google.com >
Commit-Queue: Paul Berry <paulberry@google.com >
2022-10-15 13:51:59 +00:00
Paul Berry
9aab3c7746
Patterns parsing: add support for guards.
...
Bug: https://github.com/dart-lang/sdk/issues/50035
Change-Id: I21db09c9d8c1d359e1b125eea2bae2749cdb72fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/264101
Reviewed-by: Jens Johansen <jensj@google.com >
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
Commit-Queue: Paul Berry <paulberry@google.com >
2022-10-14 20:14:20 +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
Paul Berry
5923b883db
Parser: add support for wildcard patterns.
...
The bare identifier `_` is treated as a variable pattern wherever it
appears, even though other bare identifiers are sometimes treated as
constant patterns.
Bug: https://github.com/dart-lang/sdk/issues/50035
Change-Id: I475ef627b6d0bf519a1972aa5ec683e2d032f02b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/263280
Reviewed-by: Jens Johansen <jensj@google.com >
Commit-Queue: Paul Berry <paulberry@google.com >
2022-10-14 14:04:59 +00:00
Johnni Winther
b7debf00f7
[cfe] Handle pattern events in BodyBuilder
...
This supports pattern listener events in the BodyBuilder without
crashing. Currently no AST is created and only dummy objects are put
on the stack.
Change-Id: I24a29073b578bb9aaa07e84d5177e51428074a94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262422
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
2022-10-04 13:31:41 +00:00
Paul Berry
118f628ecf
Patterns: add support for parsing constant patterns
...
Bug: https://github.com/dart-lang/sdk/issues/50035
Change-Id: I601248bc206d9b19521b020fadb2eccd048e0ec7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261701
Reviewed-by: Jens Johansen <jensj@google.com >
Commit-Queue: Paul Berry <paulberry@google.com >
Reviewed-by: Konstantin Shcheglov <scheglov@google.com >
2022-10-03 19:46:16 +00:00
Johnni Winther
dc7df3218e
[cfe] Add parser tests for patterns
...
These tests are copied from
pkg/analyzer/test/generated/patterns_parser_test.dart
Change-Id: Ib5fd7ca8c22dd24bf5334ac87140d961bc80838a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261660
Commit-Queue: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Jens Johansen <jensj@google.com >
2022-09-29 09:08:57 +00:00