Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project upgrade tool: Better space handling in "export" #86598

Merged
merged 1 commit into from
Jan 2, 2024

Conversation

pancelor
Copy link
Contributor

The regexes to convert "export" lines from godot 3 to godot 4 had two small issues: they weren't recognizing export statements with 1. spaces after "export" or 2. no space before "var".

These are both valid syntax, but the conversion tool did not recognize them. This commit fixes both cases.

test case 1: export(int)var x = 1
old conversion: @export(int)var x = 1
new conversion: @export var x: int = 1

test case 2: export (int) var y = 2
old conversion: @export (int) var y = 2
new conversion: @export var y: int = 2

These were tested by converting projects using the Import button in the project manager.

the regex had two problems; they were not recognizing export statements
that had spaces after "export", or export statements with no space
before "var".

These are both valid syntax, but the conversion was unsuccessful.
This commit fixes both cases.

test case 1:    `export(int)var x = 1`
old conversion: `@export(int)var x = 1`
new conversion: `@export var x: int = 1`

test case 2:    `export (int) var y = 2`
old conversion: `@export (int) var y = 2`
new conversion: `@export var y: int = 2`
Copy link
Member

@AThousandShips AThousandShips left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, can't confirm at the moment that all the combinations are valid syntax, but it doesn't really matter in this case as the results are fixed properly

@akien-mga akien-mga changed the title project upgrade tool: better space handling in "export" Project upgrade tool: Better space handling in "export" Jan 2, 2024
@akien-mga akien-mga merged commit 39336e3 into godotengine:master Jan 2, 2024
15 checks passed
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants