Traverse a simplified abstract syntax tree and collect the names of all identifiers.
Constraints
Example
>>> collect_identifiers({'type': 'Identifier', 'name': 'x'})
['x']
>>> ast = {'type': 'BinaryExpression', 'left': {'type': 'Identifier', 'name': 'a'}, 'right': {'type': 'Literal', 'value': 5}}
>>> collect_identifiers(ast)
['a']
>>> ast = {'type': 'CallExpression', 'callee': {'type': 'Identifier', 'name': 'foo'}, 'arguments': [{'type': 'Identifier', 'name': 'bar'}, {'type': 'Literal', 'value': 1}]}
>>> collect_identifiers(ast)
['foo', 'bar']
Recent Submissions
No submissions yet — hit Run Tests to try!
Hints