-
Notifications
You must be signed in to change notification settings - Fork 53
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
[swift2objc] Support closures #1669
Comments
Closure parsing via For the given variables: // tuple
public var myTuple = (9)
// closure
public var myClosure = { (o: Int) -> Int in return 9 }
{
"kind": {
"identifier": "swift.var",
"displayName": "Global Variable"
},
"identifier": {
"precise": "s:28primitive_symbolgraph_module7myTupleSivp",
"interfaceLanguage": "swift"
},
"pathComponents": [
"myTuple"
],
"names": {
"title": "myTuple",
"subHeading": [
{
"kind": "keyword",
"spelling": "var"
},
{
"kind": "text",
"spelling": " "
},
{
"kind": "identifier",
"spelling": "myTuple"
},
{
"kind": "text",
"spelling": ": ("
},
{
"kind": "typeIdentifier",
"spelling": "Int",
"preciseIdentifier": "s:Si"
},
{
"kind": "text",
"spelling": ")"
}
]
},
"declarationFragments": [
{
"kind": "keyword",
"spelling": "var"
},
{
"kind": "text",
"spelling": " "
},
{
"kind": "identifier",
"spelling": "myTuple"
},
{
"kind": "text",
"spelling": ": ("
},
{
"kind": "typeIdentifier",
"spelling": "Int",
"preciseIdentifier": "s:Si"
},
{
"kind": "text",
"spelling": ")"
}
],
"accessLevel": "public",
"location": {
"uri": "file://types.swift",
"position": {
"line": 23,
"character": 11
}
}
},
{
"kind": {
"identifier": "swift.var",
"displayName": "Global Variable"
},
"identifier": {
"precise": "s:28primitive_symbolgraph_module9myClosureyS2icvp",
"interfaceLanguage": "swift"
},
"pathComponents": [
"myClosure"
],
"names": {
"title": "myClosure",
"subHeading": [
{
"kind": "keyword",
"spelling": "var"
},
{
"kind": "text",
"spelling": " "
},
{
"kind": "identifier",
"spelling": "myClosure"
},
{
"kind": "text",
"spelling": ": ("
},
{
"kind": "typeIdentifier",
"spelling": "Int",
"preciseIdentifier": "s:Si"
},
{
"kind": "text",
"spelling": ") -> "
},
{
"kind": "typeIdentifier",
"spelling": "Int",
"preciseIdentifier": "s:Si"
}
]
},
"declarationFragments": [
{
"kind": "keyword",
"spelling": "var"
},
{
"kind": "text",
"spelling": " "
},
{
"kind": "identifier",
"spelling": "myClosure"
},
{
"kind": "text",
"spelling": ": ("
},
{
"kind": "typeIdentifier",
"spelling": "Int",
"preciseIdentifier": "s:Si"
},
{
"kind": "text",
"spelling": ") -> "
},
{
"kind": "typeIdentifier",
"spelling": "Int",
"preciseIdentifier": "s:Si"
}
],
"accessLevel": "public",
"location": {
"uri": "file://types.swift",
"position": {
"line": 26,
"character": 11
}
}
} Apparently, it doesn't play so well with types containing characters other than literal characters (i.e symbols). |
Ok. Looks like we'll have to write a bit of custom parsing logic for this. |
Support functions and methods that accept and return closures:
The text was updated successfully, but these errors were encountered: