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

preload() has different parsing rules from other function calls #52499

Closed
Razoric480 opened this issue Sep 8, 2021 · 6 comments
Closed

preload() has different parsing rules from other function calls #52499

Razoric480 opened this issue Sep 8, 2021 · 6 comments

Comments

@Razoric480
Copy link
Contributor

Razoric480 commented Sep 8, 2021

Godot version

3.3.stable

System information

Windows 10

Issue description

preload() in GDScript runs on a different ruleset than the usual parser and does not support newlines. When formatting a call to preload like:

const MinimapTileset := preload("res://addons/godot-metroidvania-kit/Minimap/Tileset/minimap_tileset.tres")

into:

const MinimapTileset := preload(
	"res://addons/godot-metroidvania-kit/Minimap/Tileset/minimap_tileset.tres"
)

it will report a parsing error about a misplaced \n, whereas any other function call support it just fine.

onready var has_foyer := _has(
	"foyer"
)

Steps to reproduce

  1. New project
  2. Add Node
  3. Add script to Node
  4. Paste:
extends Node

const default_env_bad := preload(
	"res://default_env.tres"
)

onready var default_env_okay := load(
	"res://default_env.tres"
)

Minimal reproduction project

No response

@Razoric480
Copy link
Contributor Author

Razoric480 commented Sep 8, 2021

This seems to be already fixed in 4.0,

extends Node

const default_env_okay := preload(
	"res://default_env.tres"
)

@onready
var default_env_also_okay := load(
	"res://default_env.tres"
)

so it's quite possible that fixing this for 3.x will not be worth the time.

@Calinou Calinou added this to the 3.4 milestone Sep 8, 2021
@kdiduk
Copy link
Contributor

kdiduk commented Sep 9, 2021

I can take care of this issue. I've investigated it a little bit.
You can assign this ticket to me.

@Calinou
Copy link
Member

Calinou commented Sep 9, 2021

I can take care of this issue. I've investigated it a little bit.
You can assign this ticket to me.

Feel free to work on this 🙂

Note that we don't assign issues to people who aren't core contributors. This is because we'd prefer not to block other contributors if the assignee becomes inactive.

@kdiduk
Copy link
Contributor

kdiduk commented Sep 9, 2021

I've made a Pull-Request #52521 with a fix of this issue. Please, review (there's only 1 commit with few lines 😊 )

kdiduk added a commit to kdiduk/godot that referenced this issue Oct 6, 2021
@kdiduk
Copy link
Contributor

kdiduk commented Oct 19, 2021

I believe this ticket can be already closed. This was even mentioned in the changes of 3.4 beta 6 (https://godotengine.org/article/dev-snapshot-godot-3-4-beta-6)

@akien-mga
Copy link
Member

Fixed by #52521.

sairam4123 pushed a commit to sairam4123/godot that referenced this issue Nov 10, 2021
lekoder pushed a commit to KoderaSoftwareUnlimited/godot that referenced this issue Dec 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants