Commit Graph

440 Commits

Author SHA1 Message Date
Konstantin Shcheglov 0aad13db00 Revert 'Copy @failingTest annotations to mixin applications.'
This reverts commit 242bc3413c.

R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/33099
Change-Id: I8a1b24926072fe64e3ab73d38a1fa73695237fc4
Reviewed-on: https://dart-review.googlesource.com/57701
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-05-31 18:40:27 +00:00
danrubel d116e62d76 Improve catch parameter recovery
Change-Id: Ib4479eb7682c7093e9076f12a85d5a2f911a3f1d
Reviewed-on: https://dart-review.googlesource.com/57022
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-05-30 01:31:49 +00:00
danrubel 96dd9d49db Update Analyzer tests to pass NonExistingSource rather than null
Change-Id: I770d50a31230e7e3fdabecf4cbffc6fee76e1fb5
Reviewed-on: https://dart-review.googlesource.com/57020
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-05-29 17:12:26 +00:00
danrubel b4699ae795 Improve type parameter and type argument recovery
This improves recovery when parsing type arguments in
* top level fields and functions
* class members

and when parsing type parameters in
* top level functions
* class declaration
* class methods

Change-Id: I7dbb520d6bb39c0d13b27698658dafe580f2b16c
Reviewed-on: https://dart-review.googlesource.com/56681
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-05-26 02:25:53 +00:00
Dan Rubel d3da30c152 Report errors on non-synthetic tokens
This updates fasta parser error reporting to find a non-synthetic token
on which to report an error. In addition, this addresses a comment in
https://dart-review.googlesource.com/c/sdk/+/56041

Change-Id: Id3415529a7b8635273221c7c2f3d36e1695a9ece
Reviewed-on: https://dart-review.googlesource.com/56540
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-05-24 15:54:32 +00:00
Dan Rubel a00dae2260 Update test_parseAwaitExpression_inSync
Change-Id: I62796cc9c76bdfa0cfb5afacdaa8a785a3db28e8
Reviewed-on: https://dart-review.googlesource.com/56440
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-05-23 22:47:19 +00:00
Dan Rubel cc4fe66de8 Replace parseTypeVariables with computeTypeParam
Change-Id: I6835db80220e09b59a0242140539761f93da3a7e
Reviewed-on: https://dart-review.googlesource.com/56400
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-05-23 21:17:05 +00:00
Dan Rubel b8cb785aed Improve formal parameter identifier recovery
Change-Id: I7bc6012295836a4455388c287da3cf15eed9ee5f
Reviewed-on: https://dart-review.googlesource.com/56300
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-05-23 13:34:26 +00:00
danrubel 1cf871a4d2 Improve import/export combinator identifier recovery
Change-Id: I9f0a418d3b1fae001199c27850b1a85daf2d07a6
Reviewed-on: https://dart-review.googlesource.com/56040
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-05-21 21:12:19 +00:00
Brian Wilkerson 99eb2195c8 Add Forest support for break and continue statements
Change-Id: Id7b109ca9acaa6d68cdc0682109bb65bd7cda62f
Reviewed-on: https://dart-review.googlesource.com/55991
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
2018-05-21 16:45:40 +00:00
Brian Wilkerson 85fbc71f22 More test framework cleanup
Change-Id: I9090c4f07154fb86621e8870158876053bad5336
Reviewed-on: https://dart-review.googlesource.com/55992
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-05-21 02:44:28 +00:00
Dan Rubel 1a2f317735 Update parse mixin to use computeType and add recovery tests
... and address comments in
https://dart-review.googlesource.com/c/sdk/+/55560

Change-Id: Ifc97b0b43d91e6c04a344a862d2de0e11ae001cf
Reviewed-on: https://dart-review.googlesource.com/55800
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-05-17 20:49:06 +00:00
Dan Rubel 7d5ebb937b A few more Analyzer/CFE type argument tests
Change-Id: I32e3dd65f470893f1ff244412eae7fccc0a6c150
Reviewed-on: https://dart-review.googlesource.com/55740
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-05-17 17:17:16 +00:00
Dan Rubel b7659e6d03 Improve typedef declaration recovery
This CL improves typedef recovery and removes another call to parseType.

