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

jsgen: basic struct embedding support (#9879)

This commit is contained in:
spaceface 2021-04-26 08:56:03 +02:00 committed by GitHub
parent 3c0a368af3
commit 8b22dbbadb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1085,6 +1085,10 @@ fn (mut g JsGen) gen_struct_decl(node ast.StructDecl) {
g.writeln('};')
g.writeln('${js_name}.prototype = {')
g.inc_indent()
for embed in node.embeds {
etyp := g.typ(embed.typ)
g.writeln('...${etyp}.prototype,')
}
fns := g.method_fn_decls[name]
for field in node.fields {
typ := g.typ(field.typ)