MCPcopy Create free account
hub / github.com/facebook/chisel / decode

Function decode

commands/FBClassDump.py:250–285  ·  view source on GitHub ↗
(code)

Source from the content-addressed store, hash-verified

248
249
250def decode(code):
251 encodeMap = {
252 "c": "char",
253 "i": "int",
254 "s": "short",
255 "l": "long",
256 "q": "long long",
257 "C": "unsigned char",
258 "I": "unsigned int",
259 "S": "unsigned short",
260 "L": "unsigned long",
261 "Q": "unsigned long long",
262 "f": "float",
263 "d": "double",
264 "B": "bool",
265 "v": "void",
266 "*": "char *",
267 "@": "id",
268 "#": "Class",
269 ":": "SEL",
270 }
271
272 ret = code
273 if code in encodeMap:
274 ret = encodeMap[code]
275 elif ret[0:1] == "@":
276 if ret[1:2] == "?": # @? represent a block
277 ret = code
278 elif ret[2:3] == "<": # @"<aDelegate><bDelegate>"
279 ret = "id" + ret[2:-1].replace("><", ", ")
280 else:
281 ret = ret[2:-1] + " *"
282 elif ret[0:1] == "^":
283 ret = decode(ret[1:]) + " *"
284
285 return ret
286
287
288# Notice that evaluateExpression doesn't work with variable arguments. such as -[NSString stringWithFormat:]

Callers 3

runMethod · 0.85
prettyPrintStringMethod · 0.85
prettyPrintStringMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected