7692
It's bad enough that metadata comments are restricted to integer literals; let's at least make them work on _all_ integer literals.
This commit is contained in:
parent
5268b0e1df
commit
f626421bc4
35
apps/mu.subx
35
apps/mu.subx
|
@ -5648,6 +5648,34 @@ test-array-size-in-hex:
|
|||
5d/pop-to-ebp
|
||||
c3/return
|
||||
|
||||
test-array-size-with-metadata:
|
||||
# . 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)
|
||||
#
|
||||
(write _test-input-stream "fn foo {\n")
|
||||
(write _test-input-stream " var x: (array int 3/bar)\n")
|
||||
(write _test-input-stream "}\n")
|
||||
# convert
|
||||
(convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0)
|
||||
(flush _test-output-buffered-file)
|
||||
#? # dump _test-output-stream {{{
|
||||
#? (write 2 "^")
|
||||
#? (write-stream 2 _test-output-stream)
|
||||
#? (write 2 "$\n")
|
||||
#? (rewind-stream _test-output-stream)
|
||||
#? # }}}
|
||||
# no errors
|
||||
# . epilogue
|
||||
89/<- %esp 5/r32/ebp
|
||||
5d/pop-to-ebp
|
||||
c3/return
|
||||
|
||||
test-convert-function-with-populate:
|
||||
# . prologue
|
||||
55/push-ebp
|
||||
|
@ -17132,11 +17160,10 @@ $parse-type:check-for-int:
|
|||
(is-decimal-digit? %eax) # => eax
|
||||
3d/compare-eax-and 0/imm32/false
|
||||
74/jump-if-= break/disp8
|
||||
#
|
||||
(is-hex-int? %ecx) # => eax
|
||||
3d/compare-eax-and 0/imm32/false
|
||||
74/jump-if-= break/disp8
|
||||
$parse-type:int:
|
||||
# strip out metadata
|
||||
(next-token-from-slice *ecx *(ecx+4) 0x2f %ecx)
|
||||
#
|
||||
(check-mu-hex-int %ecx *(ebp+0x14) *(ebp+0x18))
|
||||
(parse-hex-int-from-slice %ecx) # => eax
|
||||
c7 0/subop/copy *(edx+4) 9/imm32/type-id-array-capacity # Type-tree-value
|
||||
|
|
|
@ -14,7 +14,7 @@ fn initialize-gap-buffer _self: (addr gap-buffer) {
|
|||
# just for tests
|
||||
fn initialize-gap-buffer-with self: (addr gap-buffer), s: (addr array byte) {
|
||||
initialize-gap-buffer self
|
||||
var stream-storage: (stream byte 0x10) # max-word-size
|
||||
var stream-storage: (stream byte 0x10/max-word-size)
|
||||
var stream/ecx: (addr stream byte) <- address stream-storage
|
||||
write stream, s
|
||||
{
|
||||
|
@ -238,7 +238,7 @@ fn gap-buffer-equal? _self: (addr gap-buffer), s: (addr array byte) -> _/eax: bo
|
|||
# complication: graphemes may be multiple bytes
|
||||
# so don't rely on length
|
||||
# instead turn the expected result into a stream and arrange to read from it in order
|
||||
var stream-storage: (stream byte 0x10) # max-word-size
|
||||
var stream-storage: (stream byte 0x10/max-word-size)
|
||||
var expected-stream/ecx: (addr stream byte) <- address stream-storage
|
||||
write expected-stream, s
|
||||
# compare left
|
||||
|
|
Loading…
Reference in New Issue