From 8b22dbbadb170c8715b4c0cba855a2b59c6c041d Mon Sep 17 00:00:00 2001 From: spaceface Date: Mon, 26 Apr 2021 08:56:03 +0200 Subject: [PATCH] jsgen: basic struct embedding support (#9879) --- vlib/v/gen/js/js.v | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vlib/v/gen/js/js.v b/vlib/v/gen/js/js.v index 96e4905172..8118e01bfe 100644 --- a/vlib/v/gen/js/js.v +++ b/vlib/v/gen/js/js.v @@ -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)