-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
[TIMOB-23899] Add support for open access level keyword #163
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -201,6 +201,7 @@ function generateSwiftMetabase (buildDir, sdk, sdkPath, iosMinVersion, xcodeTarg | |
componentRE = /component id='(.*)'/, | ||
patternNamedRE = /pattern_named type='(\w+)' '(\w+)'/, | ||
typeRE = /type='(\w+)'/, | ||
publicAccessPattern = /access=(public|open)/, | ||
// turn our imports into includes for the metabase generation | ||
includes = imports.map(function (name) { | ||
return '<' + name + '/' + name + '.h>'; | ||
|
@@ -229,7 +230,7 @@ function generateSwiftMetabase (buildDir, sdk, sdkPath, iosMinVersion, xcodeTarg | |
language: 'swift' | ||
}; | ||
tok.slice(2).forEach(function (t, i) { | ||
if (t.indexOf('access=public') === 0) { | ||
if (publicAccessPattern.test(t)) { | ||
classdef.public = true; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. An open class is not a public class. Not sure if setting those flags is generic enough to deal with Swift properly. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. True, but the way we use this flag is to determine if a entity can be accessed via Hyperloop and in that case, it doesn't matter if it is public or open. I tried to make as little changes as possible considering we have a huge Swift overhaul coming anyway. |
||
} else if (t.indexOf('inherits:') === 0) { | ||
classdef.superclass = tok[i + 3]; // 2 is sliced so add + 1 | ||
|
@@ -250,7 +251,7 @@ function generateSwiftMetabase (buildDir, sdk, sdkPath, iosMinVersion, xcodeTarg | |
public: false | ||
}; | ||
tok.splice(2).forEach(function (t, i) { | ||
if (t.indexOf('access=public') === 0) { | ||
if (publicAccessPattern.test(t)) { | ||
vardef.public = true; | ||
} else if (t.indexOf('type=') === 0) { | ||
vardef.type = resolveType(fn, metabase, typeRE.exec(t)[1]); | ||
|
@@ -279,7 +280,7 @@ function generateSwiftMetabase (buildDir, sdk, sdkPath, iosMinVersion, xcodeTarg | |
}); | ||
} | ||
tok.splice(2).forEach(function (t, i) { | ||
if (t.indexOf('access=public') === 0) { | ||
if (publicAccessPattern.test(t)) { | ||
methodef.public = true; | ||
} else if (t.indexOf('type=') === 0) { | ||
if (t.indexOf('type=\'' + classdef.name + '.Type') === 0) { | ||
|
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.
How about other accessors? Swift has some unique ones like
fileprivate
.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.
All other access levels are restricted in a certain way and cannot be used from any code that is written in Hyperloop so they can be safely ignored.