- added null pointer.

- fixed: FxMemberIdentifier checked for ClassPointers instead of object pointers to resolve the left hand side of the expression.
- allow comparison of pointers.
This commit is contained in:
Christoph Oelckers 2016-10-22 00:50:04 +02:00
commit 4b41e735f1
7 changed files with 101 additions and 58 deletions

View file

@ -1462,6 +1462,10 @@ PType *ZCCCompiler::ResolveUserType(ZCC_BasicType *type, PSymbolTable *symt)
{
return TypeSInt32; // hack this to an integer until we can resolve the enum mess.
}
if (type->IsKindOf(RUNTIME_CLASS(PClass)))
{
return NewPointer(type);
}
return type;
}
return TypeError;
@ -2353,6 +2357,8 @@ static FxExpression *ModifyAssign(FxBinary *operation, FxExpression *left)
FxExpression *ZCCCompiler::ConvertNode(ZCC_TreeNode *ast)
{
if (ast == nullptr) return nullptr;
// Note: Do not call 'Simplify' here because that function tends to destroy identifiers due to lack of context in which to resolve them.
// The Fx nodes created here will be better suited for that.
switch (ast->NodeType)
@ -2436,6 +2442,10 @@ FxExpression *ZCCCompiler::ConvertNode(ZCC_TreeNode *ast)
{
return new FxConstant(*cnst->StringVal, *ast);
}
else if (cnst->Type == TypeNullPtr)
{
return new FxConstant(*ast);
}
else
{
// can there be other types?