Skip to content

Commit f1708bf

Browse files
authored
Merge pull request #85 from robotpy/static-inline
Allow fields to be marked inline
2 parents 0e732f1 + cafb594 commit f1708bf

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

cxxheaderparser/types.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -848,6 +848,7 @@ class Field:
848848
constexpr: bool = False
849849
mutable: bool = False
850850
static: bool = False
851+
inline: bool = False
851852

852853
doxygen: typing.Optional[str] = None
853854

tests/test_class.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3336,3 +3336,40 @@ def test_constructor_outside_class() -> None:
33363336
]
33373337
)
33383338
)
3339+
3340+
3341+
def test_class_inline_static() -> None:
3342+
content = """
3343+
struct X {
3344+
inline static bool Foo = 1;
3345+
};
3346+
"""
3347+
data = parse_string(content, cleandoc=True)
3348+
3349+
assert data == ParsedData(
3350+
namespace=NamespaceScope(
3351+
classes=[
3352+
ClassScope(
3353+
class_decl=ClassDecl(
3354+
typename=PQName(
3355+
segments=[NameSpecifier(name="X")], classkey="struct"
3356+
)
3357+
),
3358+
fields=[
3359+
Field(
3360+
access="public",
3361+
type=Type(
3362+
typename=PQName(
3363+
segments=[FundamentalSpecifier(name="bool")]
3364+
)
3365+
),
3366+
name="Foo",
3367+
value=Value(tokens=[Token(value="1")]),
3368+
static=True,
3369+
inline=True,
3370+
)
3371+
],
3372+
)
3373+
]
3374+
)
3375+
)

0 commit comments

Comments
 (0)