Open drom opened 8 years ago
@wanderer any thoughts?
just add s
to the end of everything that is an array?
@wanderer how about body
?
@drom idk, i'm kinda stumped on this one
@wanderer I have made bunch of related changes into spec, parser, traverse, codegen. All related to the issue in hand. That made possible codegen generation. Check out new codegen! I still open for better names :smile:
Have seen your WebAssembly talks on YouTube. Impressive! You are ahead of me on this one :+1: I am going to talk about our WAST toolchain on the next South Bay SV JS meetup.
@drom Super cool, I would love to come!... but it looks like going to be stuck here for a couple more months at least :(
Also i think you can put the event on the event list https://github.com/WebAssembly/design/blob/master/Events.md
@drom so things like call_import
and call_direct
can only have one expression. Is there any reason the have those as arrays?
@wanderer good catch.
Approve call_import.exprs -> expr
Can't find any example with call_direct
...
Ah! call_indirect
!
left-to-right.wast:88
(func $i32_call_indirect (result i32)
(call $reset)
(call_indirect $i32_T
(call $i32_callee)
(call $i32_right)
(call $i32_another))
(call $get))
call_import
Array example !
imports.wast:7
(call_import $print_i32_f32
(i32.add (get_local $i) (i32.const 1))
(f32.const 42)
)
:star: cool beans!
so after some use I have found it easier to do AST transforms if I add an array 'type'. So like
{
kind: 'block',
body: {
type: 'array'
value: [ ... ]
}
}
the extra type allow me to more easy identify and add things to blocks
@wanderer why you need extra kind?
have you tried https://github.com/drom/wast-traverse ?
it has node
and parent
objects to analyze.
@drom here is an example
(block
(statement)
(statement that has a possible `br`)
(inject node here)
(statement)
)
i need to inject a statement into every block after a possible branch condition. So i could do this by checking if the parent is a func
, loop
, block
, ect. Or i can just add a fake type 'array' and check for array
.
@wanderer I am not sure about kind:Array
idea. It adds to the complexity of the AST. IMHO
We have 2 type of node hierarchical properties:
Object
-- scalar childArray
-- vector childit should be possible to know type of the property value by name of the property key, like:
id, expr, init, test, consequent, alternate, left, right, result, module, failure, invoke
--Object
body, items, params, local, segment
--Array
Find all mismatches and fix.
func.param -> func.params
br_table.expr -> br_table.SOMETHING_ARRAY_LIKE