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:
zik.saleeba 2009-04-15 05:26:46 +00:00
parent 031edfb7ab
commit 8339e586d1

View file

@ -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");
}