Descriptionimprove fasta closing brace recovery
Currently, fasta synthetically closes open braces until it finds
a match for the current closing brace. This works most of the time,
but provides less than optimal recovery in some common cases.
For example, given the following
class { foo()){print(a);} var a = 'hello'; }
the current brace recovery method fails to find any match for the
second closing parenthesis and synthetically closes the class
causing the rest of the file to be parsed as outside the class.
With this CL, fasta still synthetically closes open braces when it finds
a match for the current closing brace, but if there is no match, then
it just skips over the extra closer and continues. This approach dramatically
improves recovery in many cases where there is an extra closing parenthesis
or extra closing square bracket. In the example above, fasta parses
everything after the second closing parenthesis inside the class.
R=paulberry@google.com
Committed: https://github.com/dart-lang/sdk/commit/0b93c279e7a2d81ef9945e1d2bfb976638211a8e
Patch Set 1 #Patch Set 2 : rebase #
Total comments: 5
Patch Set 3 : fix while loop performance #Patch Set 4 : rebase #
Messages
Total messages: 7 (2 generated)
|