parent
dece19fbec
commit
ebcb124b0e
|
@ -64,10 +64,8 @@ CBotDefParam* CBotDefParam::Compile(CBotToken* &p, CBotCStack* pStack)
|
|||
if (list == nullptr) list = param;
|
||||
else list->AddNext(param); // added to the list
|
||||
|
||||
// CBotClass* pClass = nullptr;//= CBotClass::Find(p);
|
||||
param->m_typename = p->GetString();
|
||||
CBotTypResult type = param->m_type = TypeParam(p, pStack);
|
||||
// if ( type == CBotTypPointer ) type = CBotTypClass; // we must create a new object
|
||||
|
||||
if (param->m_type.GetType() > 0)
|
||||
{
|
||||
|
@ -105,7 +103,6 @@ CBotDefParam* CBotDefParam::Compile(CBotToken* &p, CBotCStack* pStack)
|
|||
|
||||
if ( type.Eq(CBotTypArrayPointer) ) type.SetType(CBotTypArrayBody);
|
||||
CBotVar* var = CBotVar::Create(pp->GetString(), type); // creates the variable
|
||||
// if ( pClass ) var->SetClass(pClass);
|
||||
var->SetInit(CBotVar::InitType::IS_POINTER); // mark initialized
|
||||
param->m_nIdent = CBotVar::NextUniqNum();
|
||||
var->SetUniqNum(param->m_nIdent);
|
||||
|
@ -151,13 +148,12 @@ bool CBotDefParam::Execute(CBotVar** ppVars, CBotStack* &pj)
|
|||
|
||||
if (useDefault || (ppVars == nullptr || ppVars[i] == nullptr))
|
||||
{
|
||||
assert(p->m_expr != nullptr);
|
||||
|
||||
useDefault = true;
|
||||
|
||||
if (!p->m_expr->Execute(pile)) return false; // interupt here
|
||||
|
||||
pVar = pile->GetVar();
|
||||
useDefault = true; // end of arguments found
|
||||
if (p->m_expr != nullptr) // has default expression ?
|
||||
{
|
||||
if (!p->m_expr->Execute(pile)) return false; // interupt here
|
||||
pVar = pile->GetVar();
|
||||
}
|
||||
}
|
||||
else
|
||||
pVar = ppVars[i];
|
||||
|
|
Loading…
Reference in New Issue