From cb82ff618bee6f0212c677f29e65fcb93073dd9d Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Thu, 21 May 2020 19:31:07 +0500 Subject: [PATCH] jsgen: proper jsdoc for namespace --- vlib/v/gen/js/js.v | 2 +- vlib/v/gen/js/jsdoc.v | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/vlib/v/gen/js/js.v b/vlib/v/gen/js/js.v index 5ea3d66c45..cbe5ed09d5 100644 --- a/vlib/v/gen/js/js.v +++ b/vlib/v/gen/js/js.v @@ -99,7 +99,7 @@ pub fn gen(files []ast.File, table &table.Table, pref &pref.Preferences) string g.finish() mut out := g.hashes() + g.definitions.str() + g.constants.str() for node in deps_resolved.nodes { - out += '/* namespace: $node.name */\n' + out += g.doc.gen_namespace(node.name) out += 'const $node.name = (function (' imports := g.namespace_imports[node.name] for i, key in imports.keys() { diff --git a/vlib/v/gen/js/jsdoc.v b/vlib/v/gen/js/jsdoc.v index c4f48db6ba..2edfd8c476 100644 --- a/vlib/v/gen/js/jsdoc.v +++ b/vlib/v/gen/js/jsdoc.v @@ -96,3 +96,9 @@ fn (mut d JsDoc) gen_fn(it ast.FnDecl) string { d.write('*/') return d.out.str() } + +fn (mut d JsDoc) gen_namespace(ns string) string { + d.reset() + d.writeln('/** @namespace ${ns} */') + return d.out.str() +}