Skip to content

Commit 984dc89

Browse files
committed
remove min_var_count and add comments
1 parent e07b8b9 commit 984dc89

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

commands/FBClassDump.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,14 @@ def run(self, arguments, options):
139139
command = string.Template(tmpString).substitute(block=block)
140140
json = fb.evaluate(command)
141141

142-
variables_json = self.getBlockVariables(block)
142+
# We assume that the maximum number of variables captured by the block is 10
143+
max_var_count = 10
144+
variables_json = self.getBlockVariables(block, max_var_count)
143145
if variables_json is not None:
144146
json.update(variables_json)
145147

146148
variablesStrs = []
147-
for i in range(10):
149+
for i in range(max_var_count):
148150
varKey = 'variables['+str(i)+']'
149151
if varKey in json:
150152
variablesStrs.append(json[varKey])
@@ -162,9 +164,12 @@ def run(self, arguments, options):
162164

163165
print 'Imp: ' + hex(json['invoke']) + ' Signature: ' + sigStr + ' Variables : {\n'+variablesStr+'\n};'
164166

165-
def getBlockVariables(self, block, min_var_count=1, max_var_count=20):
167+
def getBlockVariables(self, block, max_var_count):
166168
'''
167169
no __Block_byref_xxx
170+
We must check the block's captured variables one by one here.
171+
no reason, but it works.
172+
We assume that the maximum number of variables captured by the block is max_var_count
168173
'''
169174

170175
# http://clang.llvm.org/docs/Block-ABI-Apple.html

0 commit comments

Comments
 (0)