~boringcactus/crowbar-reference-compiler

960e8c898dc0826d6dd5991f087fcd9d3ee6fcd1 — Melody Horn 1 year, 7 months ago c7de22f
fix some typing edge cases
2 files changed, 4 insertions(+), 4 deletions(-)

M crowbar_reference_compiler/ast.py
M tests/test_hello_world.py
M crowbar_reference_compiler/ast.py => crowbar_reference_compiler/ast.py +2 -2
@@ 347,7 347,7 @@ class HeaderFile:

    def get_declarations(self) -> List[Declaration]:
        included_declarations = [x.get_declarations() for x in self.includes]
        own_declarations = [x for x in self.contents if isinstance(x, Declaration)]
        own_declarations: List[Declaration] = [x for x in self.contents if isinstance(x, Declaration)]
        all_declarations = included_declarations + [own_declarations]
        return [x for l in all_declarations for x in l]



@@ 359,7 359,7 @@ class ImplementationFile:

    def get_declarations(self) -> List[Declaration]:
        included_declarations = [x.get_declarations() for x in self.includes]
        own_declarations = [x for x in self.contents if isinstance(x, Declaration)]
        own_declarations: List[Declaration] = [x for x in self.contents if isinstance(x, Declaration)]
        all_declarations = included_declarations + [own_declarations]
        return [x for l in all_declarations for x in l]


M tests/test_hello_world.py => tests/test_hello_world.py +2 -2
@@ 20,11 20,11 @@ int32 main() {
        expected_ssa = r"""
data $data0 = { b "Hello, world!\n", b 0 }

export function w $main() {
export function l $main() {
@start
    %t0 =l copy $data0
    call $printf(l %t0, ...)
    %t1 =w copy 0
    %t1 =l copy 0
    ret %t1
}
""".strip()