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

Function searchvar

lib/lua/src/lparser.c:390–403  ·  view source on GitHub ↗

** Look for an active local variable with the name 'n' in the ** function 'fs'. If found, initialize 'var' with it and return ** its expression kind; otherwise return -1. */

Source from the content-addressed store, hash-verified

388** its expression kind; otherwise return -1.
389*/
390static int searchvar (FuncState *fs, TString *n, expdesc *var) {
391 int i;
392 for (i = cast_int(fs->nactvar) - 1; i >= 0; i--) {
393 Vardesc *vd = getlocalvardesc(fs, i);
394 if (eqstr(n, vd->vd.name)) { /* found? */
395 if (vd->vd.kind == RDKCTC) /* compile-time constant? */
396 init_exp(var, VCONST, fs->firstlocal + i);
397 else /* real variable */
398 init_var(fs, var, i);
399 return var->k;
400 }
401 }
402 return -1; /* not found */
403}
404
405
406/*

Callers 1

singlevarauxFunction · 0.85

Calls 3

getlocalvardescFunction · 0.85
init_expFunction · 0.85
init_varFunction · 0.85

Tested by

no test coverage detected