1 /* $Header: //info.ravenbrook.com/project/jili/version/1.1/code/mnj/lua/Expdesc.java#1 $
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject
11 * to the following conditions:
13 * The above copyright notice and this permission notice shall be
14 * included in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
20 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
21 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 /** Equivalent to struct expdesc. */
31 static final int VVOID
= 0; // no value
32 static final int VNIL
= 1;
33 static final int VTRUE
= 2;
34 static final int VFALSE
= 3;
35 static final int VK
= 4; // info = index into 'k'
36 static final int VKNUM
= 5; // nval = numerical value
37 static final int VLOCAL
= 6; // info = local register
38 static final int VUPVAL
= 7; // info = index into 'upvalues'
39 static final int VGLOBAL
= 8; // info = index of table;
40 // aux = index of global name in 'k'
41 static final int VINDEXED
= 9; // info = table register
42 // aux = index register (or 'k')
43 static final int VJMP
= 10; // info = instruction pc
44 static final int VRELOCABLE
= 11; // info = instruction pc
45 static final int VNONRELOC
= 12; // info = result register
46 static final int VCALL
= 13; // info = instruction pc
47 static final int VVARARG
= 14; // info = instruction pc
49 int k
; // one of V* enums above
65 /** Equivalent to init_exp from lparser.c */
66 void init(int kind
, int i
)
68 this.t
= FuncState
.NO_JUMP
;
69 this.f
= FuncState
.NO_JUMP
;
76 // Must initialise all members of this.
90 void setKind(int kind
)
115 void setNval(double d
)
120 /** Equivalent to hasmultret from lparser.c */
123 return k
== VCALL
|| k
== VVARARG
;
126 /** Equivalent to hasjumps from lcode.c. */