- 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:
parent
3b0b0baf05
commit
4b41e735f1
7 changed files with 101 additions and 58 deletions
|
|
@ -1450,6 +1450,14 @@ constant(X) ::= TRUE(A).
|
|||
NEW_INTCONST_NODE(boolconst, TypeBool, true, A);
|
||||
X = boolconst;
|
||||
}
|
||||
constant(X) ::= NULLPTR(A).
|
||||
{
|
||||
NEW_AST_NODE(ExprConstant, nullptrconst, A);
|
||||
nullptrconst->Operation = PEX_ConstValue;
|
||||
nullptrconst->Type = TypeNullPtr;
|
||||
nullptrconst->StringVal = nullptr;
|
||||
X = nullptrconst;
|
||||
}
|
||||
|
||||
/************ Statements ************/
|
||||
|
||||
|
|
|
|||
|
|
@ -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?
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ static void InitTokenMap()
|
|||
TOKENDEF (TK_Out, ZCC_OUT);
|
||||
TOKENDEF (TK_Optional, ZCC_OPTIONAL);
|
||||
TOKENDEF (TK_Super, ZCC_SUPER);
|
||||
TOKENDEF (TK_Null, ZCC_NULL);
|
||||
TOKENDEF (TK_Null, ZCC_NULLPTR);
|
||||
TOKENDEF (TK_Self, ZCC_SELF);
|
||||
TOKENDEF ('~', ZCC_TILDE);
|
||||
TOKENDEF ('!', ZCC_BANG);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue