Commit Graph

95 Commits

Author SHA1 Message Date
Vijay Menon 3b5a187726 [dartdevc] move ddc internal libraries under sdk
Note, this has the effect of including all DDC Dart sources with the
shipped SDK: we ship everything under sdk/lib.

This should enable https://github.com/dart-lang/build/issues/2262

Change-Id: If66bc7c620034e7f2acf7d2c3e9524a408417681
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104383
Commit-Queue: Vijay Menon <vsm@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-06-04 13:47:29 +00:00
danrubel c33f1a079e revise scanner api so that error tokens are always prepended
This CL revises the scanner API so that tokens are always prepended
to the beginning of the token stream. This allows the parser handling
of error tokens to be simplified. Any clients using the scanner directly
rather than through the scanner API should call scannerRecovery
if the scanner has detected errors in the content.

Change-Id: I32510da10205bd964f80898a238489d1508733e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102680
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-05-17 20:59:51 +00:00
danrubel 7ec4621108 cleanup scanner configuration flags
* rename enableGtGtGt to enableTripleShift
* remove unused enableGtGtGtEq field

Change-Id: I0fa881c45619067ec3a292acbff984db555aa43e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101362
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-05-04 17:14:46 +00:00
Dan Rubel 4d7217016e encapsulate scanner configuration in ScannerConfiguration
... and update TypeInfoTest to use ScannerConfiguration

Change-Id: I637d6fbeecd0b6d16c37e57cfd8ba9fc1fba494a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100791
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-04-30 14:00:28 +00:00
Dan Rubel 08832508ec Forward "late" modifier to parser listeners
... and update parser tests to use preNonNullable feature set
to address comments in https://dart-review.googlesource.com/c/sdk/+/99963

Change-Id: I3a3293d65805807b7b95e887f829f3f0080ae3b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99964
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-04-22 17:20:10 +00:00
Dan Rubel ca28e2c8ce forward "required" modifier to parser listeners
... and have each report an error by default

Change-Id: If818a7bb207becbed95a97890632a1803917d285
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99720
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-04-17 21:19:51 +00:00
Dmitry Stefantsov 4a1b153fe1 [cfe] Enable type promotion in if-elements of literal collections
Closes #36396.

Bug: http://dartbug.com/36396
Change-Id: I223267cdee1aca38d69354e4f97df7dcc76e9553
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98461
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-04-02 13:33:19 +00:00
danrubel 466b6884dc add scanner/parser support for >>>=
Change-Id: I8bbf19e70f35aba600cb768fc3c7537f2aa604e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97602
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-03-22 23:38:51 +00:00
danrubel 266d823f5c remove unused scanner error list
Change-Id: I3dd5d66dcf05ae2bf9f2087724801cae4f3b6036
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97542
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-03-21 22:33:02 +00:00
danrubel b2cb604b9d improve literal list/map/set control flow recovery
* new ExpectedElseOrComma parser error code
* update recovery tests to enable control flow recovery
* rework test to call parser.parseLiteralListSuffix rather than parser.parseLiteralListSuffix

Fix https://github.com/dart-lang/sdk/issues/36141

Change-Id: I5bdee19eb3828de8fbdc514a3820afaa1309df99
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95980
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-03-08 17:31:33 +00:00
Dan Rubel 272f58e543 Revise parser to generate handleLiteralSetOrMap
... and no longer generate handleLiteralSet or handleLiteralMap.
In addition, a new hasSetEntry parameter has been added to the
handleLiteralSetOrMap event generated by the parser to support
existing behavior. Once all listeners have implemented
unified collections and that feature is enabled by default,
the hasSetEntry parameter can be removed.

This is the third of several CLs updating the parser and its listeners
to conform to the unified collection spec:
https://github.com/dart-lang/language/pull/200

Change-Id: Ia305eab1f720658f357ac4102b0b0c8128d16997
Reviewed-on: https://dart-review.googlesource.com/c/93963
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-02-22 19:58:38 +00:00
Dan Rubel 09e6a689c2 parse nested control flow collection entries
Change-Id: Id50c0a53a51f076dd75dd5bc13a694663449bc83
Reviewed-on: https://dart-review.googlesource.com/c/91400
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-01-29 17:53:58 +00:00
Dan Rubel 213cfdc85e Update AstBuilder to generate new for statement structure
... if control flow or spread collection entries are enabled.

Change-Id: I8718c1f7a649b7a2a7c9e376a6bf67c1df0542cf
Reviewed-on: https://dart-review.googlesource.com/c/91320
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-01-29 17:53:58 +00:00
Dan Rubel 93a56336a3 Parse simple for control flow collection entires
... and address comments in:
https://dart-review.googlesource.com/c/sdk/+/91144
https://dart-review.googlesource.com/c/sdk/+/90901

Change-Id: I7a9288bf28e069832193bd8a196a11f9a407b20d
Reviewed-on: https://dart-review.googlesource.com/c/91300
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-01-29 17:53:58 +00:00
danrubel 56123f08b0 Update parser to support simple if/else control flow in literal lists, sets, and maps
Change-Id: I740beea833ed1ad76582ad5232549bd204981808
Reviewed-on: https://dart-review.googlesource.com/c/90901
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-01-24 22:22:50 +00:00
danrubel 5543fce9a3 add limited support for parsing if control flow entries in lists, sets, and maps
This updates the parser to handle two if control flow entries
* `if` condition entry
* `if` condition spread-collection

... and also addresses comments in
https://dart-review.googlesource.com/c/sdk/+/90500

Change-Id: Ibabec8f0f4da918ef4cfe429405dae82ba74c129
Reviewed-on: https://dart-review.googlesource.com/c/90620
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-01-23 17:57:05 +00:00
Sam Rawlins 3154bb0d37 Stop using external deprecated members in front_end
Change-Id: I3fa03de568f72bfc3adb46efcfa2b61b781c706b
Reviewed-on: https://dart-review.googlesource.com/c/89020
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2019-01-15 18:55:10 +00:00
danrubel 2cb346bd0c Add support for parsing complex nullable types
Change-Id: I38a59f96e299387b7266e46082d876105eb60f1e
Reviewed-on: https://dart-review.googlesource.com/c/88640
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-01-08 15:52:54 +00:00
danrubel 26d5345fb1 Fix TypeInfo.couldBeExpression in recovery situations
Change-Id: Ia9f1735b8ad28dbfcde1f54ac70628e85b65c1d3
Reviewed-on: https://dart-review.googlesource.com/c/88480
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-01-04 21:08:35 +00:00
danrubel f0377b2f92 Add support for parsing simple nullable types
... as part of adding NNBD as outlined in
https://github.com/dart-lang/language/issues/110

This only supports parsing simple nullable types
such as int? and List<int>? while subsequent CLs
will add support for parsing more complex types.

Due to current parser limitations, it also only supports
nullable types in a limited number of statements such as

T? t;
if (x is String?) {}

In addition, address comments in
* https://dart-review.googlesource.com/c/sdk/+/87880
* https://dart-review.googlesource.com/c/sdk/+/87881

Change-Id: Ife4afadc0b72906fc0c4e9b1977ad838041c2a84
Reviewed-on: https://dart-review.googlesource.com/c/87920
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-12-21 12:36:07 +00:00
danrubel c52ff42c55 Add TokenStreamGhostWriter for parser lookahead
This adds a new TokenStreamRewriter which does not modify the
existing token stream but instead sequences tokens such that the
new tokens lead into the existing token stream.
This is useful when using the parseExpression method
to lookahead and find the next token after the expression.

Change-Id: Id51e015f4381af65220530d07042e306b939baa3
Reviewed-on: https://dart-review.googlesource.com/c/87622
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-12-18 22:01:48 +00:00
Dan Rubel 48093f5f9d Revert "Add support for parsing simple nullable types"
This reverts commit c5fd11b5d6.

Reason for revert: Conditional expression lookahead may modify the token stream

Original change's description:
> Add support for parsing simple nullable types
> 
> ... as part of adding NNBD as outlined in
> https://github.com/dart-lang/language/issues/110
> 
> This only supports parsing simple nullable types
> such as int? and List<int>? while subsequent CLs
> will add support for parsing more complex types.
> 
> Change-Id: I144858946cb115755af437299899c2631105bf8c
> Reviewed-on: https://dart-review.googlesource.com/c/87501
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Commit-Queue: Dan Rubel <danrubel@google.com>

TBR=brianwilkerson@google.com,danrubel@google.com

Change-Id: Ie1f47e7384ff51159aa2ebeb21561455b8e6287f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/87620
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-12-18 14:32:33 +00:00
danrubel c5fd11b5d6 Add support for parsing simple nullable types
... as part of adding NNBD as outlined in
https://github.com/dart-lang/language/issues/110

This only supports parsing simple nullable types
such as int? and List<int>? while subsequent CLs
will add support for parsing more complex types.

Change-Id: I144858946cb115755af437299899c2631105bf8c
Reviewed-on: https://dart-review.googlesource.com/c/87501
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-12-18 11:29:33 +00:00
danrubel 9de66d87b8 Revert support for parsing simple nullable types
This reverts commit bc8c7cf782

Reason for revert: Breaks parsing less common conditionals (e.g. b ? c = true : g();)

Original change's description:
> Add support for parsing simple nullable types
>
> ... as part of adding NNBD as outlined in
> https://github.com/dart-lang/language/issues/110
>
> This only supports parsing simple nullable types
> such as int? and List<int>? while subsequent CLs
> will add support for parsing more complex types.

Change-Id: I49a21a85dca19241e3b23ed5c9fb6084e70f2000
Reviewed-on: https://dart-review.googlesource.com/c/87284
Reviewed-by: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-12-14 18:47:42 +00:00
danrubel e2007126eb Revert support for simple nullable type return value in generalized function type
This reverts commit 11d081d115

Reason for revert: Breaks parsing less common conditionals (e.g. b ? c = true : g();)

Original change's description:
> Add support for simple nullable type return value in generalized function type
>
> This only supports nullable return values of the form
>
> <identifier> '?' 'Function' '(' ...
>
> This is an increment CL in the ongoing effort to add nullable type support
> as outlined in https://github.com/dart-lang/language/issues/110

Change-Id: I99bce29619d4e448193e3c81fa86a982791b1f77
Reviewed-on: https://dart-review.googlesource.com/c/87283
Reviewed-by: Dan Rubel <danrubel@google.com>
2018-12-14 16:48:18 +00:00
Dan Rubel 6376482e20 Revert "Add support for prefixed nullable type"
This reverts commit 7720689931.

Reason for revert: Breaks parsing less common conditionals (e.g. b ? c = true : g();)

Original change's description:
> Add support for prefixed nullable type
> 
> This adds support for nullable types of the form
> 
> <identifier> '.' <identifier> '?'
> 
> and
> 
> <identifier> '.' <identifier> '?' 'Function' '(' ...
> 
> This is an increment CL in the ongoing effort to add nullable type support
> as outlined in https://github.com/dart-lang/language/issues/110
> 
> Change-Id: I526aecbe64bacbd442cea0b4c52d36ff23b0443b
> Reviewed-on: https://dart-review.googlesource.com/c/87083
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Commit-Queue: Dan Rubel <danrubel@google.com>

TBR=brianwilkerson@google.com,danrubel@google.com

Change-Id: Ib5e74b4aad239f561a33eae9d95dffa2693037f7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/87282
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-12-14 15:12:51 +00:00
danrubel 7720689931 Add support for prefixed nullable type
This adds support for nullable types of the form

<identifier> '.' <identifier> '?'

and

<identifier> '.' <identifier> '?' 'Function' '(' ...

This is an increment CL in the ongoing effort to add nullable type support
as outlined in https://github.com/dart-lang/language/issues/110

Change-Id: I526aecbe64bacbd442cea0b4c52d36ff23b0443b
Reviewed-on: https://dart-review.googlesource.com/c/87083
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-12-13 23:24:04 +00:00
Dan Rubel 11d081d115 Add support for simple nullable type return value in generalized function type
This only supports nullable return values of the form

<identifier> '?' 'Function' '(' ...

This is an increment CL in the ongoing effort to add nullable type support
as outlined in https://github.com/dart-lang/language/issues/110

Change-Id: I42febae9f88f7e4d8b05907988deab97c7a7425c
Reviewed-on: https://dart-review.googlesource.com/c/87081
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-12-12 19:13:24 +00:00
Dan Rubel 1ff82c5081 Update endFunctionType event to take questionMark token
... which in this CL will always null.
This is another step when adding NNDB support as outlined in
https://github.com/dart-lang/language/issues/110

Change-Id: I3974fcb885c63be4af9d1007258383f3f8191ae0
Reviewed-on: https://dart-review.googlesource.com/c/87080
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-12-12 16:10:23 +00:00
Dan Rubel bc8c7cf782 Add support for parsing simple nullable types
... as part of adding NNBD as outlined in
https://github.com/dart-lang/language/issues/110

This only supports parsing simple nullable types
such as int? and List<int>? while subsequent CLs
will add support for parsing more complex types.

Change-Id: I3cc5c65d20bf3732a39cab0e823b2f7332342866
Reviewed-on: https://dart-review.googlesource.com/c/86961
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-12-11 23:48:04 +00:00
danrubel 2a85a3433e Update handleType event to take questionMark token
... which in this CL will always null.
This is the first step when adding NNDB support as outlined in
https://github.com/dart-lang/language/issues/110

Change-Id: If3810bcaf1b73e70924f09d619e2a84e7d5ba8d6
Reviewed-on: https://dart-review.googlesource.com/c/86860
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-12-11 16:21:05 +00:00
danrubel 52892f7c47 Add scanner and parser support for new >>> operator
This adds support for the new >>> operator as detailed in
https://github.com/dart-lang/language/blob/master/accepted/future-releases/constant-update-2018/feature-specification.md#new-operators

Tracking issue: https://github.com/dart-lang/language/issues/60

Enable support by setting AbstractScanner.enableGtGtGt = true

Change-Id: I8e7d2fb341971452d8e05d734a1de612880fef5e
Reviewed-on: https://dart-review.googlesource.com/c/85421
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-11-26 22:12:25 +00:00
Dan Rubel 737f44a8dd Add type argument count to type info in fasta parser
This adds a new accessor in the fasta parser support classes
for determining the number of type arguments. This will be used
when adding support for set literals to disambiguate a set literal
from a map literal.

Change-Id: If32c12d198f6d88fb06527817cec038c22428d53
Reviewed-on: https://dart-review.googlesource.com/c/84461
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-11-14 22:36:43 +00:00
Peter von der Ahé f882af1c33 Include file name in scanner test chain
Change-Id: Ifca81ba39d14895cbe025f349d97a02e6b07856f
Reviewed-on: https://dart-review.googlesource.com/c/82994
Commit-Queue: Peter von der Ahé <ahe@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Auto-Submit: Peter von der Ahé <ahe@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2018-11-06 13:18:40 +00:00
danrubel 9f7ad8d082 Fix recovery when parsing complex type variables
This fixes parser recovery when the user has inserted a word before
a method declaration with a complex type arguments, such as

  foo Future<List<int>> bar() {}

Fix https://github.com/dart-lang/sdk/issues/34850

Change-Id: Ic6d1767668bd34d75c6ab5f9973e5762bdd8f160
Reviewed-on: https://dart-review.googlesource.com/c/80780
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-10-19 18:56:09 +00:00
Dan Rubel 05ba85399f Cleanup fasta parser rewriter insert token methods
Change-Id: Ic776cae52cbfae4c1892884a6d9e179147c5396e
Reviewed-on: https://dart-review.googlesource.com/75760
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-09-20 17:00:41 +00:00
Dan Rubel 49da026e3e Report error for extends void type parameters
Change-Id: I634b836ea40199a1e7962b7d07ca9f5d1ef3f16a
Reviewed-on: https://dart-review.googlesource.com/74680
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-09-13 20:27:56 +00:00
danrubel d35c18999f Disallow type parameters of the form <X super Y>
Fix https://github.com/dart-lang/sdk/issues/28848

Change-Id: I1b8cd943b5af448fb6f5826d002d0b5a403e6bba
Reviewed-on: https://dart-review.googlesource.com/74241
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-09-11 15:30:03 +00:00
Peter von der Ahé f5f33776a4 Revert "Store code ranges for formal parameters."
This reverts commit 5b9a42de29.

Change-Id: If6b3edc7194fda050de3b6ffbb0c8124a75509a6
Reviewed-on: https://dart-review.googlesource.com/72100
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2018-08-30 10:20:18 +00:00
Konstantin Shcheglov 5b9a42de29 Store code ranges for formal parameters.
Change-Id: I022e5140869c7007c28109a4dfda3914b34c4725
Reviewed-on: https://dart-review.googlesource.com/71184
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-08-22 17:40:58 +00:00
Dan Rubel ad6029c608 Update fasta parser to split ">>=" when parsing type var
Change-Id: Id60da00165ef1c7d9128985ccadef06f62637a24
Reviewed-on: https://dart-review.googlesource.com/70181
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-08-16 01:04:46 +00:00
Dan Rubel 4eb4d75270 Remove unused event parameter
Change-Id: I097886cae93204d671a3aca4caaafea8d117989d
Reviewed-on: https://dart-review.googlesource.com/70180
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-08-16 01:04:46 +00:00
Dan Rubel 825df975a0 Revise fasta type arg/param parsing to ignore "<".endGroup
The scanner associates '<' with '>' and '>>',
but the parser cannot use '<'.endToken/endGroup reliably
and wastes time updating that token's endToken/endGroup field.

