git @ Cat's Eye Technologies Xoomonk / f75e37c
`$` doesn't count as variable usage during analysis. catseye 9 years ago
2 changed file(s) with 4 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
312312 | print $.add.result
313313 | print $.add
314314 = 8
315 = [x=3,y=5,result=8]
315 = [result=8,x=3,y=5]
316316
317317 Because using a built-in operation store in this way saturates it, it cannot
318318 be used again. Typically you want to make a copy of the store first, and use
324324 elif type == 'Newline':
325325 find_used_variables(ast.children[0], s)
326326 elif type == 'Ref':
327 s.add(ast.children[0].value)
327 name = ast.children[0].value
328 if name != '$':
329 s.add(name)
328330 elif type == 'Block':
329331 for child in ast.children:
330332 find_used_variables(child, s)