Fix #4774: export default
followed by an object should always work
#4783
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #4774:
export default
followed by an object should always work, even if the object contains braces (or put another way, even if one of the object’s values is an explicit object, defined with braces).Fixes a bug introduced in #4532, where
export default
was given the ability to export an implicit object. In that PR, this was implemented in an incorrect way:default
followed by a newline caused a suppression of that newline. For objects that contain explicit objects (i.e. braces), this breaks, as the suppressed newline screws up the tracking of indents, which matters when we encounter}
tokens. Instead we should handle it in the grammar the same way returning an implicit object is handled.@connec you had some comments on the earlier PR. @helixbass you did some work related to this in #4605.