This CL updates type info parsing to ignore '<'.endGroup
and step through the token stream (which it has to do anyway),
for improved parsing.

This CL causes a handful of existing tests to fail (marked as @failingTest)
and test failures will be addressed in a subsequent CL.

Change-Id: I788e9a74cd2891f98f44bba15d5669febfec6c64
Reviewed-on: https://dart-review.googlesource.com/70001
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-08-15 22:16:40 +00:00
Dan Rubel 9619e2cd77 Remove unused fasta parser methods and event parameter
Change-Id: I0bf050a475ad3548342307027d14aba4badf468e
Reviewed-on: https://dart-review.googlesource.com/69620
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-08-13 16:42:12 +00:00
danrubel c3f5c07a47 Simple type argument parsing fixes and more tests
This fixes some of the event tokens when parsing simple type arguments
with '>>' or '>=', and organizes and adds more tests.
In addition, this addresses a comment in
https://dart-review.googlesource.com/c/sdk/+/69261

Change-Id: I16e3a5360ac2e62dd1853df946b88611ff099d94
Reviewed-on: https://dart-review.googlesource.com/69360
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-08-10 18:58:32 +00:00
danrubel 8e2141f1cf Fix parsing typedefs with <T>=
This is the first CL of several needed to fix typedef parsing
when there is no space between the type parameters and the `=`.

  typedef F<T>= T Function(T);

* Fix some typedef parsing failures
* Add new consts for simple type var ending with ">>" and ">="
* Update computeType and computeTypeParamOrArg to return new consts
* Extract splitGtEq/GtGt/GtGtEq from splitEndGroup
* Hide internal TypeInfo and TypeParamOrArgInfo consts

Change-Id: Ice550f5b15df1f3cad616a2a342644974f14d8ee
Reviewed-on: https://dart-review.googlesource.com/69261
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-08-10 15:09:21 +00:00
danrubel fea8cb1473 Revise order of type variable declaration events
As of this CL, events for type variable declarations occur
in the following order:

* beginTypeVariables
* beginTypeVariable for each type variable in the declaration
* handleTypeVariablesDefined
* endTypeVariable for eah type variable in the declaration
* endTypeVariables

Revising the order of events facilitate removing the hack
in BodyBuilder.beginTypeVariables in a future CL.

This is another slice of https://dart-review.googlesource.com/c/sdk/+/57661
so that it can be landed in a more incremental fashion.

Change-Id: Ief0ad766c12f1ca9d53a8ec8d3c08b41166b2897
Reviewed-on: https://dart-review.googlesource.com/61940
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-06-22 19:47:46 +00:00
danrubel e9bc3352e0 Replace and remove parseType
Change-Id: Id276165dbe6c7168d4156fd755f3f32c835d93af
Reviewed-on: https://dart-review.googlesource.com/61321
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-06-21 22:01:05 +00:00
danrubel 8419090c8c Cleanup type variable event sequence
This is another step towards cleanup and improved recovery when parsing
type variables in fasta.

* call listener.handleIdentifier before beginTypeVariable

This is a slice of https://dart-review.googlesource.com/c/sdk/+/57661
so that it can be landed in a more incremental fashion.

Change-Id: I9cc483636f0b0f3168b92981695334c18bdfedfb
Reviewed-on: https://dart-review.googlesource.com/61320
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-06-20 20:50:34 +00:00
Dan Rubel daee781179 Revise beginTypeVariable event in event sequence
This is the first CL in a series aimed at removing the need to reparse type variables in
https://github.com/dart-lang/sdk/blob/master/pkg/front_end/lib/src/fasta/kernel/body_builder.dart#L3669
and ultimately improving recovery by removing parseType.

* Move calls to listener.beginTypeVariable after parsing metadata and identifier
* Pass variable name via beginTypeVariable rather than via handleIdentifier
* Add additional check in test for issue 31846

Change-Id: I983b9d17675fc899c83df69fa1777059903e3f52
Reviewed-on: https://dart-review.googlesource.com/58300
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-06-05 15:11:00 +00:00