~boringcactus/crowbar-reference-compiler

2a17d1324bd7c93a06b0abe687bf6e4d3953c003 — Melody Horn 1 year, 7 months ago 960e8c8
make different incorrect assumptions about types
1 files changed, 8 insertions(+), 1 deletions(-)

M crowbar_reference_compiler/ssagen.py
M crowbar_reference_compiler/ssagen.py => crowbar_reference_compiler/ssagen.py +8 -1
@@ 103,10 103,17 @@ def _(target: ConstantExpression, context: CompileContext) -> SsaResult:
        context.next_temp += 1
        code = [f"%t{temp} =l copy $data{data_dest}"]
    elif target.type(context.declarations) == BasicType('char'):
        value = target.value.strip("'")
        if len(value) == 1:
            value = ord(value)
        elif value == r'\0':
            value = 0
        else:
            raise NotImplementedError('escape sequence ' + value)
        data = []
        temp = context.next_temp
        context.next_temp += 1
        code = [f"%t{temp} =l copy {ord(target.value[1])}"] # TODO handle escape sequences
        code = [f"%t{temp} =l copy {value}"]
    elif target.type(context.declarations) == BasicType('bool'):
        data = []
        temp = context.next_temp