本文整理汇总了C++中CBotCStack::SetCopyVar方法的典型用法代码示例。如果您正苦于以下问题:C++ CBotCStack::SetCopyVar方法的具体用法?C++ CBotCStack::SetCopyVar怎么用?C++ CBotCStack::SetCopyVar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBotCStack
的用法示例。
在下文中一共展示了CBotCStack::SetCopyVar方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Compile
CBotInstr* CBotExprRetVar::Compile(CBotToken*& p, CBotCStack* pStack, bool bMethodsOnly)
{
if (p->GetType() == ID_DOT)
{
CBotVar* var = pStack->GetVar();
if (var == nullptr) return nullptr;
CBotCStack* pStk = pStack->TokenStack();
CBotInstr* inst = new CBotExprRetVar();
while (true)
{
pStk->SetStartError(p->GetStart());
if (var->GetType() == CBotTypArrayPointer)
{
if (bMethodsOnly) goto err;
if (IsOfType( p, ID_OPBRK ))
{
CBotIndexExpr* i = new CBotIndexExpr();
i->m_expr = CBotExpression::Compile(p, pStk);
inst->AddNext3(i);
var = var->GetItem(0,true);
if (i->m_expr == nullptr || pStk->GetType() != CBotTypInt)
{
pStk->SetError(CBotErrBadIndex, p->GetStart());
goto err;
}
if (!pStk->IsOk() || !IsOfType( p, ID_CLBRK ))
{
pStk->SetError(CBotErrCloseIndex, p->GetStart());
goto err;
}
continue;
}
}
if (var->GetType(CBotVar::GetTypeMode::CLASS_AS_POINTER) == CBotTypPointer)
{
if (IsOfType(p, ID_DOT))
{
CBotToken* pp = p;
if (p->GetType() == TokenTypVar)
{
if (p->GetNext()->GetType() == ID_OPENPAR)
{
CBotInstr* i = CBotInstrMethode::Compile(p, pStk, var, bMethodsOnly);
if (!pStk->IsOk()) goto err;
inst->AddNext3(i);
return pStack->Return(inst, pStk);
}
else if (bMethodsOnly)
{
p = p->GetPrev();
goto err;
}
else
{
CBotFieldExpr* i = new CBotFieldExpr();
i->SetToken(pp);
inst->AddNext3(i);
CBotVar* preVar = var;
var = var->GetItem(p->GetString());
if (var != nullptr)
{
i->SetUniqNum(var->GetUniqNum());
if (CBotFieldExpr::CheckProtectionError(pStk, preVar, var))
{
pStk->SetError(CBotErrPrivate, pp);
goto err;
}
}
}
if (var != nullptr)
{
p = p->GetNext();
continue;
}
pStk->SetError(CBotErrUndefItem, p);
goto err;
}
pStk->SetError(CBotErrUndefClass, p);
goto err;
}
}
break;
}
pStk->SetCopyVar(var);
if (pStk->IsOk()) return pStack->Return(inst, pStk);
pStk->SetError(CBotErrUndefVar, p);
err:
delete inst;
return pStack->Return(nullptr, pStk);
}
//.........这里部分代码省略.........