How to use the @glimmer/interfaces.Op.Fetch function in @glimmer/interfaces

To help you get started, we’ve selected a few @glimmer/interfaces examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github glimmerjs / glimmer-vm / packages / @glimmer / opcode-compiler / lib / opcode-builder / helpers / components.ts View on Github external
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));
  }
github glimmerjs / glimmer-vm / packages / @glimmer / opcode-compiler / lib / opcode-builder / helpers / components.ts View on Github external
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'),
  ];
}
github glimmerjs / glimmer-vm / packages / @glimmer / debug / lib / opcode-metadata.ts View on Github external
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',
github glimmerjs / glimmer-vm / packages / @glimmer / opcode-compiler / lib / opcode-builder / helpers / vm.ts View on Github external
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),
  ];
}