jsgen: basic struct embedding support (#9879)

pull/9887/head
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
1 changed files with 4 additions and 0 deletions

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)