Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let bailOut = symbolTable.hasEval || capabilities.prepareArgs;
if (bailOut) {
return InvokeComponent({
capabilities,
attrs,
params,
hash,
atNames: true,
blocks,
layout,
});
}
let out: NestedStatementCompileActions = [
op(Op.Fetch, $s0),
op(Op.Dup, $sp, 1),
op(Op.Load, $s0),
];
let { symbols } = symbolTable;
if (capabilities.createArgs) {
out.push(op(MachineOp.PushFrame), op('SimpleArgs', { params, hash, atNames: true }));
}
out.push(op(Op.BeginComponentTransaction));
if (capabilities.dynamicScope) {
out.push(op(Op.PushDynamicScope));
}
export function WrappedComponent(
layout: LayoutWithContext,
attrsBlockNumber: number
): StatementCompileActions {
return [
op('StartLabels'),
WithSavedRegister($s1, () => [
op(Op.GetComponentTagName, $s0),
op(Op.PrimitiveReference),
op(Op.Dup, $sp, 0),
]),
op(Op.JumpUnless, label('BODY')),
op(Op.Fetch, $s1),
op(Op.PutComponentOperations),
op(Op.OpenDynamicElement),
op(Op.DidCreateElement, $s0),
YieldBlock(attrsBlockNumber, EMPTY_ARRAY),
op(Op.FlushElement),
op('Label', 'BODY'),
InvokeStaticBlock(blockForLayout(layout)),
op(Op.Fetch, $s1),
op(Op.JumpUnless, label('END')),
op(Op.CloseElement),
op('Label', 'END'),
op(Op.Load, $s1),
op('StopLabels'),
];
}
METADATA[Op.Load] = {
name: 'Load',
mnemonic: 'put',
before: null,
stackChange: -1,
ops: [
{
name: 'register',
type: 'u32',
},
],
operands: 1,
check: true,
};
METADATA[Op.Fetch] = {
name: 'Fetch',
mnemonic: 'regload',
before: null,
stackChange: 1,
ops: [
{
name: 'register',
type: 'u32',
},
],
operands: 1,
check: true,
};
METADATA[Op.RootScope] = {
name: 'RootScope',
export function Call({ handle, params, hash }: CompileHelper): ExpressionCompileActions {
return [
op(MachineOp.PushFrame),
op('SimpleArgs', { params, hash, atNames: false }),
op(Op.Helper, handle),
op(MachineOp.PopFrame),
op(Op.Fetch, $v0),
];
}