- no more Simplify for global constants as well.
This commit is contained in:
parent
061ba48dc1
commit
68c3f42a53
6 changed files with 102 additions and 43 deletions
|
|
@ -5829,7 +5829,7 @@ FxExpression *FxIdentifier::ResolveMember(FCompileContext &ctx, PStruct *classct
|
|||
return x->Resolve(ctx);
|
||||
}
|
||||
|
||||
if ((sym = objtype->Symbols.FindSymbolInTable(Identifier, symtbl)) != nullptr)
|
||||
if (objtype != nullptr && (sym = objtype->Symbols.FindSymbolInTable(Identifier, symtbl)) != nullptr)
|
||||
{
|
||||
if (sym->IsKindOf(RUNTIME_CLASS(PSymbolConst)))
|
||||
{
|
||||
|
|
@ -7168,7 +7168,6 @@ static bool CheckArgSize(FName fname, FArgumentList &args, int min, int max, FSc
|
|||
|
||||
FxExpression *FxFunctionCall::Resolve(FCompileContext& ctx)
|
||||
{
|
||||
ABORT(ctx.Class);
|
||||
bool error = false;
|
||||
|
||||
for (auto a : ArgList)
|
||||
|
|
@ -7181,27 +7180,30 @@ FxExpression *FxFunctionCall::Resolve(FCompileContext& ctx)
|
|||
}
|
||||
}
|
||||
|
||||
PFunction *afd = FindClassMemberFunction(ctx.Class, ctx.Class, MethodName, ScriptPosition, &error);
|
||||
|
||||
if (afd != nullptr)
|
||||
if (ctx.Class != nullptr)
|
||||
{
|
||||
if (ctx.Function == nullptr)
|
||||
{
|
||||
ScriptPosition.Message(MSG_ERROR, "Unable to call function %s from constant declaration", MethodName.GetChars());
|
||||
delete this;
|
||||
return nullptr;
|
||||
}
|
||||
PFunction *afd = FindClassMemberFunction(ctx.Class, ctx.Class, MethodName, ScriptPosition, &error);
|
||||
|
||||
if (!CheckFunctionCompatiblity(ScriptPosition, ctx.Function, afd))
|
||||
if (afd != nullptr)
|
||||
{
|
||||
delete this;
|
||||
return nullptr;
|
||||
}
|
||||
if (ctx.Function == nullptr)
|
||||
{
|
||||
ScriptPosition.Message(MSG_ERROR, "Unable to call function %s from constant declaration", MethodName.GetChars());
|
||||
delete this;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto self = (afd->Variants[0].Flags & VARF_Method)? new FxSelf(ScriptPosition) : nullptr;
|
||||
auto x = new FxVMFunctionCall(self, afd, ArgList, ScriptPosition, false);
|
||||
delete this;
|
||||
return x->Resolve(ctx);
|
||||
if (!CheckFunctionCompatiblity(ScriptPosition, ctx.Function, afd))
|
||||
{
|
||||
delete this;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto self = (afd->Variants[0].Flags & VARF_Method) ? new FxSelf(ScriptPosition) : nullptr;
|
||||
auto x = new FxVMFunctionCall(self, afd, ArgList, ScriptPosition, false);
|
||||
delete this;
|
||||
return x->Resolve(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < countof(FxFlops); ++i)
|
||||
|
|
@ -7228,7 +7230,7 @@ FxExpression *FxFunctionCall::Resolve(FCompileContext& ctx)
|
|||
if (special != 0 && min >= 0)
|
||||
{
|
||||
int paramcount = ArgList.Size();
|
||||
if (ctx.Function == nullptr)
|
||||
if (ctx.Function == nullptr || ctx.Class == nullptr)
|
||||
{
|
||||
ScriptPosition.Message(MSG_ERROR, "Unable to call action special %s from constant declaration", MethodName.GetChars());
|
||||
delete this;
|
||||
|
|
@ -7459,13 +7461,20 @@ FxMemberFunctionCall::~FxMemberFunctionCall()
|
|||
|
||||
FxExpression *FxMemberFunctionCall::Resolve(FCompileContext& ctx)
|
||||
{
|
||||
ABORT(ctx.Class);
|
||||
PStruct *cls;
|
||||
bool staticonly = false;
|
||||
bool novirtual = false;
|
||||
|
||||
PStruct *ccls = nullptr;
|
||||
|
||||
if (ctx.Class == nullptr)
|
||||
{
|
||||
// There's no way that a member function call can resolve to a constant so abort right away.
|
||||
ScriptPosition.Message(MSG_ERROR, "Expression is not constant.");
|
||||
delete this;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
for (auto a : ArgList)
|
||||
{
|
||||
if (a == nullptr)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue