Fix multi-line comments for cpp enums (#5345) (#5346)

- fix CSharp comments generation
- fix Python comments generation
- fix Lua comments generation
- fix PHP comments generation
- fix Dart comments generation
- add brief description of Color enum
- add multi-line comments to the Monster:Color
This commit is contained in:
Vladimir Glavnyy
2019-06-03 02:36:49 +07:00
committed by Wouter van Oortmerssen
parent bc7ede8fb3
commit 95004218f7
28 changed files with 151 additions and 62 deletions

View File

@@ -7,10 +7,10 @@ namespace MyGame.Example
public enum Any : byte
{
NONE = 0,
Monster = 1,
TestSimpleTableWithEnum = 2,
MyGame_Example2_Monster = 3,
NONE = 0,
Monster = 1,
TestSimpleTableWithEnum = 2,
MyGame_Example2_Monster = 3,
};

View File

@@ -7,10 +7,10 @@ namespace MyGame.Example
public enum AnyAmbiguousAliases : byte
{
NONE = 0,
M1 = 1,
M2 = 2,
M3 = 3,
NONE = 0,
M1 = 1,
M2 = 2,
M3 = 3,
};

View File

@@ -7,10 +7,10 @@ namespace MyGame.Example
public enum AnyUniqueAliases : byte
{
NONE = 0,
M = 1,
TS = 2,
M2 = 3,
NONE = 0,
M = 1,
TS = 2,
M2 = 3,
};

View File

@@ -5,12 +5,16 @@
namespace MyGame.Example
{
/// Composite components of Monster color.
[System.FlagsAttribute]
public enum Color : byte
{
Red = 1,
Green = 2,
Blue = 8,
Red = 1,
/// \brief color Green
/// Green is bit_flag with value (1u << 1)
Green = 2,
/// \brief color Blue (1u << 3)
Blue = 8,
};

View File

@@ -4,11 +4,15 @@ package Example
import "strconv"
/// Composite components of Monster color.
type Color byte
const (
ColorRed Color = 1
/// \brief color Green
/// Green is bit_flag with value (1u << 1)
ColorGreen Color = 2
/// \brief color Blue (1u << 3)
ColorBlue Color = 8
)

View File

@@ -2,10 +2,20 @@
package MyGame.Example;
/**
* Composite components of Monster color.
*/
public final class Color {
private Color() { }
public static final byte Red = 1;
/**
* \brief color Green
* Green is bit_flag with value (1u << 1)
*/
public static final byte Green = 2;
/**
* \brief color Blue (1u << 3)
*/
public static final byte Blue = 8;
public static final String[] names = { "Red", "Green", "", "", "", "", "", "Blue", };

View File

@@ -2,9 +2,13 @@
-- namespace: Example
-- Composite components of Monster color.
local Color = {
Red = 1,
-- \brief color Green
-- Green is bit_flag with value (1u << 1)
Green = 2,
-- \brief color Blue (1u << 3)
Blue = 8,
}

View File

@@ -3,10 +3,14 @@
namespace MyGame\Example;
/// Composite components of Monster color.
class Color
{
const Red = 1;
/// \brief color Green
/// Green is bit_flag with value (1u << 1)
const Green = 2;
/// \brief color Blue (1u << 3)
const Blue = 8;
private static $names = array(

View File

@@ -2,8 +2,12 @@
# namespace: Example
# Composite components of Monster color.
class Color(object):
Red = 1
# \brief color Green
# Green is bit_flag with value (1u << 1)
Green = 2
# \brief color Blue (1u << 3)
Blue = 8

View File

@@ -4,7 +4,7 @@
local flatbuffers = require('flatbuffers')
-- /// an example documentation comment: monster object
-- an example documentation comment: monster object
local Monster = {} -- the module
local Monster_mt = {} -- the class metatable
@@ -120,8 +120,8 @@ function Monster_mt:TestarrayofstringLength()
end
return 0
end
-- /// an example documentation comment: this will end up in the generated code
-- /// multiline too
-- an example documentation comment: this will end up in the generated code
-- multiline too
function Monster_mt:Testarrayoftables(j)
local o = self.view:Offset(26)
if o ~= 0 then

View File

@@ -171,8 +171,8 @@ class Monster extends Table
return $o != 0 ? $this->__vector_len($o) : 0;
}
/// an example documentation comment: this will end up in the generated code
/// multiline too
/// an example documentation comment: this will end up in the generated code
/// multiline too
/**
* @returnVectorOffset
*/

View File

@@ -4,7 +4,7 @@
import flatbuffers
# /// an example documentation comment: monster object
# an example documentation comment: monster object
class Monster(object):
__slots__ = ['_tab']
@@ -131,8 +131,8 @@ class Monster(object):
return self._tab.VectorLen(o)
return 0
# /// an example documentation comment: this will end up in the generated code
# /// multiline too
# an example documentation comment: this will end up in the generated code
# multiline too
# Monster
def Testarrayoftables(self, j):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))