diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-07-11 21:30:45 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-07-11 21:30:45 -0700 |
commit | 355073129b479efcb413e92b206b5fccf3834b03 (patch) | |
tree | c9382be4ca740cda11ffc31f8a18a4057664d464 | |
parent | d23f5ea2c6cea902b4db342139616850ddec0a31 (diff) | |
download | mu-355073129b479efcb413e92b206b5fccf3834b03.tar.gz |
6635 - bugfix
-rwxr-xr-x | apps/mu | bin | 344970 -> 345576 bytes | |||
-rw-r--r-- | apps/mu.subx | 50 |
2 files changed, 47 insertions, 3 deletions
diff --git a/apps/mu b/apps/mu index e1e82141..aef10773 100755 --- a/apps/mu +++ b/apps/mu Binary files differdiff --git a/apps/mu.subx b/apps/mu.subx index d8c38e0a..5d928708 100644 --- a/apps/mu.subx +++ b/apps/mu.subx @@ -999,6 +999,50 @@ test-convert-function-with-local-var-in-mem: 5d/pop-to-ebp c3/return +test-convert-invalid-literal: + # . 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 " increment 1n\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-convert-invalid-literal: output should be empty") + (check-next-stream-line-equal _test-error-stream "fn foo: variable '1n' cannot begin with a digit" "F - test-convert-invalid-literal: error message") + # check that stop(1) was called + (check-ints-equal *(edx+4) 2 "F - test-convert-invalid-literal: exit status") + # don't restore from ebp + 81 0/subop/add %esp 8/imm32 + # . epilogue + 5d/pop-to-ebp + c3/return + test-local-var-in-mem-has-no-initializer: # . prologue 55/push-ebp @@ -8792,7 +8836,7 @@ lookup-var-or-literal: # name: (addr slice), vars: (addr stack live-var), out: 3d/compare-eax-and 0/imm32/false 74/jump-if-= break/disp8 $lookup-var-or-literal:literal: - (new-literal-integer Heap %esi *(ebp+0x10) *(ebp+0x18) *(ebp+0x1c)) + (new-literal-integer Heap %esi *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c)) eb/jump $lookup-var-or-literal:end/disp8 } # else if (c == '"') return new var(name) @@ -9472,9 +9516,9 @@ $new-literal-integer:abort: 8b/-> *(ebp+0x14) 0/r32/eax (lookup *eax *(eax+4)) # Function-name Function-name => eax (write-buffered *(ebp+0x18) %eax) - (write-buffered *(ebp+0x18) ": variable cannot begin with a digit '") + (write-buffered *(ebp+0x18) ": variable '") (write-slice-buffered *(ebp+0x18) *(ebp+0xc)) - (write-buffered *(ebp+0x18) "'\n") + (write-buffered *(ebp+0x18) "' cannot begin with a digit\n") (flush *(ebp+0x18)) (stop *(ebp+0x1c) 1) # never gets here |