Merge pull request #85 from robotpy/static-inline

Allow fields to be marked inline
This commit is contained in:
Dustin Spicuzza 2023-11-19 12:50:09 -05:00 committed by GitHub
commit f1708bf9b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 0 deletions

View File

@ -848,6 +848,7 @@ class Field:
constexpr: bool = False
mutable: bool = False
static: bool = False
inline: bool = False
doxygen: typing.Optional[str] = None

View File

@ -3336,3 +3336,40 @@ def test_constructor_outside_class() -> None:
]
)
)
def test_class_inline_static() -> None:
content = """
struct X {
inline static bool Foo = 1;
};
"""
data = parse_string(content, cleandoc=True)
assert data == ParsedData(
namespace=NamespaceScope(
classes=[
ClassScope(
class_decl=ClassDecl(
typename=PQName(
segments=[NameSpecifier(name="X")], classkey="struct"
)
),
fields=[
Field(
access="public",
type=Type(
typename=PQName(
segments=[FundamentalSpecifier(name="bool")]
)
),
name="Foo",
value=Value(tokens=[Token(value="1")]),
static=True,
inline=True,
)
],
)
]
)
)