本文整理汇总了C++中gc::asRecordPattern方法的典型用法代码示例。如果您正苦于以下问题:C++ gc::asRecordPattern方法的具体用法?C++ gc::asRecordPattern怎么用?C++ gc::asRecordPattern使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gc
的用法示例。
在下文中一共展示了gc::asRecordPattern方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeParam
void SignatureBuilder::writeParam(gc<Pattern> pattern)
{
// If it's a record, destructure it into the signature.
RecordPattern* record = pattern->asRecordPattern();
if (record != NULL)
{
for (int i = 0; i < record->fields().count(); i++)
{
add(record->fields()[i].name);
add(":");
}
return;
}
// Any other pattern is implicitly a single-field record.
add("0:");
}
示例2: allocateSlotsForParam
void Resolver::allocateSlotsForParam(gc<Pattern> pattern)
{
// No parameter so do nothing.
if (pattern.isNull()) return;
RecordPattern* record = pattern->asRecordPattern();
if (record != NULL)
{
// Allocate each field.
for (int i = 0; i < record->fields().count(); i++)
{
makeParamSlot(record->fields()[i].value);
}
}
else
{
// If we got here, the pattern isn't a record, so it's a single slot.
makeParamSlot(pattern);
}
}
示例3: destructureParam
void Resolver::destructureParam(gc<Pattern> pattern)
{
// No parameter so do nothing.
if (pattern.isNull()) return;
RecordPattern* record = pattern->asRecordPattern();
if (record != NULL)
{
// Resolve each field.
for (int i = 0; i < record->fields().count(); i++)
{
resolveParam(record->fields()[i].value);
}
}
else
{
// If we got here, the pattern isn't a record, so its a single slot.
resolveParam(pattern);
}
}
示例4: compileParam
void ExprCompiler::compileParam(PatternCompiler& compiler,
gc<Pattern> param, int& slot)
{
// No parameter so do nothing.
if (param.isNull()) return;
RecordPattern* record = param->asRecordPattern();
if (record != NULL)
{
// Compile each field.
for (int i = 0; i < record->fields().count(); i++)
{
compileParamField(compiler, record->fields()[i].value, slot++);
}
}
else
{
// If we got here, the pattern isn't a record, so it's a single slot.
compileParamField(compiler, param, slot++);
}
}
示例5: declareVariables
void Compiler::declareVariables(gc<Pattern> pattern, Module* module)
{
RecordPattern* record = pattern->asRecordPattern();
if (record != NULL)
{
for (int i = 0; i < record->fields().count(); i++)
{
declareVariables(record->fields()[i].value, module);
}
return;
}
VariablePattern* variable = pattern->asVariablePattern();
if (variable != NULL)
{
declareVariable(variable->pos(), variable->name(), module);
if (!variable->pattern().isNull())
{
declareVariables(variable->pattern(), module);
}
}
}