aboutsummaryrefslogtreecommitdiff
path: root/lcode.c
diff options
context:
space:
mode:
Diffstat (limited to 'lcode.c')
-rw-r--r--lcode.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lcode.c b/lcode.c
index cafe265e..f74223eb 100644
--- a/lcode.c
+++ b/lcode.c
@@ -785,6 +785,15 @@ void luaK_setoneret (FuncState *fs, expdesc *e) {
785 } 785 }
786} 786}
787 787
788/*
789** Change a vararg parameter into a regular local variable
790*/
791void luaK_vapar2local (FuncState *fs, expdesc *var) {
792 fs->f->flag |= PF_VATAB; /* function will need a vararg table */
793 /* now a vararg parameter is equivalent to a regular local variable */
794 var->k = VLOCAL;
795}
796
788 797
789/* 798/*
790** Ensure that expression 'e' is not a variable (nor a <const>). 799** Ensure that expression 'e' is not a variable (nor a <const>).
@@ -796,6 +805,9 @@ void luaK_dischargevars (FuncState *fs, expdesc *e) {
796 const2exp(const2val(fs, e), e); 805 const2exp(const2val(fs, e), e);
797 break; 806 break;
798 } 807 }
808 case VVARGVAR: {
809 luaK_vapar2local(fs, e); /* turn it into a local variable */
810 } /* FALLTHROUGH */
799 case VLOCAL: { /* already in a register */ 811 case VLOCAL: { /* already in a register */
800 int temp = e->u.var.ridx; 812 int temp = e->u.var.ridx;
801 e->u.info = temp; /* (can't do a direct assignment; values overlap) */ 813 e->u.info = temp; /* (can't do a direct assignment; values overlap) */