assemblyscript
assemblyscript copied to clipboard
initial tests for arguments length
⯈ Initial attempt on implementing arguments.length
- [x] I've read the contributing guidelines
(func $builtins/arglength1 (param $0 i32)
(local $1 i32)
(local $2 i32)
global.get $~lib/memory/__stack_pointer
i32.const 4
i32.sub
global.set $~lib/memory/__stack_pointer
call $~stack_check
global.get $~lib/memory/__stack_pointer
i32.const 0
i32.store
+ global.get $~argumentsLength
+ local.set $1
i32.const 1024
local.set $2
global.get $~lib/memory/__stack_pointer
local.get $2
i32.store
local.get $2
i32.const 2
+ call $~lib/builtins/arguments.get:length
f64.convert_i32_s
+ call $~lib/builtins/arguments.get:length
f64.convert_i32_s
f64.const 0
f64.const 0
f64.const 0
call $~lib/builtins/trace
global.get $~lib/memory/__stack_pointer
i32.const 4
i32.add
global.set $~lib/memory/__stack_pointer
)
I put a plus sign before the important bits. Looks like it's calling a function instead of getting a local.
Of course, it adds a function like this:
+ (func $~lib/builtins/arguments.get:length (result i32)
+ (local $0 i32)
+ global.get $~argumentsLength
+ local.set $0
+ local.get $0
+ )
🙄