diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2007-03-09 15:51:32 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2007-03-09 15:51:32 -0300 |
| commit | 60bc151ed70bce0d534edcbbba4380dee4306708 (patch) | |
| tree | cf2d213bfdff1b07d409054de4889d9dc9bc59aa | |
| parent | 3b19bd4d5768224b80fbc4983167821ada3f4485 (diff) | |
| download | lua-60bc151ed70bce0d534edcbbba4380dee4306708.tar.gz lua-60bc151ed70bce0d534edcbbba4380dee4306708.tar.bz2 lua-60bc151ed70bce0d534edcbbba4380dee4306708.zip | |
patch for last bug
| -rw-r--r-- | bugs | 40 |
1 files changed, 39 insertions, 1 deletions
| @@ -1252,7 +1252,45 @@ print(2 * v251.k1, v251.k1 * 2); -- 2 2, OK | |||
| 1252 | v253=1; | 1252 | v253=1; |
| 1253 | print(2 * v251.k1, v251.k1 * 2); -- 1 2, ??? | 1253 | print(2 * v251.k1, v251.k1 * 2); -- 1 2, ??? |
| 1254 | ]], | 1254 | ]], |
| 1255 | patch = [[no patch yet]], | 1255 | patch = [[ |
| 1256 | *lcode.c: | ||
| 1257 | @@ -657,10 +657,16 @@ | ||
| 1258 | if (constfolding(op, e1, e2)) | ||
| 1259 | return; | ||
| 1260 | else { | ||
| 1261 | - int o1 = luaK_exp2RK(fs, e1); | ||
| 1262 | int o2 = (op != OP_UNM && op != OP_LEN) ? luaK_exp2RK(fs, e2) : 0; | ||
| 1263 | - freeexp(fs, e2); | ||
| 1264 | - freeexp(fs, e1); | ||
| 1265 | + int o1 = luaK_exp2RK(fs, e1); | ||
| 1266 | + if (o1 > o2) { | ||
| 1267 | + freeexp(fs, e1); | ||
| 1268 | + freeexp(fs, e2); | ||
| 1269 | + } | ||
| 1270 | + else { | ||
| 1271 | + freeexp(fs, e2); | ||
| 1272 | + freeexp(fs, e1); | ||
| 1273 | + } | ||
| 1274 | e1->u.s.info = luaK_codeABC(fs, op, 0, o1, o2); | ||
| 1275 | e1->k = VRELOCABLE; | ||
| 1276 | } | ||
| 1277 | @@ -718,10 +724,15 @@ | ||
| 1278 | luaK_exp2nextreg(fs, v); /* operand must be on the `stack' */ | ||
| 1279 | break; | ||
| 1280 | } | ||
| 1281 | - default: { | ||
| 1282 | + case OPR_ADD: case OPR_SUB: case OPR_MUL: case OPR_DIV: | ||
| 1283 | + case OPR_MOD: case OPR_POW: { | ||
| 1284 | if (!isnumeral(v)) luaK_exp2RK(fs, v); | ||
| 1285 | break; | ||
| 1286 | } | ||
| 1287 | + default: { | ||
| 1288 | + luaK_exp2RK(fs, v); | ||
| 1289 | + break; | ||
| 1290 | + } | ||
| 1291 | } | ||
| 1292 | } | ||
| 1293 | ]], | ||
| 1256 | } | 1294 | } |
| 1257 | 1295 | ||
| 1258 | Bug{ | 1296 | Bug{ |
