Skip to content

Commit 7a85745

Browse files
Refactor.
1 parent 2c62ced commit 7a85745

File tree

5 files changed

+269
-6
lines changed

5 files changed

+269
-6
lines changed

Classes/JSBScriptingSupport.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,10 @@ static void setReturnValue(JSValue *value, NSInvocation *invocation)
176176
static CGFloat tableViewHeightForRowAtIndexPath(id self, SEL _cmd, UITableView *tableView, NSIndexPath *indexPath)
177177
{
178178
NSString *propertyName = propertyNameFromSelector(_cmd);
179-
JSValue *value = globalContext[mangledNameFromClass([self class])][@"instanceMembers"][propertyName];
179+
JSValue *function = globalContext[mangledNameFromClass([self class])][@"instanceMembers"][propertyName];
180180

181-
if (!value.isUndefined) {
182-
JSValue *returnValue = [value callWithArguments:@[tableView, indexPath]];
181+
if (!function.isUndefined) {
182+
JSValue *returnValue = [function callWithArguments:@[tableView, indexPath]];
183183
return returnValue.toDouble;
184184
}
185185

@@ -222,11 +222,11 @@ static void forwardInvocation(id self, SEL _cmd, NSInvocation *invocation)
222222
context[@"self"] = self;
223223

224224
NSString *propertyName = propertyNameFromSelector(invocation.selector);
225-
JSValue *value = globalContext[mangledNameFromClass([self class])][@"instanceMembers"][propertyName];
225+
JSValue *function = globalContext[mangledNameFromClass([self class])][@"instanceMembers"][propertyName];
226226

227-
if (!value.isUndefined) {
227+
if (!function.isUndefined) {
228228
NSArray *arguments = extractArguments(invocation);
229-
JSValue *returnValue = [value callWithArguments:arguments];
229+
JSValue *returnValue = [function callWithArguments:arguments];
230230

231231
setReturnValue(returnValue, invocation);
232232
}
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "0500"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "14B5CD1B1875C3740019A135"
18+
BuildableName = "UICatalog.app"
19+
BlueprintName = "UICatalog"
20+
ReferencedContainer = "container:UICatalog.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
27+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
28+
shouldUseLaunchSchemeArgsEnv = "YES"
29+
buildConfiguration = "Debug">
30+
<Testables>
31+
<TestableReference
32+
skipped = "NO">
33+
<BuildableReference
34+
BuildableIdentifier = "primary"
35+
BlueprintIdentifier = "14B5CD361875C3750019A135"
36+
BuildableName = "UICatalogTests.xctest"
37+
BlueprintName = "UICatalogTests"
38+
ReferencedContainer = "container:UICatalog.xcodeproj">
39+
</BuildableReference>
40+
</TestableReference>
41+
</Testables>
42+
<MacroExpansion>
43+
<BuildableReference
44+
BuildableIdentifier = "primary"
45+
BlueprintIdentifier = "14B5CD1B1875C3740019A135"
46+
BuildableName = "UICatalog.app"
47+
BlueprintName = "UICatalog"
48+
ReferencedContainer = "container:UICatalog.xcodeproj">
49+
</BuildableReference>
50+
</MacroExpansion>
51+
</TestAction>
52+
<LaunchAction
53+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
54+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
55+
launchStyle = "0"
56+
useCustomWorkingDirectory = "NO"
57+
buildConfiguration = "Debug"
58+
ignoresPersistentStateOnLaunch = "NO"
59+
debugDocumentVersioning = "YES"
60+
allowLocationSimulation = "YES">
61+
<BuildableProductRunnable>
62+
<BuildableReference
63+
BuildableIdentifier = "primary"
64+
BlueprintIdentifier = "14B5CD1B1875C3740019A135"
65+
BuildableName = "UICatalog.app"
66+
BlueprintName = "UICatalog"
67+
ReferencedContainer = "container:UICatalog.xcodeproj">
68+
</BuildableReference>
69+
</BuildableProductRunnable>
70+
<AdditionalOptions>
71+
</AdditionalOptions>
72+
</LaunchAction>
73+
<ProfileAction
74+
shouldUseLaunchSchemeArgsEnv = "YES"
75+
savedToolIdentifier = ""
76+
useCustomWorkingDirectory = "NO"
77+
buildConfiguration = "Release"
78+
debugDocumentVersioning = "YES">
79+
<BuildableProductRunnable>
80+
<BuildableReference
81+
BuildableIdentifier = "primary"
82+
BlueprintIdentifier = "14B5CD1B1875C3740019A135"
83+
BuildableName = "UICatalog.app"
84+
BlueprintName = "UICatalog"
85+
ReferencedContainer = "container:UICatalog.xcodeproj">
86+
</BuildableReference>
87+
</BuildableProductRunnable>
88+
</ProfileAction>
89+
<AnalyzeAction
90+
buildConfiguration = "Debug">
91+
</AnalyzeAction>
92+
<ArchiveAction
93+
buildConfiguration = "Release"
94+
revealArchiveInOrganizer = "YES">
95+
</ArchiveAction>
96+
</Scheme>

JavaScriptBridge.xcworkspace/contents.xcworkspacedata

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "0500"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "149D976918758B0100129B4B"
18+
BuildableName = "JavaScriptBridge.app"
19+
BlueprintName = "JavaScriptBridge"
20+
ReferencedContainer = "container:JavaScriptBridge.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
27+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
28+
shouldUseLaunchSchemeArgsEnv = "YES"
29+
buildConfiguration = "Debug">
30+
<Testables>
31+
<TestableReference
32+
skipped = "NO">
33+
<BuildableReference
34+
BuildableIdentifier = "primary"
35+
BlueprintIdentifier = "149D978418758B0100129B4B"
36+
BuildableName = "JavaScriptBridgeTests.xctest"
37+
BlueprintName = "JavaScriptBridgeTests"
38+
ReferencedContainer = "container:JavaScriptBridge.xcodeproj">
39+
</BuildableReference>
40+
</TestableReference>
41+
</Testables>
42+
<MacroExpansion>
43+
<BuildableReference
44+
BuildableIdentifier = "primary"
45+
BlueprintIdentifier = "149D976918758B0100129B4B"
46+
BuildableName = "JavaScriptBridge.app"
47+
BlueprintName = "JavaScriptBridge"
48+
ReferencedContainer = "container:JavaScriptBridge.xcodeproj">
49+
</BuildableReference>
50+
</MacroExpansion>
51+
</TestAction>
52+
<LaunchAction
53+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
54+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
55+
launchStyle = "0"
56+
useCustomWorkingDirectory = "NO"
57+
buildConfiguration = "Debug"
58+
ignoresPersistentStateOnLaunch = "NO"
59+
debugDocumentVersioning = "YES"
60+
allowLocationSimulation = "YES">
61+
<BuildableProductRunnable>
62+
<BuildableReference
63+
BuildableIdentifier = "primary"
64+
BlueprintIdentifier = "149D976918758B0100129B4B"
65+
BuildableName = "JavaScriptBridge.app"
66+
BlueprintName = "JavaScriptBridge"
67+
ReferencedContainer = "container:JavaScriptBridge.xcodeproj">
68+
</BuildableReference>
69+
</BuildableProductRunnable>
70+
<AdditionalOptions>
71+
</AdditionalOptions>
72+
</LaunchAction>
73+
<ProfileAction
74+
shouldUseLaunchSchemeArgsEnv = "YES"
75+
savedToolIdentifier = ""
76+
useCustomWorkingDirectory = "NO"
77+
buildConfiguration = "Release"
78+
debugDocumentVersioning = "YES">
79+
<BuildableProductRunnable>
80+
<BuildableReference
81+
BuildableIdentifier = "primary"
82+
BlueprintIdentifier = "149D976918758B0100129B4B"
83+
BuildableName = "JavaScriptBridge.app"
84+
BlueprintName = "JavaScriptBridge"
85+
ReferencedContainer = "container:JavaScriptBridge.xcodeproj">
86+
</BuildableReference>
87+
</BuildableProductRunnable>
88+
</ProfileAction>
89+
<AnalyzeAction
90+
buildConfiguration = "Debug">
91+
</AnalyzeAction>
92+
<ArchiveAction
93+
buildConfiguration = "Release"
94+
revealArchiveInOrganizer = "YES">
95+
</ArchiveAction>
96+
</Scheme>
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "0500"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
</BuildAction>
9+
<TestAction
10+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
11+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
12+
shouldUseLaunchSchemeArgsEnv = "YES"
13+
buildConfiguration = "Debug">
14+
<Testables>
15+
<TestableReference
16+
skipped = "NO">
17+
<BuildableReference
18+
BuildableIdentifier = "primary"
19+
BlueprintIdentifier = "149D978418758B0100129B4B"
20+
BuildableName = "JavaScriptBridgeTests.xctest"
21+
BlueprintName = "JavaScriptBridgeTests"
22+
ReferencedContainer = "container:JavaScriptBridge.xcodeproj">
23+
</BuildableReference>
24+
</TestableReference>
25+
</Testables>
26+
</TestAction>
27+
<LaunchAction
28+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
29+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
30+
launchStyle = "0"
31+
useCustomWorkingDirectory = "NO"
32+
buildConfiguration = "Debug"
33+
ignoresPersistentStateOnLaunch = "NO"
34+
debugDocumentVersioning = "YES"
35+
allowLocationSimulation = "YES">
36+
<AdditionalOptions>
37+
</AdditionalOptions>
38+
</LaunchAction>
39+
<ProfileAction
40+
shouldUseLaunchSchemeArgsEnv = "YES"
41+
savedToolIdentifier = ""
42+
useCustomWorkingDirectory = "NO"
43+
buildConfiguration = "Release"
44+
debugDocumentVersioning = "YES">
45+
</ProfileAction>
46+
<AnalyzeAction
47+
buildConfiguration = "Debug">
48+
</AnalyzeAction>
49+
<ArchiveAction
50+
buildConfiguration = "Release"
51+
revealArchiveInOrganizer = "YES">
52+
</ArchiveAction>
53+
</Scheme>

0 commit comments

Comments
 (0)