Remove tree-shaker as we're not using it, and it creates problems
when the SDK changes.
Remove scopes from AstBuilder as we will be phasing out AstBuilder
in favor of using BodyBuilder and the Forest API.
Change-Id: I51950c5d8bfb0493587336325f9da8f5bf8ecea6
Reviewed-on: https://dart-review.googlesource.com/57261
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
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>
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>
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>
In addition, this CL
* Inlines parseVariablesDeclarationOrExpressionOpt
* Adds for statement missing parenthesis recovery
* Removes TypeContinuation.VariablesDeclarationOrExpression
and inline the functionality
Change-Id: Ied57eb35848026ab856f21c66283bc8883a9d5e1
Reviewed-on: https://dart-review.googlesource.com/44360
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
This updates the AstBuilder and OutlineBuilder
to generate the following errors:
* ConstConstructorWithBody
* ConstMethod
* ConstructorWithReturnType
* FieldInitializerOutsideConstructor
In order to get the necessary state in OutlineBuilder so that I could
report these errors, I extracted SourceLibraryBuilder.addConstructor
from addProcedure.
In addition, I updated AstBuilder to use handleRecoverableError
rather than parser.reportRecoverableError.
Change-Id: I8b5517ec2ab44ff13a65628c594f803138cad6f5
Reviewed-on: https://dart-review.googlesource.com/43800
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
This CL updates the fasta parser to report more errors
and have improved recovery. The new errors reported include:
* IllegalAssignmentToNonAssignable
* MissingAssignableSelector
* StaticConstructor
In addition, a number of test expectations were updated
to match the errors already produced by the fasta parser.
Change-Id: I99889e8e64663ca5b81a5d5d8f5e5241d049a0a2
Reviewed-on: https://dart-review.googlesource.com/41100
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This CL finishes the process of removing findMemberName from parsing
class members and sets the stage for improved recovery.
In addition, this CL:
* Revises the `endMethod` event to include a beforeParam token
so that the parser can revise the token stream before the parameters
during recovery.
* Reworks insertSyntheticIdentifer for use in more places
Change-Id: If5bcd6f554053f72429e938b5cd5e7021e03d5b3
Reviewed-on: https://dart-review.googlesource.com/39320
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
In addition to updating the fasta parser error messages, this CL
updates the recovery tests to automatically allow break/continue errors
in the valid and recovery code if those errors appear in the
base code being tested. For example, if the base code is
main() { break; }
the invalid code is
main() { var a break; }
and the expected recovery code is
main() { var a; break; }
then because the base code has a break-error, then that error
is allowed/expected in both the invalid and recovery code
without being explicitly listed in the test.
Change-Id: Ic7c188d6e6fb506ee83b8c99175caab3a82444f2
Reviewed-on: https://dart-review.googlesource.com/38500
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
* Update expectations for 40+ recovery tests based upon the current
fasta parser code recovery and error messages so that those
recovery tests now pass
* Improve test failure message when comparing NodeLists
* Validate expected recovery code as the first step when running
the test and print an error message when the expected code is invalid.
* Compare the expected and actual AST structures before asserting
expected errors
Change-Id: I824d72939fb665c3e2f83cfbbdf9c313c8ca508a
Reviewed-on: https://dart-review.googlesource.com/38460
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
This CL refactors parseTopLevelMember so that it does not scan ahead
using findMemberName. This is the next step in removing findMemberName
to improve top level declaration recovery.
Change-Id: I4d949f72cba5618541448c08e1756bf45a4d1762
Reviewed-on: https://dart-review.googlesource.com/37680
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
In addition to adding missing errors, this CL inlines modifier parsing
as part of a multi step effort to parse modifiers once and provide
better error recovery for class member and top level declarations.
Change-Id: Ibea91a4a3e2073ed6079f0f44ff4bbbb4a98a614
Reviewed-on: https://dart-review.googlesource.com/35300
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>