lua

A copy of the Lua development repository
Log | Files | Refs | README

commit 5951c79ae12b31556f8a64886b1d7fd0801d7889
parent e381c582de1b80a5f3df2c0d36fc25b415b48de0
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Thu, 25 Apr 2013 16:34:54 -0300

default increment for 'for' loop is an integer (1, not 1.0)

Diffstat:
Mlcode.c | 6+++---
Mlcode.h | 4++--
Mlparser.c | 4++--
3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/lcode.c b/lcode.c @@ -1,5 +1,5 @@ /* -** $Id: lcode.c,v 2.63 2013/04/15 15:43:34 roberto Exp roberto $ +** $Id: lcode.c,v 2.64 2013/04/16 18:46:28 roberto Exp roberto $ ** Code generator for Lua ** See Copyright Notice in lua.h */ @@ -322,14 +322,14 @@ int luaK_stringK (FuncState *fs, TString *s) { } -static int luaK_intK (FuncState *fs, lua_Integer n) { +int luaK_intK (FuncState *fs, lua_Integer n) { TValue o; setivalue(&o, n); return addk(fs, &o, &o); } -int luaK_numberK (FuncState *fs, lua_Number r) { +static int luaK_numberK (FuncState *fs, lua_Number r) { int n; lua_State *L = fs->ls->L; TValue o; diff --git a/lcode.h b/lcode.h @@ -1,5 +1,5 @@ /* -** $Id: lcode.h,v 1.57 2011/04/07 18:14:12 roberto Exp roberto $ +** $Id: lcode.h,v 1.58 2011/08/30 16:26:41 roberto Exp roberto $ ** Code generator for Lua ** See Copyright Notice in lua.h */ @@ -52,7 +52,7 @@ LUAI_FUNC void luaK_nil (FuncState *fs, int from, int n); LUAI_FUNC void luaK_reserveregs (FuncState *fs, int n); LUAI_FUNC void luaK_checkstack (FuncState *fs, int n); LUAI_FUNC int luaK_stringK (FuncState *fs, TString *s); -LUAI_FUNC int luaK_numberK (FuncState *fs, lua_Number r); +LUAI_FUNC int luaK_intK (FuncState *fs, lua_Integer n); LUAI_FUNC void luaK_dischargevars (FuncState *fs, expdesc *e); LUAI_FUNC int luaK_exp2anyreg (FuncState *fs, expdesc *e); LUAI_FUNC void luaK_exp2anyregup (FuncState *fs, expdesc *e); diff --git a/lparser.c b/lparser.c @@ -1,5 +1,5 @@ /* -** $Id: lparser.c,v 2.130 2013/02/06 13:37:39 roberto Exp roberto $ +** $Id: lparser.c,v 2.131 2013/04/16 18:46:28 roberto Exp roberto $ ** Lua Parser ** See Copyright Notice in lua.h */ @@ -1326,7 +1326,7 @@ static void fornum (LexState *ls, TString *varname, int line) { if (testnext(ls, ',')) exp1(ls); /* optional step */ else { /* default step = 1 */ - luaK_codek(fs, fs->freereg, luaK_numberK(fs, 1)); + luaK_codek(fs, fs->freereg, luaK_intK(fs, 1)); luaK_reserveregs(fs, 1); } forbody(ls, base, line, 1, 1);