リビジョン | 2246c6102fedd085600f9afa734cdde2ea5ba2a2 (tree) |
---|---|
日時 | 2018-10-19 10:15:14 |
作者 | Agustina Arzille <avarzille@rise...> |
コミッター | Agustina Arzille |
Fix copying of functions
@@ -999,9 +999,7 @@ | ||
999 | 999 | else |
1000 | 1000 | { // Copy the function with the new name. |
1001 | 1001 | function *f2 = as_fct (alloc_fct (interp)); |
1002 | - f2->bcode = fp->bcode; | |
1003 | - f2->vals = fp->vals; | |
1004 | - f2->env = fp->env; | |
1002 | + fp->copy_into (f2); | |
1005 | 1003 | f2->name = *argv; |
1006 | 1004 | argv[2] = f2->as_obj (); |
1007 | 1005 | } |
@@ -891,15 +891,7 @@ | ||
891 | 891 | OP_(CLOSURE): |
892 | 892 | { |
893 | 893 | function *fp = as_fct (alloc_fct (interp)); |
894 | - const auto infct = as_fct (r_stkend (1)); | |
895 | - | |
896 | - // XXX: Other flags here. | |
897 | - fp->full = infct->full | (infct->full & function::kwargs_flag); | |
898 | - fp->max_sp = infct->max_sp; | |
899 | - fp->min_argc = infct->min_argc; | |
900 | - fp->max_argc = infct->max_argc; | |
901 | - fp->bcode = infct->bcode; | |
902 | - fp->vals = infct->vals; | |
894 | + as_fct(r_stkend (1))->copy_into (fp); | |
903 | 895 | |
904 | 896 | r_stkend(1) = fp->as_obj (); |
905 | 897 | fp->env = captenv (interp, lastf); |
@@ -62,6 +62,17 @@ | ||
62 | 62 | this->min_argc, this->max_argc, __n); |
63 | 63 | } |
64 | 64 | |
65 | + void copy_into (function *__fp) | |
66 | + { | |
67 | + __fp->full |= this->full & function::kwargs_flag; // XXX: Other flags. | |
68 | + __fp->max_sp = this->max_sp; | |
69 | + __fp->min_argc = this->min_argc; | |
70 | + __fp->max_argc = this->max_argc; | |
71 | + __fp->bcode = this->bcode; | |
72 | + __fp->vals = this->vals; | |
73 | + __fp->env = this->env; | |
74 | + } | |
75 | + | |
65 | 76 | void local_init () |
66 | 77 | { |
67 | 78 | this->full = 0; |