-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reference types are now mostly optional.
Godot sadly does not annotate their functions and properties to include information whether they are optional or not. This is an issue that has been raised a long time ago and has gained little to no traction: godotengine/godot-proposals#2241 This poses a problem, because certain Godot APIs would return nil, and I would try to create an object out of it, and crash, while a nil return is ok. It also posed a problem for APIs that could take a nil parameter, but instead, in SwiftGodot, you had to create an instance of the object, even if it is unnecesary or not the desired outcome. So I have now settled on an evolutionary plan: * For now, all reference types that could have been nil either as a parameter or a return value, are declared as swift optionals. * I have introduced a hardcoded list of method return types and method arguments that can be used to flag exceptions to this: scenarios where we can verify that the return value would never be nil, or the parameter demands a non-nil argument. The list currently is hardcoded in Swift, but will eventually move to a Json file to make it easier to work with. Sadly, this means that there will be some churn, until all this is properly validated. This is a fix for this issue: #63 Some additional data: * Some 114 property returns were affected * Some 432 method returns were affected
- Loading branch information
1 parent
35480c8
commit 8b76a62
Showing
6 changed files
with
117 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters