diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-06-28 09:53:32 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-06-28 09:53:32 -0700 |
commit | 60bffdaa49000b170d365fa8217aef526301786b (patch) | |
tree | 51b48c7bd008128f8983b2bc8252b4154afdad8e | |
parent | 76a669f689caa636a5a0f7ac24b45f98870ccfb8 (diff) | |
download | mu-60bffdaa49000b170d365fa8217aef526301786b.tar.gz |
6583
-rwxr-xr-x | apps/mu | bin | 330839 -> 331811 bytes | |||
-rw-r--r-- | apps/mu.subx | 62 |
2 files changed, 61 insertions, 1 deletions
diff --git a/apps/mu b/apps/mu index ca892ee7..9a885745 100755 --- a/apps/mu +++ b/apps/mu Binary files differdiff --git a/apps/mu.subx b/apps/mu.subx index 793c6018..9dc7ca53 100644 --- a/apps/mu.subx +++ b/apps/mu.subx @@ -4974,6 +4974,54 @@ test-get-with-wrong-output-type: 5d/pop-to-ebp c3/return +test-get-with-wrong-output-type-2: + # . 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 " var a: t\n") + (write _test-input-stream " var c/ecx: int <- get a, x\n") + (write _test-input-stream "}\n") + (write _test-input-stream "type t {\n") + (write _test-input-stream " x: int\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-get-with-wrong-output-type-2: output should be empty") + (check-next-stream-line-equal _test-error-stream "fn foo: stmt get: output must be an address" "F - test-get-with-wrong-output-type-2: error message") + # check that stop(1) was called + (check-ints-equal *(edx+4) 2 "F - test-get-with-wrong-output-type-2: exit status") + # don't restore from ebp + 81 0/subop/add %esp 8/imm32 + # . epilogue + 5d/pop-to-ebp + c3/return + test-get-with-too-few-inouts: # . prologue 55/push-ebp @@ -10347,6 +10395,9 @@ check-mu-get-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buffere (lookup *(edi+0x18) *(edi+0x1c)) # Var-register Var-register => eax 3d/compare-eax-and 0/imm32 0f 84/jump-if-= $check-mu-get-stmt:error-output-not-in-register/disp32 + (lookup *(edi+8) *(edi+0xc)) # Var-type Var-type => eax + 81 7/subop/compare *eax 0/imm32/false # Tree-is-atom + 0f 85/jump-if-!= $check-mu-get-stmt:error-output-type-not-address/disp32 # - check for too many outputs (lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax (lookup *(eax+8) *(eax+0xc)) # Stmt-var-next Stmt-var-next => eax @@ -10441,7 +10492,6 @@ $check-mu-get-stmt:error-bad-field: # never gets here $check-mu-get-stmt:error-output-not-in-register: - # error("fn " fn ": stmt get: type " type " has no member called '" curr->name "'\n") (write-buffered *(ebp+0x10) "fn ") 8b/-> *(ebp+0xc) 0/r32/eax (lookup *eax *(eax+4)) # Function-name Function-name => eax @@ -10454,6 +10504,16 @@ $check-mu-get-stmt:error-output-not-in-register: (stop *(ebp+0x14) 1) # never gets here +$check-mu-get-stmt:error-output-type-not-address: + (write-buffered *(ebp+0x10) "fn ") + 8b/-> *(ebp+0xc) 0/r32/eax + (lookup *eax *(eax+4)) # Function-name Function-name => eax + (write-buffered *(ebp+0x10) %eax) + (write-buffered *(ebp+0x10) ": stmt get: output must be an address\n") + (flush *(ebp+0x10)) + (stop *(ebp+0x14) 1) + # never gets here + check-mu-call: # stmt: (addr stmt), callee: (addr function), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor) # . prologue 55/push-ebp |