mirror of https://github.com/m-labs/artiq.git
transforms/inline: strip docstrings
This commit is contained in:
parent
d3e70ec53d
commit
c95f5bdff3
|
@ -218,6 +218,10 @@ class _ReferenceReplacer(ast.NodeVisitor):
|
||||||
node)
|
node)
|
||||||
|
|
||||||
def visit_Expr(self, node):
|
def visit_Expr(self, node):
|
||||||
|
if isinstance(node.value, ast.Str):
|
||||||
|
# Strip docstrings. This also removes strings appearing in the
|
||||||
|
# middle of the code, but they are nops.
|
||||||
|
return None
|
||||||
self.generic_visit(node)
|
self.generic_visit(node)
|
||||||
if isinstance(node.value, ast.Name):
|
if isinstance(node.value, ast.Name):
|
||||||
# Remove Expr nodes that contain only a name, likely due to
|
# Remove Expr nodes that contain only a name, likely due to
|
||||||
|
|
Loading…
Reference in New Issue