Skip to content

Commit

Permalink
Quickfix lexer in terms of lambda header parsing, fixes #327
Browse files Browse the repository at this point in the history
  • Loading branch information
Scony committed Sep 29, 2024
1 parent 34d4ee6 commit 4b628ed
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
14 changes: 14 additions & 0 deletions gdtoolkit/parser/gdscript_indenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,18 @@ def _current_token_is_just_after_lambda_header(self):
and self.processed_tokens[-6].type == "FUNC"
)
)
) or (
len(self.processed_tokens) > 0
and self.processed_tokens[-2].type == "COLON"
and self.processed_tokens[-3].type == "TYPE_HINT"
and self.processed_tokens[-4].value == "->"
and self.processed_tokens[-5].type == "RPAR"
and self.processed_tokens[-6].type == "LPAR"
and (
self.processed_tokens[-7].type == "FUNC"
or (
self.processed_tokens[-7].type == "NAME"
and self.processed_tokens[-8].type == "FUNC"
)
)
)
6 changes: 6 additions & 0 deletions tests/valid-gd-scripts/bug_327_multiline_lambda.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
func foo(new_button, button_name, menu, _game_flow):
new_button.pressed.connect(
func() -> void:
var test := ""
_game_flow.ref.request_transition(menu[button_name].transition, menu[button_name].data)
)

0 comments on commit 4b628ed

Please sign in to comment.