Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
flatbuffers
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
flatbuffers
Commits
4a49493e
Commit
4a49493e
authored
Jul 11, 2016
by
James Gilles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
js:add @namespace annotation to namespaces
parent
193a6317
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
23 additions
and
10 deletions
+23
-10
flatbuffers.js
js/flatbuffers.js
+4
-0
idl_gen_js.cpp
src/idl_gen_js.cpp
+1
-1
monster_test.bfbs
tests/monster_test.bfbs
+0
-0
monster_test_generated.js
tests/monster_test_generated.js
+8
-4
namespace_test1_generated.js
tests/namespace_test/namespace_test1_generated.js
+4
-2
namespace_test2_generated.js
tests/namespace_test/namespace_test2_generated.js
+6
-3
No files found.
js/flatbuffers.js
View file @
4a49493e
...
...
@@ -2,6 +2,10 @@
/// @addtogroup flatbuffers_javascript_api
/// @{
/// @cond FLATBUFFERS_INTERNAL
/**
* @const
* @namespace
*/
var
flatbuffers
=
{};
/**
...
...
src/idl_gen_js.cpp
View file @
4a49493e
...
...
@@ -110,7 +110,7 @@ class JsGenerator : public BaseGenerator {
std
::
string
&
exports
=
*
exports_ptr
;
for
(
auto
it
=
sorted_namespaces
.
begin
();
it
!=
sorted_namespaces
.
end
();
it
++
)
{
code
+=
"/**
\n
* @const
\n
*/
\n
"
;
code
+=
"/**
\n
* @const
\n
* @namespace
\n
*/
\n
"
;
if
(
it
->
find
(
'.'
)
==
std
::
string
::
npos
)
{
code
+=
"var "
;
exports
+=
"this."
+
*
it
+
" = "
+
*
it
+
";
\n
"
;
...
...
tests/monster_test.bfbs
View file @
4a49493e
No preview for this file type
tests/monster_test_generated.js
View file @
4a49493e
...
...
@@ -2,22 +2,26 @@
/**
* @const
*/
* @namespace
*/
var
MyGame
=
MyGame
||
{};
/**
* @const
*/
* @namespace
*/
MyGame
.
Example
=
MyGame
.
Example
||
{};
/**
* @const
*/
* @namespace
*/
MyGame
.
Example2
=
MyGame
.
Example2
||
{};
/**
* @const
*/
* @namespace
*/
MyGame
.
OtherNameSpace
=
MyGame
.
OtherNameSpace
||
{};
/**
...
...
tests/namespace_test/namespace_test1_generated.js
View file @
4a49493e
...
...
@@ -2,12 +2,14 @@
/**
* @const
*/
* @namespace
*/
var
NamespaceA
=
NamespaceA
||
{};
/**
* @const
*/
* @namespace
*/
NamespaceA
.
NamespaceB
=
NamespaceA
.
NamespaceB
||
{};
/**
...
...
tests/namespace_test/namespace_test2_generated.js
View file @
4a49493e
...
...
@@ -2,17 +2,20 @@
/**
* @const
*/
* @namespace
*/
var
NamespaceA
=
NamespaceA
||
{};
/**
* @const
*/
* @namespace
*/
NamespaceA
.
NamespaceB
=
NamespaceA
.
NamespaceB
||
{};
/**
* @const
*/
* @namespace
*/
var
NamespaceC
=
NamespaceC
||
{};
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment