本文整理汇总了C++中AstName::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ AstName::empty方法的具体用法?C++ AstName::empty怎么用?C++ AstName::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AstName
的用法示例。
在下文中一共展示了AstName::empty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
static bool
RenderElemSection(WasmRenderContext& c, const AstModule& module)
{
for (const AstElemSegment* segment : module.elemSegments()) {
if (!RenderIndent(c))
return false;
if (!c.buffer.append("(elem "))
return false;
if (!RenderInlineExpr(c, *segment->offset()))
return false;
for (const AstRef& elem : segment->elems()) {
if (!c.buffer.append(" "))
return false;
uint32_t index = elem.index();
AstName name = index < module.funcImportNames().length()
? module.funcImportNames()[index]
: module.funcs()[index - module.funcImportNames().length()]->name();
if (name.empty()) {
if (!RenderInt32(c, index))
return false;
} else {
if (!RenderName(c, name))
return false;
}
}
if (!c.buffer.append(")\n"))
return false;
}
return true;
}
示例2: AstDecodeFail
static bool
AstDecodeImport(AstDecodeContext& c, uint32_t importIndex, AstImport** import)
{
uint32_t sigIndex = AstNoIndex;
if (!AstDecodeSignatureIndex(c, &sigIndex))
return false;
AstRef sigRef;
if (!AstDecodeGenerateRef(c, AstName(MOZ_UTF16("$type$"), 6), sigIndex, &sigRef))
return false;
AstName moduleName;
if (!AstDecodeName(c, &moduleName))
return AstDecodeFail(c, "expected import module name");
if (moduleName.empty())
return AstDecodeFail(c, "module name cannot be empty");
AstName funcName;
if (!AstDecodeName(c, &funcName))
return AstDecodeFail(c, "expected import func name");
AstName importName;
if (!AstDecodeGenerateName(c, AstName(MOZ_UTF16("$import$"), 8), importIndex, &importName))
return false;
*import = new(c.lifo) AstImport(importName, moduleName, funcName, sigRef);
if (!*import)
return false;
return true;
}
示例3: switch
static bool
RenderExport(WasmRenderContext& c, AstExport& export_,
const AstModule::NameVector& funcImportNames,
const AstModule::FuncVector& funcs)
{
if (!RenderIndent(c))
return false;
if (!c.buffer.append("(export \""))
return false;
if (!RenderEscapedString(c, export_.name()))
return false;
if (!c.buffer.append("\" "))
return false;
switch (export_.kind()) {
case DefinitionKind::Function: {
uint32_t index = export_.ref().index();
AstName name = index < funcImportNames.length()
? funcImportNames[index]
: funcs[index - funcImportNames.length()]->name();
if (name.empty()) {
if (!RenderInt32(c, index))
return false;
} else {
if (!RenderName(c, name))
return false;
}
break;
}
case DefinitionKind::Table: {
if (!c.buffer.append("table"))
return false;
break;
}
case DefinitionKind::Memory: {
if (!c.buffer.append("memory"))
return false;
break;
}
case DefinitionKind::Global: {
if (!c.buffer.append("global"))
return false;
if (!RenderRef(c, export_.ref()))
return false;
break;
}
}
return c.buffer.append(")\n");
}
示例4:
static bool
AstDecodeGenerateRef(AstDecodeContext& c, const AstName& prefix, uint32_t index, AstRef* ref)
{
MOZ_ASSERT(index != AstNoIndex);
if (!c.generateNames) {
*ref = AstRef(AstName(), index);
return true;
}
AstName name;
if (!AstDecodeGenerateName(c, prefix, index, &name))
return false;
MOZ_ASSERT(!name.empty());
*ref = AstRef(name, AstNoIndex);
ref->setIndex(index);
return true;
}