(e exprDesc)
| 708 | } |
| 709 | |
| 710 | func (f *function) expressionToRegisterOrConstant(e exprDesc) (exprDesc, int) { |
| 711 | switch e = f.ExpressionToValue(e); e.kind { |
| 712 | case kindTrue, kindFalse: |
| 713 | if len(f.f.constants) <= maxIndexRK { |
| 714 | e.info, e.kind = f.booleanConstant(e.kind == kindTrue), kindConstant |
| 715 | return e, asConstant(e.info) |
| 716 | } |
| 717 | case kindNil: |
| 718 | if len(f.f.constants) <= maxIndexRK { |
| 719 | e.info, e.kind = f.nilConstant(), kindConstant |
| 720 | return e, asConstant(e.info) |
| 721 | } |
| 722 | case kindNumber: |
| 723 | e.info, e.kind = f.NumberConstant(e.value), kindConstant |
| 724 | fallthrough |
| 725 | case kindConstant: |
| 726 | if e.info <= maxIndexRK { |
| 727 | return e, asConstant(e.info) |
| 728 | } |
| 729 | } |
| 730 | e = f.ExpressionToAnyRegister(e) |
| 731 | return e, e.info |
| 732 | } |
| 733 | |
| 734 | func (f *function) StoreVariable(v, e exprDesc) { |
| 735 | switch v.kind { |
no test coverage detected