Skip to content

Commit

Permalink
Merge pull request #85 from robotpy/static-inline
Browse files Browse the repository at this point in the history
Allow fields to be marked inline
  • Loading branch information
virtuald committed Nov 19, 2023
2 parents 0e732f1 + cafb594 commit f1708bf
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions cxxheaderparser/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,7 @@ class Field:
constexpr: bool = False
mutable: bool = False
static: bool = False
inline: bool = False

doxygen: typing.Optional[str] = None

Expand Down
37 changes: 37 additions & 0 deletions tests/test_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
],
)
]
)
)

0 comments on commit f1708bf

Please sign in to comment.