Change-Id: I55aca86fe08bb06b040f5ec3c54266fcf795dbb3
Reviewed-on: https://dart-review.googlesource.com/55540
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-05-17 13:39:36 +00:00
Brian Wilkerson 874f7f6c5c Add Forest support for creating if statements
Change-Id: Ia7f1f672adee0e8da2e5c1c54f9690e7f2597263
Reviewed-on: https://dart-review.googlesource.com/55273
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-05-15 22:31:42 +00:00
Dan Rubel 4908d5720a Update generalized void and generic comment syntax tests
Change-Id: I9d4ce183c12a9f4cd33ca5630fcad732328dac2c
Reviewed-on: https://dart-review.googlesource.com/49940
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-05-14 16:28:17 +00:00
Brian Wilkerson 74db253d34 Allow metadata on enum constants
Change-Id: I2aed6df1fd5f20da865339fdc86cad3bc66f0770
Reviewed-on: https://dart-review.googlesource.com/54621
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-05-14 13:20:10 +00:00
Konstantin Shcheglov 242bc3413c Copy @failingTest annotations to mixin applications.
This works around https://github.com/dart-lang/sdk/issues/33099

R=brianwilkerson@google.com

Change-Id: Idfada538b30fe6d8cce2d23112787522e5d19521
Reviewed-on: https://dart-review.googlesource.com/54705
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-05-11 18:31:00 +00:00
Dan Rubel 04af8ace52 Improve top level const/final/var name recovery
Change-Id: Ie07ca020a5f5a6c3abbe2ee48bd83c4e3ea4075c
Reviewed-on: https://dart-review.googlesource.com/54600
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-05-10 20:07:25 +00:00
Dan Rubel 64754764b1 Update computeType to call computeTypeParamOrArg
This is another step to replacing parseType with computeType
and improving recovery when parsing types and type arguments.

This adds a new computeTypeParamOrArg utility which returns
one of a couple constants for common situations or an instance
of ComplexTypeParamOrArg. The computeType function and
some places in ComplexTypeInfo class have been updated to use
this new method, but there are additional places that will be
tackled in subsequent methods.

Change-Id: I7012b65580e9dbc74b9424456262aa3c0367f48b
Reviewed-on: https://dart-review.googlesource.com/53641
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-05-04 13:38:07 +00:00
danrubel e93b2ee250 Improve typedef identifier recovery
... and also address comment in
https://dart-review.googlesource.com/c/sdk/+/53140

Change-Id: I915fe4433102bfcbdac95bb63416587b03b98680
Reviewed-on: https://dart-review.googlesource.com/53300
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-05-03 15:14:43 +00:00
Dan Rubel 79a15f52bf Fix isValidMethodTypeArguments
Change-Id: I3c4bb8dc981c285b8ecfad7dcd7dc849ed1bda7b
Reviewed-on: https://dart-review.googlesource.com/52920
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-04-28 18:10:06 +00:00
danrubel 88a098c71c Improve fasta parser field name recovery
Change-Id: I3a27b765df7543eda56c8ef691d6a3192a2769f1
Reviewed-on: https://dart-review.googlesource.com/52621
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-04-27 11:58:30 +00:00
danrubel 8d4074175f Improve fasta parser method name recovery
Change-Id: If0911c8ee8c8d403e711229e6f5f6bd4a8768c9c
Reviewed-on: https://dart-review.googlesource.com/52620
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-04-25 15:09:59 +00:00
danrubel 34a1ba7307 Fix AstBuilder construction of if statement
... and update more analyzer tests

Change-Id: Ieed123e16e7ae451cf2046253deb0c7773091417
Reviewed-on: https://dart-review.googlesource.com/52500
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-04-24 22:00:38 +00:00
danrubel 07daecf36f Improve fasta parser skip type variables
Change-Id: Icbf546a496dd1665615e4cb70d3fa130f770413d
Reviewed-on: https://dart-review.googlesource.com/52301
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-04-23 16:45:42 +00:00
danrubel 0e46a199fc Fix type reference prefixed annotation recovery
When recovering from an invalid annotation in a type variable
(e.g. "< @Foo.bar T >"), the parser could get stuck in an
infinite loop trying to recover. This fixes that situation.

