fix some errors

This commit is contained in:
Irmen de Jong 2018-02-16 12:42:13 +01:00
parent 4134400059
commit daca1cce37
3 changed files with 4 additions and 3 deletions

View File

@ -42,7 +42,7 @@ class ConstantFold:
self._constant_folding()
def _constant_folding(self) -> None:
for expression in list(self.module.all_nodes(Expression)):
for expression in self.module.all_nodes(Expression):
if expression.parent is None or expression.parent.parent is None:
# stale expression node (was part of an expression that was constant-folded away)
continue

View File

@ -8,7 +8,7 @@ Written by Irmen de Jong (irmen@razorvine.net) - license: GNU GPL 3.0
import contextlib
import math
import attr
from typing import Set, Callable
from typing import Set, Callable, no_type_check
from ..datatypes import FLOAT_MAX_POSITIVE, FLOAT_MAX_NEGATIVE
from ..plyparse import Scope, AstNode
from ..compile import Zeropage
@ -129,6 +129,7 @@ def preserving_registers(registers: Set[str], scope: Scope, out: Callable, loads
yield
@no_type_check
def scoped_name(node_with_name: AstNode, current_scope: Scope) -> str:
node_scope = node_with_name.my_scope()
return node_with_name.name if node_scope is current_scope else node_scope.name + "." + node_with_name.name

View File

@ -132,7 +132,7 @@
; (constant) expressions
var .word expr_byte1b = -1-2-3-4-$22+$80+ZP.zpconst
var .byte expr_fault2 = 1 + (8/3)+sin(33) + max(1,2,3)
var .byte expr_fault2 = 1 + (8/3)+sin(33) + len("abc")
sin: