Fix cyclic references issues with global classes#65664
Fix cyclic references issues with global classes#65664adamscott wants to merge 1 commit intogodotengine:masterfrom
Conversation
43dfee5 to
3d0f36a
Compare
|
Here's a quick script to merge and test both #65664 and #65752 pr() {
: ${1?"Usage: pr 12345"}
git fetch origin "pull/$1/head:pr/$1" || return 1
git switch "pr/$1" || return 1
}
pr 65664
pr 65752
git checkout master
git merge --no-edit 'pr/65664'
git merge --no-edit 'pr/65752'Edit: Response to below: I don't plan to review the code much, I am mostly enjoying this for my "fork" for prototyping projects, so memory leaks aren't a huge deal for that. |
|
@nathanfranke I think they should be separated. #65752 has some problems related to memory leaks that I must solve. This PR does not seem to share this problem. |
@nathanfranke Don't hesitate to report bugs here or on the other PR! I would love some feedback, even if it's not related to code review purposes. 😊 |
|
#65752 is the way to go. I'm closing this PR. |
This PR works in tandem with #65752 for fixing cyclic references issues.This PR is not needed if #65752 is merged, as it deals too with global classes.
This makes possible to reference class
A(class_name A) in classB(class_name B) andBinA. This is not possible actually.In the master branch, this code fails on runtime with this error:
Parser Error: Can't load global class B, cyclic reference?The compiler, in this PR, checks if the script of the global class can be loaded. When the script exists but cannot be loaded, it means usually that the script is loaded but not compiled. So, the compiler now tags this entity as temporary to be read dynamically instead of being considered as a constant.
Minimal reproduction project:
cyclic2.zip
Fixes #21461, fixes #41027.