Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion cpp/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -1571,7 +1571,9 @@ def _get_class(self, class_type, visibility, templated_types):
# Handle attribute.
elif token.token_type == tokenize.NAME:
self._add_back_token(token)
name_tokens, token = self.get_name()
attribute, token = self.get_name()
if len(attribute) > 1 or attribute[0].name != 'final':
name_tokens = attribute
class_name = ''.join([t.name for t in name_tokens])
bases = None
if token.token_type == tokenize.SYNTAX:
Expand Down
5 changes: 5 additions & 0 deletions test_ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,11 @@ def test_struct_empty_body(self):
self.assertEqual(1, len(nodes))
self.assertEqual(Struct('Foo', body=[]), nodes[0])

def test_class_final(self):
nodes = list(MakeBuilder('class Foo final {};').generate())
self.assertEqual(1, len(nodes))
self.assertEqual(Class('Foo', body=[]), nodes[0])

def test_class_exported(self):
nodes = list(MakeBuilder('class DLLEXPORT Foo {};').generate())
self.assertEqual(1, len(nodes))
Expand Down