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.
There are two main objectives in the PR:
Statement
orExpression
in the event the detection of the first token wasn't made, which meant that call sites needed to have anif let
block to capture and return a non-nil value. This not only improved clarity, but also improved the reusability of such helpers.parsePostfix()
had logic for handling any of three expression types, making the method harder to read and understand. Moving each bundle of logic into its own method, namelyparseCall()
,parseGet()
, andparseSubscript()
, and giving each a name makes intent much clearer.consumeToken()
to reduce boilerplate and the number of places the low-level call toadvanceCursor()
were made.guard
block to throw that error, and if control fell through, then the value would be returned at the end of the function block. This also (hopefully) improves clarity.