MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / luaK_exp2const

Function luaK_exp2const

lib/lua/src/lcode.c:84–107  ·  view source on GitHub ↗

** If expression is a constant, fills 'v' with its value ** and returns 1. Otherwise, returns 0. */

Source from the content-addressed store, hash-verified

82** and returns 1. Otherwise, returns 0.
83*/
84int luaK_exp2const (FuncState *fs, const expdesc *e, TValue *v) {
85 if (hasjumps(e))
86 return 0; /* not a constant */
87 switch (e->k) {
88 case VFALSE:
89 setbfvalue(v);
90 return 1;
91 case VTRUE:
92 setbtvalue(v);
93 return 1;
94 case VNIL:
95 setnilvalue(v);
96 return 1;
97 case VKSTR: {
98 setsvalue(fs->ls->L, v, e->u.strval);
99 return 1;
100 }
101 case VCONST: {
102 setobj(fs->ls->L, v, const2val(fs, e));
103 return 1;
104 }
105 default: return tonumeral(e, v);
106 }
107}
108
109
110/*

Callers 1

localstatFunction · 0.85

Calls 2

const2valFunction · 0.85
tonumeralFunction · 0.85

Tested by

no test coverage detected