本文整理汇总了C++中Symbol::GetIsBlockVar方法的典型用法代码示例。如果您正苦于以下问题:C++ Symbol::GetIsBlockVar方法的具体用法?C++ Symbol::GetIsBlockVar怎么用?C++ Symbol::GetIsBlockVar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symbol
的用法示例。
在下文中一共展示了Symbol::GetIsBlockVar方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Assert
Symbol * Symbol::GetFuncScopeVarSym() const
{
if (!this->GetIsBlockVar())
{
return nullptr;
}
FuncInfo * parentFuncInfo = this->GetScope()->GetFunc();
if (parentFuncInfo->GetIsStrictMode())
{
return nullptr;
}
Symbol *fncScopeSym = parentFuncInfo->GetBodyScope()->FindLocalSymbol(this->GetName());
if (fncScopeSym == nullptr && parentFuncInfo->GetParamScope() != nullptr)
{
// We couldn't find the sym in the body scope, try finding it in the parameter scope.
fncScopeSym = parentFuncInfo->GetParamScope()->FindLocalSymbol(this->GetName());
}
Assert(fncScopeSym);
// Parser should have added a fake var decl node for block scoped functions in non-strict mode
// IsBlockVar() indicates a user let declared variable at function scope which
// shadows the function's var binding, thus only emit the var binding init if
// we do not have a block var symbol.
if (!fncScopeSym || fncScopeSym->GetIsBlockVar())
{
return nullptr;
}
return fncScopeSym;
}
示例2: Assert
Symbol * Symbol::GetFuncScopeVarSym() const
{
if (!this->GetIsBlockVar())
{
return nullptr;
}
FuncInfo * parentFuncInfo = this->GetScope()->GetFunc();
if (parentFuncInfo->GetIsStrictMode())
{
return nullptr;
}
Symbol *fncScopeSym = parentFuncInfo->GetBodyScope()->FindLocalSymbol(this->GetName());
if (fncScopeSym == nullptr && parentFuncInfo->GetParamScope() != nullptr)
{
// We couldn't find the sym in the body scope, try finding it in the parameter scope.
Scope* paramScope = parentFuncInfo->GetParamScope();
fncScopeSym = paramScope->FindLocalSymbol(this->GetName());
if (fncScopeSym == nullptr)
{
FuncInfo* parentParentFuncInfo = paramScope->GetEnclosingScope()->GetFunc();
if (parentParentFuncInfo->root->sxFnc.IsAsync())
{
// In the case of async functions the func-scope var sym might have
// come from the parent function parameter scope due to the syntax
// desugaring implementation of async functions.
fncScopeSym = parentParentFuncInfo->GetBodyScope()->FindLocalSymbol(this->GetName());
if (fncScopeSym == nullptr)
{
fncScopeSym = parentParentFuncInfo->GetParamScope()->FindLocalSymbol(this->GetName());
}
}
}
}
Assert(fncScopeSym);
// Parser should have added a fake var decl node for block scoped functions in non-strict mode
// IsBlockVar() indicates a user let declared variable at function scope which
// shadows the function's var binding, thus only emit the var binding init if
// we do not have a block var symbol.
if (!fncScopeSym || fncScopeSym->GetIsBlockVar())
{
return nullptr;
}
return fncScopeSym;
}