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

GDScript.reload() for GDScript which only sets the [source code that contains inner classes] no longer works after 4.0.Beta9 #70518

Closed
Xwdit opened this issue Dec 24, 2022 · 4 comments · Fixed by #71197

Comments

@Xwdit
Copy link
Contributor

Xwdit commented Dec 24, 2022

Godot version

4.0.beta10

System information

Windows 11

Issue description

UPDATE: This problem only occurs when the source code contains inner classes

Before 4.0.Beta9, I could get a GDScript instance by GDScript.new() and then set the source_code property and then reload(), but now it throws an error

USER SCRIPT ERROR: Parse Error: Could not find script "".
   at: GDScript::reload (built-in:1644)

In my software, I use the above method when the user modifies the code text, and then read the godot log to implement real-time error checking of the custom user script editor. But now this functionality is completely broken

Steps to reproduce

  1. Create a GDScript instance by GDScript.new()
  2. set the source_code property and then reload()

Minimal reproduction project

N/A

@akien-mga
Copy link
Member

CC @adamscott @rune-scape

@adamscott
Copy link
Member

Could not reproduce on master (f382a2b)

@Xwdit Please add a minimal reproduction project to the issue.

@Xwdit Xwdit changed the title GDScript.reload() which only sets the source code no longer works after 4.0.Beta9 GDScript.reload() which only sets the source code contains inner classes no longer works after 4.0.Beta9 Jan 10, 2023
@Xwdit Xwdit changed the title GDScript.reload() which only sets the source code contains inner classes no longer works after 4.0.Beta9 GDScript.reload() for GDScript only sets the source code which contains inner classes no longer works after 4.0.Beta9 Jan 10, 2023
@Xwdit Xwdit changed the title GDScript.reload() for GDScript only sets the source code which contains inner classes no longer works after 4.0.Beta9 GDScript.reload() for GDScript only sets the [source code which contains inner classes] no longer works after 4.0.Beta9 Jan 10, 2023
@Xwdit Xwdit changed the title GDScript.reload() for GDScript only sets the [source code which contains inner classes] no longer works after 4.0.Beta9 GDScript.reload() for GDScript which only sets the [source code that contains inner classes] no longer works after 4.0.Beta9 Jan 10, 2023
@Xwdit
Copy link
Contributor Author

Xwdit commented Jan 10, 2023

UPDATE: This problem only occurs when the source code contains inner classes

@adamscott
Copy link
Member

adamscott commented Jan 10, 2023

This is a regression coming from #69471. The analyzer tries to resolve the script using it's path, but as it's a runtime script, it has no script path.

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

Successfully merging a pull request may close this issue.

3 participants