diff --git a/OCRunner.podspec b/OCRunner.podspec index 82e6537..eb3314f 100644 --- a/OCRunner.podspec +++ b/OCRunner.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "OCRunner" -s.version = "1.2.10" +s.version = "1.2.11" s.summary = "OCRunner" s.description = <<-DESC Execute Objective-C code Dynamically. iOS hotfix SDK. diff --git a/OCRunner/RunnerClasses+Execute.m b/OCRunner/RunnerClasses+Execute.m index cc9371d..a868cd5 100644 --- a/OCRunner/RunnerClasses+Execute.m +++ b/OCRunner/RunnerClasses+Execute.m @@ -132,6 +132,10 @@ void copy_undef_var(id exprOrStatement, MFVarDeclareChain *chain, MFScopeChain * if (exprOrStatementClass == [ORValueExpression class]) { ORValueExpression *expr = (ORValueExpression *)exprOrStatement; switch (expr.value_type) { + case OCValueNSNumber:{ + copy_undef_var(expr.value, chain, fromScope, destScope); + break; + } case OCValueDictionary:{ for (NSArray *kv in expr.value) { ORNode *keyExp = kv.firstObject; diff --git a/OCRunnerTests/OCRunnerTests.swift b/OCRunnerTests/OCRunnerTests.swift index 7fa4c73..dc30624 100644 --- a/OCRunnerTests/OCRunnerTests.swift +++ b/OCRunnerTests/OCRunnerTests.swift @@ -1128,4 +1128,20 @@ class CRunnerTests: XCTestCase { let result = scope.getValueWithIdentifier("result")?.intValue XCTAssert(result == 3); } + func testBlockCaptureNSNumberSubNodes() { + let source = + """ + int x = 1, y = 2, z= 3; + id (^block)(void) = ^id{ + return @(x * y * z + 1); + }; + id result = block(); + """ + let ast = ocparser.parseSource(source) + for classValue in ast.nodes { + (classValue as! OCExecute).execute(scope); + } + let result = scope.getValueWithIdentifier("result")?.objectValue + XCTAssert(result as? NSNumber == NSNumber(value: 7), "\(result)"); + } }