1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

js: support WASM interoperability using wasm_import/wasm_export fn tags (#12212)

This commit is contained in:
playX
2021-10-18 10:56:21 +03:00
committed by GitHub
parent 2070839722
commit a3de67de28
4 changed files with 107 additions and 8 deletions

View File

@@ -195,6 +195,7 @@ fn (mut p Parser) fn_decl() ast.FnDecl {
'direct_array_access' { is_direct_arr = true }
'keep_args_alive' { is_keep_alive = true }
'export' { is_exported = true }
'wasm_export' { is_exported = true }
'unsafe' { is_unsafe = true }
'trusted' { is_trusted = true }
'c2v_variadic' { is_c2v_variadic = true }

View File

@@ -1502,7 +1502,7 @@ fn (mut p Parser) attributes() {
for p.tok.kind != .rsbr {
start_pos := p.tok.position()
attr := p.parse_attr()
if p.attrs.contains(attr.name) {
if p.attrs.contains(attr.name) && attr.name != 'wasm_export' {
p.error_with_pos('duplicate attribute `$attr.name`', start_pos.extend(p.prev_tok.position()))
return
}