How to use the @glimmer/interfaces.Op.JumpUnless 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 / conditional.ts View on Github external
body: () => {
      let out = [
        // If the conditional is false, jump to the ELSE label.
        op(Op.JumpUnless, label('ELSE')),
        // Otherwise, execute the code associated with the true branch.
        ifTrue(),
        // We're done, so return. In the initial execution, this runs
        // the cleanup code. In the updating VM, it exits the updating
        // routine.
        op(MachineOp.Jump, label('FINALLY')),
        op('Label', 'ELSE'),
      ];

      // If the conditional is false, and code associatied ith the
      // false branch was provided, execute it. If there was no code
      // associated with the false branch, jumping to the else statement
      // has no other behavior.
      if (ifFalse) {
        out.push(ifFalse());
      }
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.JumpIf] = {
  name: 'JumpIf',
  mnemonic: 'iftrue',
  before: null,
  stackChange: -1,
  ops: [
    {
      name: 'to',
      type: 'u32',
    },
  ],
  operands: 1,
  check: true,
};

METADATA[Op.JumpUnless] = {
  name: 'JumpUnless',
  mnemonic: 'iffalse',
  before: null,
  stackChange: -1,
  ops: [
    {
      name: 'to',
      type: 'u32',
    },
  ],
  operands: 1,
  check: true,
};

METADATA[Op.JumpEq] = {
  name: 'JumpEq',
github glimmerjs / glimmer-vm / packages / @glimmer / opcode-compiler / lib / syntax / builtins.ts View on Github external
body() {
        let out: StatementCompileActions = [
          op(Op.PutIterator),
          op(Op.JumpUnless, label('ELSE')),
          op(MachineOp.PushFrame),
          op(Op.Dup, $fp, 1),
          op(MachineOp.ReturnTo, label('ITER')),
          op(Op.EnterList, label('BODY')),
          op('Label', 'ITER'),
          op(Op.Iterate, label('BREAK')),
          op('Label', 'BODY'),
          invokeStaticBlockWithStack(unwrap(blocks.get('default')), 2),
          op(Op.Pop, 2),
          op(MachineOp.Jump, label('FINALLY')),
          op('Label', 'BREAK'),
          op(Op.ExitList),
          op(MachineOp.PopFrame),
          op(MachineOp.Jump, label('FINALLY')),
          op('Label', 'ELSE'),
        ];
github glimmerjs / glimmer-vm / packages / @glimmer / opcode-compiler / lib / opcode-builder / helpers / components.ts View on Github external
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'),
  ];
}