Skip to content

Commit 3af8c2b

Browse files
committed
Clean up code
Also do some type hinting
1 parent bc6a891 commit 3af8c2b

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

src/arch/zx48k/backend/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44

55
import math
66
import re
7+
8+
from collections import defaultdict
9+
10+
from typing import Dict
711
from typing import List
12+
from typing import Set
813

914
from . import errors
1015
from .errors import InvalidICError as InvalidIC

src/symbols/arrayaccess.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class SymbolARRAYACCESS(SymbolCALL):
3838
"""
3939

4040
def __init__(self, entry, arglist, lineno):
41-
super(SymbolARRAYACCESS, self).__init__(entry, arglist, lineno)
41+
super().__init__(entry, arglist, lineno)
4242
assert all(gl.BOUND_TYPE == x.type_.type_ for x in arglist), "Invalid type for array index"
4343

4444
@property

src/symbols/call.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ class SymbolCALL(Symbol):
3636
lineno: source code line where this call was made
3737
"""
3838

39-
def __init__(self, entry: SymbolFUNCTION, arglist: Iterable[SymbolARGUMENT], lineno: int):
40-
super(SymbolCALL, self).__init__()
39+
def __init__(self, entry: Symbol, arglist: Iterable[SymbolARGUMENT], lineno: int):
40+
super().__init__()
4141
assert isinstance(lineno, int)
4242
assert all(isinstance(x, SymbolARGUMENT) for x in arglist)
4343
self.entry = entry
4444
self.args = arglist # Func. call / array access
4545
self.lineno = lineno
4646

47-
if entry.token == 'FUNCTION':
47+
if isinstance(entry, SymbolFUNCTION):
4848
for arg, param in zip(arglist, entry.params): # Sets dependency graph for each argument -> parameter
4949
if arg.value is not None:
5050
arg.value.add_required_symbol(param)

0 commit comments

Comments
 (0)