Skip to content

Commit

Permalink
add TI_PRINT_PREPROCESSED
Browse files Browse the repository at this point in the history
fix TI_PRINT_PROCESSED
  • Loading branch information
archibate committed Feb 27, 2020
1 parent 6eecced commit c9679bd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions python/taichi/lang/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ def init(default_fp=None, default_ip=None, print_preprocessed=None, debug=None,
elif dfl_ip is not None:
raise ValueError(f'Unrecognized TI_DEFAULT_IP: {dfl_ip}, should be 32 or 64')

if print_preprocessed is None: # won't override
print_preprocessed = os.environ.get("TI_PRINT_PREPROCESSED")
if print_preprocessed is not None:
print_preprocessed = bool(int(print_preprocessed))

if default_fp is not None:
ti.get_runtime().set_default_fp(default_fp)
if default_ip is not None:
Expand Down
5 changes: 4 additions & 1 deletion python/taichi/lang/transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,11 @@ def visit_block(self, list_stmt):
for i, l in enumerate(list_stmt):
list_stmt[i] = self.visit(l)

def visit_Return(self, node):
print('visited return!')

def visit_If(self, node):
self.generic_visit(node, ['body', 'orelse'])
self.generic_visit(node)

is_static_if = isinstance(node.test, ast.Call) and isinstance(
node.test.func, ast.Attribute)
Expand Down

0 comments on commit c9679bd

Please sign in to comment.