Fixed a problem with assignment of non-numeric types
git-svn-id: http://picoc.googlecode.com/svn/trunk@242 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
parent
031edfb7ab
commit
8339e586d1
12
expression.c
12
expression.c
|
@ -938,6 +938,18 @@ XXX - finish this
|
|||
ExpressionPushPointer(Parser, StackTop, ResultInt);
|
||||
}
|
||||
#endif
|
||||
else if (Op == TokenAssign)
|
||||
{
|
||||
/* assign a non-numeric type */
|
||||
if (!BottomValue->IsLValue)
|
||||
ProgramFail(Parser, "can't assign to this");
|
||||
|
||||
if (BottomValue->Typ != TopValue->Typ)
|
||||
ProgramFail(Parser, "can't assign to a different type of variable");
|
||||
|
||||
memcpy(BottomValue->Val, TopValue->Val, TypeSizeValue(TopValue));
|
||||
ExpressionStackPushValue(Parser, StackTop, TopValue);
|
||||
}
|
||||
else
|
||||
ProgramFail(Parser, "invalid operation");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue