Fixed bug in scoping accessing all stack frames, not just local and
global git-svn-id: http://picoc.googlecode.com/svn/trunk@23 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
parent
704f20e1c4
commit
224a90dca3
11
parse.c
11
parse.c
|
@ -43,15 +43,10 @@ void VariableDefine(struct LexState *Lexer, const Str *Ident, struct Value *Init
|
|||
/* get the value of a variable. must be defined */
|
||||
void VariableGet(struct LexState *Lexer, Str *Ident, struct Value *Val, struct Value **LVal)
|
||||
{
|
||||
int Frame;
|
||||
|
||||
for (Frame = StackUsed-1; Frame >= 0; Frame--)
|
||||
if (TableGet(&Stack[StackUsed-1].LocalTable, Ident, LVal))
|
||||
{
|
||||
if (TableGet(&Stack[Frame].LocalTable, Ident, LVal))
|
||||
{
|
||||
*Val = **LVal;
|
||||
return;
|
||||
}
|
||||
*Val = **LVal;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!TableGet(&GlobalTable, Ident, LVal))
|
||||
|
|
Loading…
Reference in a new issue