Fix parsing inner class declaration when "pass" keyword is on the same line

Implement a special case for allowing "pass" keyword in one-liner class
declaration, to be consistent with Python style.

```
class TestClass: pass
```

This commit fixes #56703
This commit is contained in:
Kirill Diduk 2022-06-13 14:25:08 +02:00
parent 3c35617c50
commit 5bcc3d476c
2 changed files with 62 additions and 19 deletions

View file

@ -599,6 +599,9 @@ private:
bool _parse_arguments(Node *p_parent, Vector<Node *> &p_args, bool p_static, bool p_can_codecomplete = false, bool p_parsing_constant = false);
bool _enter_indent_block(BlockNode *p_block = nullptr);
bool _enter_inner_class_indent_block();
bool _parse_colon();
bool _parse_indent_block_newlines(BlockNode *p_block = nullptr);
bool _parse_newline();
Node *_parse_expression(Node *p_parent, bool p_static, bool p_allow_assign = false, bool p_parsing_constant = false);
Node *_reduce_expression(Node *p_node, bool p_to_const = false);