-
Notifications
You must be signed in to change notification settings - Fork 46
[jextract] add support for throwing functions in JNI mode #277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Sources/JExtractSwiftLib/SwiftTypes/SwiftFunctionSignature.swift
Outdated
Show resolved
Hide resolved
} catch { | ||
environment.throwAsException(error) | ||
return Int64.jniPlaceholderValue | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks ok 👍
|
||
enum SwiftEffectSpecifier: Equatable { | ||
case `throws` | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's okey, in swift-syntax they're just as a keyword afair -- any opinion about such enum @rintaro ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The enum look okay to me for now. We should support typed throw some day, but not now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok to me, one question Rintaro may want to chime in about our new "effect" enum here. I think it's okey though, since we just have the few limited effects we're handling, well, just the one for now, but in future maybe async
Looks nice! When you enable previously-unsupported thing in |
} | ||
case .accessors(let accessors): | ||
if let getter = accessors.first(where: { $0.accessorSpecifier.tokenKind == .keyword(.set) }) { | ||
effectSpecifiers = Self.effectSpecifiers(from: getter) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should do this only if isSet
is false
.
switch binding.accessorBlock?.accessors { | ||
case .getter(let getter): | ||
if let getter = getter.as(AccessorDeclSyntax.self) { | ||
effectSpecifiers = Self.effectSpecifiers(from: getter) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AccessorBlockSyntax.Accessors.getter
can only contain CodeBlockItemListSyntax
so this should be unreachable.
Disabling |
Adds support for generating throwing functions in JNI mode