diff options
author | Mike Pall <mike> | 2013-12-22 11:43:44 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2013-12-22 11:43:44 +0100 |
commit | 89e8d7070169d11e7f188754006e03a40699c5dc (patch) | |
tree | 16edf68529deabc01dd59b4592c9333264968379 /src/lj_ffrecord.c | |
parent | 279673ddfcff8e82cac0704d371ed405ad7a229b (diff) | |
download | luajit2-89e8d7070169d11e7f188754006e03a40699c5dc.tar.gz |
Fix compilation of string.byte(s, nil, n).
Diffstat (limited to 'src/lj_ffrecord.c')
-rw-r--r-- | src/lj_ffrecord.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/lj_ffrecord.c b/src/lj_ffrecord.c index 35e2e88e..693fd297 100644 --- a/src/lj_ffrecord.c +++ b/src/lj_ffrecord.c @@ -657,20 +657,19 @@ static void LJ_FASTCALL recff_string_range(jit_State *J, RecordFFData *rd) end = argv2int(J, &rd->argv[2]); } } else { /* string.byte(str, [,start [,end]]) */ - if (!tref_isnil(J->base[1])) { + if (tref_isnil(J->base[1])) { + start = 1; + trstart = lj_ir_kint(J, 1); + } else { start = argv2int(J, &rd->argv[1]); trstart = lj_opt_narrow_toint(J, J->base[1]); - trend = J->base[2]; - if (tref_isnil(trend)) { - trend = trstart; - end = start; - } else { - trend = lj_opt_narrow_toint(J, trend); - end = argv2int(J, &rd->argv[2]); - } + } + if (J->base[1] && !tref_isnil(J->base[2])) { + trend = lj_opt_narrow_toint(J, J->base[2]); + end = argv2int(J, &rd->argv[2]); } else { - trend = trstart = lj_ir_kint(J, 1); - end = start = 1; + trend = trstart; + end = start; } } if (end < 0) { |