Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into Inline-functions
Browse files Browse the repository at this point in the history
  • Loading branch information
smartycope committed Aug 17, 2024
2 parents 77b91a6 + becbcfa commit 8170d26
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
20 changes: 12 additions & 8 deletions pyndustric/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -759,16 +759,17 @@ def emit_unit_syscall(self, node: ast.Call):
if len(node.args) != 1:
raise CompilerError(ERR_BAD_SYSCALL_ARGS, node)

if not isinstance(node.args[0], ast.Constant):
raise CompilerError(ERR_BAD_SYSCALL_ARGS, node)

unit = node.args[0].value
if isinstance(node.args[0], ast.Constant):
unit = node.args[0].value

if not isinstance(unit, str):
if not isinstance(unit, str):
raise CompilerError(ERR_BAD_SYSCALL_ARGS, node)
self.ins_append(f"ubind @{unit}")
elif isinstance(node.args[0], ast.Name):
self.ins_append(f"ubind {node.args[0].id}")
else:
raise CompilerError(ERR_BAD_SYSCALL_ARGS, node)

self.ins_append(f"ubind @{unit}")

elif method == "idle":
if len(node.args) != 0:
raise CompilerError(ERR_BAD_SYSCALL_ARGS, node)
Expand Down Expand Up @@ -1168,6 +1169,8 @@ def as_value(self, node, output: str = None):
return ("false", "true")[node.value]
elif isinstance(node.value, (int, float)):
return str(node.value)
elif node.value is None:
return "@null"
elif isinstance(node.value, str):
if (
len(str(node.value)) == 7 or len(str(node.value)) == 9
Expand Down Expand Up @@ -1309,7 +1312,8 @@ def as_value(self, node, output: str = None):
n1=len(node.args),
called=node.func.id,
n2=argc,
plural1=plural(len(node.args), plural2=plural(argc)),
plural1=plural(len(node.args)),
plural2=plural(argc),
)

operands = " ".join(self.as_value(arg) for arg in node.args)
Expand Down
7 changes: 7 additions & 0 deletions test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -1245,3 +1245,10 @@ def test_complex_compare():
op lessThan a a 15
"""
a = 1 < 2 < 3 < 4 < 5 < 6 < 7 < 8 < 9 < 10 < 11 < 12 < 13 < 14 < 15

@masm_test
def test_None():
"""
set foo @null
"""
foo = None

0 comments on commit 8170d26

Please sign in to comment.