Change-Id: If01e43b9eec575824329808eeb93437432830654
Reviewed-on: https://dart-review.googlesource.com/52300
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-04-21 15:28:31 +00:00
Dan Rubel bdfcc20846 Improve fasta parser formal parameter recovery
This CL improves recovery given invalid or malformed formal parameter
types and identifiers. This accomplished by switching the
parseFormalParameter method to use computeType rather than parseType,
improving recovery when parsing field initializers, and in the process,
further reducing the size of parseType and eliminating 6 unused
TypeContinuation elements.

Change-Id: I6f05d8018bf8d9f2c256e5a64408c29db006a8e2
Reviewed-on: https://dart-review.googlesource.com/52000
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-04-19 20:25:58 +00:00
Dan Rubel 58a6bfd974 Improve identifier recovery in expressions
Change-Id: I6af7f3398953d1f98dd186564af92da14d015f2a
Reviewed-on: https://dart-review.googlesource.com/50560
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-04-12 12:57:18 +00:00
danrubel 5c508ff785 Update more IdentifierContext type reference recovery
Change-Id: I7268bce4379ac4613ecd182c9d41022f2a08e7c4
Reviewed-on: https://dart-review.googlesource.com/50521
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-04-10 19:38:41 +00:00
Dan Rubel 5e99872770 Improve missing/invalid type reference recovery
Change-Id: I52231fba7ebce51242393a0030325198bf51dfbf
Reviewed-on: https://dart-review.googlesource.com/50340
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-04-09 22:53:28 +00:00
Brian Wilkerson 00097adce0 Remove reference to deprecated setter
Change-Id: Ie775c23175363135f58ebc12d476db2640cf200b
Reviewed-on: https://dart-review.googlesource.com/50060
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-04-09 13:54:06 +00:00
Dan Rubel edb6e776f1 Update parseFields to use typeInfo
... and remove typeContinuation from top level parsing,
class member parsing, and ModifierRecoveryContext2

Change-Id: I2a9653e42c180a050316205fdf320c61c30ae47c
Reviewed-on: https://dart-review.googlesource.com/49562
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-04-05 14:49:46 +00:00
Dan Rubel d0ad78db24 Improve recovery when "set" found in function body
Change-Id: I11cab70a526fb52b61be9ff91ad94b6fd23044e2
Reviewed-on: https://dart-review.googlesource.com/49340
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-04-04 14:43:23 +00:00
Dan Rubel 701e02b2fa Update AstBuilder to handle named function declaration
Change-Id: I34e699e49b7138b6d0ecf7087afef9739888c716
Reviewed-on: https://dart-review.googlesource.com/49240
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-04-03 20:45:19 +00:00
Dan Rubel 57d6ec265d Improve AstBuilder for-in recovery
Fix AstBuilder recovery when for-in expression is not a simple identifier

Change-Id: Id32ec4f8054de7870d8424c489dc5f5819ec7632
Reviewed-on: https://dart-review.googlesource.com/49181
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-04-03 18:08:29 +00:00
Dan Rubel ca7edd065c Improve invalid function body recovery
* Improve error message for use of "return" instead of "=>"
* Improve recovery given extraneous "return" after "=>"

Change-Id: I0e421ece1128f98b883b6c9110f1a5eaaced3d78
Reviewed-on: https://dart-review.googlesource.com/49180
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-04-03 17:31:39 +00:00
Dan Rubel 1daa81339f Improve fasta parser enum declaration recovery
In addition to improving recovery when an enum declaration is missing
a body, this CL also fixes ensureBlock to report an error on the
correct token and cleans up some more analyzer tests.

Change-Id: I96e9f8380b8d92082d94fcc9fa4b8cfe113fa238
Reviewed-on: https://dart-review.googlesource.com/48980
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-04-02 17:55:14 +00:00
Dan Rubel 374058aa79 Improve fasta parser try/catch error messages and recovery
Change-Id: I6e591fa5d03c73aa6f3e8060f2ca310f68be9a78
Reviewed-on: https://dart-review.googlesource.com/48709
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-04-01 02:14:52 +00:00
Dan Rubel e260a01272 Replace skipTypeReferenceOpt with computeType part 1
This CL modifies class member parsing to replace one use of skipTypeReferenceOpt
and parseType with a more efficient call to computeType. In addition, it updates
computeType to detect when a builtIn is used as a type and improves recovery
of invalid operator declarations.

Change-Id: Idbe96584ef3c2e72faf91037668421bb0f1055d0
Reviewed-on: https://dart-review.googlesource.com/48221
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-25 20:03:34 +00:00
Dan Rubel 6180f12ccf Update parsing as/is expressions to use computeType
This introduces a new TypeInfo.ensureType method which recovers
when a type is required but there is no type.

Change-Id: Ie9080864f814329bc7a7dcdf73440fd184e9e0f8
Reviewed-on: https://dart-review.googlesource.com/47944
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-23 17:58:59 +00:00
Dan Rubel 20b9b541ae Improve recovery when parsing type arguments
Change-Id: I4eea9a7ddff809a7cf0c3ea430f408449228514f
Reviewed-on: https://dart-review.googlesource.com/48024
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-23 15:05:00 +00:00
Dan Rubel 721e29e552 Cleanup statement parsing and tests
Change-Id: I107ce5f3b6ebac123198b9a3a471f0a52cdcf1e3
Reviewed-on: https://dart-review.googlesource.com/48020
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-23 14:54:39 +00:00
Dan Rubel 7450e2ad60 Fix parsing of invalid interpolation in string literal
Change-Id: I7151cee5f97a5a43314885326e4806a0314af544
Reviewed-on: https://dart-review.googlesource.com/47582
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-22 18:50:13 +00:00
Dan Rubel 04f5d1b974 Recover from missing while in do/while statement
Change-Id: Ifa63dd07cc2468b6339b29a3afcf6b01058e1866
Reviewed-on: https://dart-review.googlesource.com/47860
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-22 15:50:57 +00:00
danrubel 8136c957a1 Improve fasta parser library declaration recovery
This CL extracts recovery for invalid library names into a new
subclass of IdentifierContext. This same approach will be used in
subsequent CLs to improve error messages and recovery when parsing
identifiers in other situations.

Change-Id: I03987f4e4bbe0f61f88adb3028a87e41d7dc7eb3
Reviewed-on: https://dart-review.googlesource.com/47541
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-21 20:39:05 +00:00
Dan Rubel d26c310a27 Rework parsing of local const declarations
Similar to earlier work that reworked parsing of variable declarations,
this CL reworks parsing of local constant declarations to use
TypeInfo rather than parseType. This simplifies and improves recovery,
and reduces the number of error messages in some recovery situations.

Change-Id: I32705bdba20a0cb7aee41c64510c4c2896a5ae68
Reviewed-on: https://dart-review.googlesource.com/47241
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-20 22:50:20 +00:00
Brian Wilkerson 0e764393f3 A few more Dart2 related fixes
Change-Id: If2503b93e11f0831787dfa21e5ae0abb74e9162f
Reviewed-on: https://dart-review.googlesource.com/47302
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-20 20:17:59 +00:00
Dan Rubel fd005e17bc Rework parsing of local function declarations
This CL reworks parsing local variable and local function
declarations to improve recovery and error messages.
In addition, the fasta parser properly parses metadata
before a local function declaration.

Change-Id: Ia43c8bab3f3ce3b824390a4aa36d50b85f1ea9af
Reviewed-on: https://dart-review.googlesource.com/46952
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-20 12:01:26 +00:00
Dan Rubel 71e16622cd Improve for statement errors and recovery
This CL updates fasta parsing of `for` statements
to detect additional errors and improve recovery.

The parser originally called parseType when parsing `for` statements
which committed the parser down a particular path
and limited the ability of the caller to gracefully recovery.
Now the parser calls computeType, which parses and caches
the type information, so that the caller has more opportunity
to recover gracefully.

Change-Id: I6296ffb1f75e77a87a7533bfca77dae18cfcf60d
Reviewed-on: https://dart-review.googlesource.com/46383
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-15 11:43:13 +00:00