parent
57f92a9334
commit
ead3d08e77
48
apps/mu.subx
48
apps/mu.subx
|
@ -1420,6 +1420,52 @@ test-convert-function-with-local-var-in-named-block:
|
|||
5d/pop-to-ebp
|
||||
c3/return
|
||||
|
||||
test-unknown-variable-in-named-block:
|
||||
# . prologue
|
||||
55/push-ebp
|
||||
89/<- %ebp 4/r32/esp
|
||||
# setup
|
||||
(clear-stream _test-input-stream)
|
||||
(clear-stream $_test-input-buffered-file->buffer)
|
||||
(clear-stream _test-output-stream)
|
||||
(clear-stream $_test-output-buffered-file->buffer)
|
||||
(clear-stream _test-error-stream)
|
||||
(clear-stream $_test-error-buffered-file->buffer)
|
||||
# var ed/edx: exit-descriptor = tailor-exit-descriptor(16)
|
||||
68/push 0/imm32
|
||||
68/push 0/imm32
|
||||
89/<- %edx 4/r32/esp
|
||||
(tailor-exit-descriptor %edx 0x10)
|
||||
#
|
||||
(write _test-input-stream "fn foo {\n")
|
||||
(write _test-input-stream " $a: {\n")
|
||||
(write _test-input-stream " compare x, 0\n")
|
||||
(write _test-input-stream " }\n")
|
||||
(write _test-input-stream "}\n")
|
||||
# convert
|
||||
(convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx)
|
||||
# registers except esp clobbered at this point
|
||||
# restore ed
|
||||
89/<- %edx 4/r32/esp
|
||||
(flush _test-output-buffered-file)
|
||||
(flush _test-error-buffered-file)
|
||||
#? # dump _test-error-stream {{{
|
||||
#? (write 2 "^")
|
||||
#? (write-stream 2 _test-error-stream)
|
||||
#? (write 2 "$\n")
|
||||
#? (rewind-stream _test-error-stream)
|
||||
#? # }}}
|
||||
# check output
|
||||
(check-stream-equal _test-output-stream "" "F - test-unknown-variable-in-named-block: output should be empty")
|
||||
(check-next-stream-line-equal _test-error-stream "unknown variable 'x'" "F - test-unknown-variable-in-named-block: error message")
|
||||
# check that stop(1) was called
|
||||
(check-ints-equal *(edx+4) 2 "F - test-unknown-variable-in-named-block: exit status")
|
||||
# don't restore from ebp
|
||||
81 0/subop/add %esp 8/imm32
|
||||
# . epilogue
|
||||
5d/pop-to-ebp
|
||||
c3/return
|
||||
|
||||
test-always-shadow-outermost-reg-vars-in-function:
|
||||
# . prologue
|
||||
55/push-ebp
|
||||
|
@ -5805,7 +5851,7 @@ $parse-mu-block:check-for-named-block:
|
|||
68/push 0/imm32
|
||||
89/<- %eax 4/r32/esp
|
||||
#
|
||||
(parse-mu-named-block %edx *(ebp+8) *(ebp+0xc) *(ebp+0x10) %eax)
|
||||
(parse-mu-named-block %edx *(ebp+8) *(ebp+0xc) *(ebp+0x10) %eax *(ebp+0x18) *(ebp+0x1c))
|
||||
(append-to-block Heap %edi *eax *(eax+4))
|
||||
# reclaim tmp
|
||||
81 0/subop/add %esp 8/imm32
|
||||
|
|
Loading…
Reference in New Issue