X-Git-Url: http://nitlanguage.org diff --git a/contrib/objcwrapper/src/objc_model.nit b/contrib/objcwrapper/src/objc_model.nit index 46589c9..a082d22 100644 --- a/contrib/objcwrapper/src/objc_model.nit +++ b/contrib/objcwrapper/src/objc_model.nit @@ -19,6 +19,33 @@ module objc_model class ObjcModel # All analyzed classes var classes = new Array[ObjcClass] + + # Is `objc_type` known by this model? + fun knows_type(objc_type: Text): Bool + do + for c in classes do + if c.name == objc_type then return true + end + + return imported_types.has(objc_type) + end + + # Are all types in the signature or `method` known by this model? + fun knows_all_types(method: ObjcMethod): Bool + do + for param in method.params do + if param.is_single then break + if not knows_type(param.return_type) then return false + end + + var r = method.return_type + return r == "void" or r == "id" or knows_type(r) + end + + # Objective-C types available in imported modules + # + # TODO seach in existing wrappers + private var imported_types: Array[String] = ["NSObject", "NSString"] end # Objective-C class