You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm running #1367 (with #1668 patched) on the AVFAudio module to try to see if I can migrate the ffigen objc example to swift. That'll be a good milestone to demonstrate binding a simple, but realistic, Apple API.
The most important class for this example is AVAudioPlayer, but currently it's flaky whether that class even exists in the list of declarations returned by parseAst.
The text was updated successfully, but these errors were encountered:
The main problem was that we're indicating errors by throwing exceptions. So if, for example, a method returned an enum, which we don't support yet, parseDeclaration would throw. Then since the method parser wasn't catching that exception, it also propagated up through _parseCompoundDeclaration, effectively removing that declaration. The fix is to catch the error in _parseCompoundDeclaration and just omit that method. I added tryParseDeclaration that wraps parseDeclaration, logs the exception and returns null.
More generally, any time we're calling parseDeclaration, if we want to gracefully handle a problem with the declaration, we should instead call tryParseDeclaration and handle the nullable result. I had a quick look at all the call sites and I don't think there are any other cases like this at the moment.
I'm running #1367 (with #1668 patched) on the
AVFAudio
module to try to see if I can migrate the ffigen objc example to swift. That'll be a good milestone to demonstrate binding a simple, but realistic, Apple API.The most important class for this example is
AVAudioPlayer
, but currently it's flaky whether that class even exists in the list of declarations returned byparseAst
.The text was updated successfully, but these errors were encountered: