migueldeicaza / SwiftGodot

New Godot bindings for Swift
https://migueldeicaza.github.io/SwiftGodotDocs/tutorials/swiftgodot-tutorials/
MIT License
1.07k stars 70 forks source link

Fix Variant ret #389

Closed nvanfleet closed 7 months ago

nvanfleet commented 7 months ago

I was getting this compile error

/Users/nvanfleet/src/PlantQuest/build/checkouts/SwiftGodot/Sources/SwiftGodot/Variant.swift:185:21: error: use of local variable 'ret' before its declaration
        if let rc = ret as? RefCounted {
                    ^
/Users/nvanfleet/src/PlantQuest/build/checkouts/SwiftGodot/Sources/SwiftGodot/Variant.swift:189:13: note: 'ret' declared here
        let ret: T? = lookupObject(nativeHandle: value)
            ^
error: fatalError

Looks like the ret should be declared before it is used.

cc @migueldeicaza

migueldeicaza commented 7 months ago

Thank you!