| 4412 | |
| 4413 | |
| 4414 | void luaK_posfix (FuncState *fs, BinOpr op, expdesc *e1, expdesc *e2) { |
| 4415 | switch (op) { |
| 4416 | case OPR_AND: { |
| 4417 | lua_assert(e1->t == NO_JUMP); /* list must be closed */ |
| 4418 | luaK_dischargevars(fs, e2); |
| 4419 | luaK_concat(fs, &e2->f, e1->f); |
| 4420 | *e1 = *e2; |
| 4421 | break; |
| 4422 | } |
| 4423 | case OPR_OR: { |
| 4424 | lua_assert(e1->f == NO_JUMP); /* list must be closed */ |
| 4425 | luaK_dischargevars(fs, e2); |
| 4426 | luaK_concat(fs, &e2->t, e1->t); |
| 4427 | *e1 = *e2; |
| 4428 | break; |
| 4429 | } |
| 4430 | case OPR_CONCAT: { |
| 4431 | luaK_exp2val(fs, e2); |
| 4432 | if (e2->k == VRELOCABLE && GET_OPCODE(getcode(fs, e2)) == OP_CONCAT) { |
| 4433 | lua_assert(e1->u.s.info == GETARG_B(getcode(fs, e2))-1); |
| 4434 | freeexp(fs, e1); |
| 4435 | SETARG_B(getcode(fs, e2), e1->u.s.info); |
| 4436 | e1->k = VRELOCABLE; e1->u.s.info = e2->u.s.info; |
| 4437 | } |
| 4438 | else { |
| 4439 | luaK_exp2nextreg(fs, e2); /* operand must be on the 'stack' */ |
| 4440 | codearith(fs, OP_CONCAT, e1, e2); |
| 4441 | } |
| 4442 | break; |
| 4443 | } |
| 4444 | case OPR_ADD: codearith(fs, OP_ADD, e1, e2); break; |
| 4445 | case OPR_SUB: codearith(fs, OP_SUB, e1, e2); break; |
| 4446 | case OPR_MUL: codearith(fs, OP_MUL, e1, e2); break; |
| 4447 | case OPR_DIV: codearith(fs, OP_DIV, e1, e2); break; |
| 4448 | case OPR_MOD: codearith(fs, OP_MOD, e1, e2); break; |
| 4449 | case OPR_POW: codearith(fs, OP_POW, e1, e2); break; |
| 4450 | case OPR_EQ: codecomp(fs, OP_EQ, 1, e1, e2); break; |
| 4451 | case OPR_NE: codecomp(fs, OP_EQ, 0, e1, e2); break; |
| 4452 | case OPR_LT: codecomp(fs, OP_LT, 1, e1, e2); break; |
| 4453 | case OPR_LE: codecomp(fs, OP_LE, 1, e1, e2); break; |
| 4454 | case OPR_GT: codecomp(fs, OP_LT, 0, e1, e2); break; |
| 4455 | case OPR_GE: codecomp(fs, OP_LE, 0, e1, e2); break; |
| 4456 | default: lua_assert(0); |
| 4457 | } |
| 4458 | } |
| 4459 | |
| 4460 | |
| 4461 | void luaK_fixline (FuncState *fs, int line) { |
no test coverage detected