Skip to content
Snippets Groups Projects
Commit 4063b919 authored by li213's avatar li213
Browse files

fix error while converting enums to strings

parent b029b4af
No related branches found
No related tags found
No related merge requests found
...@@ -600,6 +600,8 @@ def proc(node: ast.AST, env: Env) -> Any: ...@@ -600,6 +600,8 @@ def proc(node: ast.AST, env: Env) -> Any:
elif isinstance(node, ast.For) or isinstance(node, ast.While): elif isinstance(node, ast.For) or isinstance(node, ast.While):
raise NotImplementedError("loops not supported") raise NotImplementedError("loops not supported")
elif isinstance(node, ast.If): elif isinstance(node, ast.If):
if astunparser.unparse(node)=='\nif lane_map.has_left(ego.lane_mode):\n output.vehicle_mode = VehicleMode.SwitchLeft\n':
print("stop")
if is_main_check(node): if is_main_check(node):
return START_OF_MAIN return START_OF_MAIN
test = proc(node.test, env) test = proc(node.test, env)
...@@ -624,7 +626,7 @@ def proc(node: ast.AST, env: Env) -> Any: ...@@ -624,7 +626,7 @@ def proc(node: ast.AST, env: Env) -> Any:
return env.lookup(node.id) return env.lookup(node.id)
elif isinstance(node, ast.Attribute) and isinstance(node.ctx, ast.Load): elif isinstance(node, ast.Attribute) and isinstance(node.ctx, ast.Load):
if isinstance(node.value, ast.Name) and node.value.id in env.mode_defs: if isinstance(node.value, ast.Name) and node.value.id in env.mode_defs:
return node.attr return ast.Constant(node.attr)
obj = proc(node.value, env) obj = proc(node.value, env)
# TODO since we know what the mode and state types contain we can do some typo checking # TODO since we know what the mode and state types contain we can do some typo checking
if not_ir_ast(obj): if not_ir_ast(obj):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment