Show the asm based on the showasm flag (or file object), writing to the appropriate stream depending on the type of the flag. :param showasm: Flag which determines whether the ingested code is written to sys.stdout or not. (It is also to pass a file
(showasm, tokens)
| 16 | |
| 17 | |
| 18 | def maybe_show_asm(showasm, tokens): |
| 19 | """ |
| 20 | Show the asm based on the showasm flag (or file object), writing to the |
| 21 | appropriate stream depending on the type of the flag. |
| 22 | |
| 23 | :param showasm: Flag which determines whether the ingested code is |
| 24 | written to sys.stdout or not. (It is also to pass a file |
| 25 | like object, into which the asm will be written). |
| 26 | :param tokens: The asm tokens to show. |
| 27 | """ |
| 28 | if showasm: |
| 29 | stream = showasm if hasattr(showasm, "write") else sys.stdout |
| 30 | for t in tokens: |
| 31 | stream.write(str(t)) |
| 32 | stream.write("\n") |
| 33 | |
| 34 | |
| 35 | def maybe_show_tree(walker, ast): |
no test coverage detected