Skip to content

Commit 4a1fd29

Browse files
committed
Suggested fix from Radford Neal
1 parent dfa4208 commit 4a1fd29

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/reassign.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ SEXP reassign_function(SEXP name, SEXP env, SEXP old_fun, SEXP new_fun)
1111
if (TYPEOF(old_fun) != CLOSXP) error("old_fun must be a function");
1212
if (TYPEOF(new_fun) != CLOSXP) error("new_fun must be a function");
1313

14-
FORMALS(old_fun) = FORMALS(new_fun);
15-
BODY(old_fun) = BODY(new_fun);
16-
CLOENV(old_fun) = CLOENV(new_fun);
14+
SET_FORMALS(old_fun, FORMALS(new_fun));
15+
SET_BODY(old_fun, BODY(new_fun));
16+
SET_CLOENV(old_fun, CLOENV(new_fun));
1717
DUPLICATE_ATTRIB(old_fun, new_fun);
1818

1919
return R_NilValue;

0 commit comments

Comments
 (0)