fix class in local scope

This commit is contained in:
blueloveTH 2025-02-28 19:19:22 +08:00
parent e1373766b1
commit 68273017b8

View File

@ -2317,6 +2317,7 @@ static Error* compile_function(Compiler* self, int decorators) {
static Error* compile_class(Compiler* self, int decorators) { static Error* compile_class(Compiler* self, int decorators) {
Error* err; Error* err;
if(ctx()->level > 1) return SyntaxError(self, "class definition not allowed here");
consume(TK_ID); consume(TK_ID);
py_Name name = py_namev(Token__sv(prev())); py_Name name = py_namev(Token__sv(prev()));
bool has_base = false; bool has_base = false;