Merge pull request #67714 from adamscott/fix-preload-cyclic-references-part2

Fix cyclic references in GDScript 2.0
This commit is contained in:
Rémi Verschelde 2022-11-18 23:08:01 +01:00
commit 80b3813b15
No known key found for this signature in database
GPG key ID: C3336907360768E1
20 changed files with 626 additions and 113 deletions

View file

@ -1,4 +1,4 @@
const Constants = preload("gdscript_to_preload.gd")
const Constants = preload("gdscript_to_preload.notest.gd")
func test():
var a := Constants.A

View file

@ -0,0 +1,4 @@
const A = preload("preload_cyclic_reference_a.notest.gd")
func test():
A.test_cyclic_reference()

View file

@ -0,0 +1,12 @@
const B = preload("preload_cyclic_reference_b.notest.gd")
const WAITING_FOR = "godot"
static func test_cyclic_reference():
B.test_cyclic_reference()
static func test_cyclic_reference_2():
B.test_cyclic_reference_2()
static func test_cyclic_reference_3():
B.test_cyclic_reference_3()

View file

@ -0,0 +1,10 @@
const A = preload("preload_cyclic_reference_a.notest.gd")
static func test_cyclic_reference():
A.test_cyclic_reference_2()
static func test_cyclic_reference_2():
A.test_cyclic_reference_3()
static func test_cyclic_reference_3():
print(A.WAITING_FOR)

View file

@ -1,4 +1,4 @@
const preloaded : GDScript = preload("gdscript_to_preload.gd")
const preloaded : GDScript = preload("gdscript_to_preload.notest.gd")
func test():
var preloaded_instance: preloaded = preloaded.new()