Fix decorator on functions with defaults

This commit is contained in:
ben committed 2019-04-06 12:46:48 +13:00
1 parent 8535ba9a56
commit 7fffc57255
2 files changed
+13 -2

No files matched your search

+10
View File
@@ -15,6 +15,16 @@ c = add(10, 3)
assert c == 14
@logged
def add3(a, b, c=2):
return a + b + c
d = add3(12, 5)
assert d == 20
def f(func): return lambda: 42
class A: pass
a = A()
+3 -2
View File
@@ -585,6 +585,9 @@ impl Compiler {
let was_in_function_def = self.in_function_def;
self.in_loop = false;
self.in_function_def = true;
self.prepare_decorators(decorator_list)?;
let mut flags = self.enter_function(name, args)?;
let (new_body, doc_str) = get_doc(body);
@@ -598,8 +601,6 @@ impl Compiler {
self.emit(Instruction::ReturnValue);
let code = self.pop_code_object();
self.prepare_decorators(decorator_list)?;
// Prepare type annotations:
let mut num_annotations = 0;