Finish implementing function pointers
Allow using function literals with function pointers, allow narrowing classes parameter types, and widening classes in return types, allow pointers to non-static, non-virtual functions, add null checking to function calls
This commit is contained in:
parent
23c21b23c3
commit
e61bd10bbf
8 changed files with 244 additions and 20 deletions
|
|
@ -513,6 +513,13 @@ public:
|
|||
ValueType = value.Type = TypeVMFunction;
|
||||
isresolved = true;
|
||||
}
|
||||
|
||||
FxConstant(PFunction* rawptr, const FScriptPosition& pos) : FxExpression(EFX_Constant, pos)
|
||||
{
|
||||
value.pointer = rawptr;
|
||||
ValueType = value.Type = TypeRawFunction;
|
||||
isresolved = true;
|
||||
}
|
||||
|
||||
FxConstant(const FScriptPosition &pos) : FxExpression(EFX_Constant, pos)
|
||||
{
|
||||
|
|
@ -558,6 +565,8 @@ public:
|
|||
return value;
|
||||
}
|
||||
ExpEmit Emit(VMFunctionBuilder *build);
|
||||
|
||||
friend class FxTypeCast;
|
||||
};
|
||||
|
||||
//==========================================================================
|
||||
|
|
@ -736,6 +745,8 @@ public:
|
|||
FxExpression *Resolve(FCompileContext&);
|
||||
|
||||
ExpEmit Emit(VMFunctionBuilder *build);
|
||||
|
||||
static FxConstant * convertRawFunctionToFunctionPointer(FxExpression * in, FScriptPosition &ScriptPosition);
|
||||
};
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue