Skip to content

Commit 4d13088

Browse files
committed
Add function decorator support
1 parent eab9360 commit 4d13088

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

monic/expressions/interpreter.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1426,6 +1426,12 @@ def visit_FunctionDef(self, node: ast.FunctionDef) -> None:
14261426
required_count=required_count,
14271427
)
14281428

1429+
# Apply decorators in reverse order
1430+
for decorator in reversed(node.decorator_list):
1431+
decorator_func = self.visit(decorator)
1432+
if decorator_func is not None:
1433+
func = decorator_func(func)
1434+
14291435
# Register the function in the current scope
14301436
self._set_name_value(node.name, func)
14311437
finally:

0 commit comments

Comments
 (0)