コミットメタ情報

リビジョン2246c6102fedd085600f9afa734cdde2ea5ba2a2 (tree)
日時2018-10-19 10:15:14
作者Agustina Arzille <avarzille@rise...>
コミッターAgustina Arzille

ログメッセージ

Fix copying of functions

変更サマリ

差分

diff -r bd7e6327a232 -r 2246c6102fed builtins.cpp
--- a/builtins.cpp Thu Oct 18 18:59:12 2018 -0300
+++ b/builtins.cpp Fri Oct 19 01:15:14 2018 +0000
@@ -999,9 +999,7 @@
999999 else
10001000 { // Copy the function with the new name.
10011001 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);
10051003 f2->name = *argv;
10061004 argv[2] = f2->as_obj ();
10071005 }
diff -r bd7e6327a232 -r 2246c6102fed eval.cpp
--- a/eval.cpp Thu Oct 18 18:59:12 2018 -0300
+++ b/eval.cpp Fri Oct 19 01:15:14 2018 +0000
@@ -891,15 +891,7 @@
891891 OP_(CLOSURE):
892892 {
893893 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);
903895
904896 r_stkend(1) = fp->as_obj ();
905897 fp->env = captenv (interp, lastf);
diff -r bd7e6327a232 -r 2246c6102fed function.h
--- a/function.h Thu Oct 18 18:59:12 2018 -0300
+++ b/function.h Fri Oct 19 01:15:14 2018 +0000
@@ -62,6 +62,17 @@
6262 this->min_argc, this->max_argc, __n);
6363 }
6464
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+
6576 void local_init ()
6677 {
6778 this->full = 0;
旧リポジトリブラウザで表示