How to use the @glimmer/interfaces.Op.GetVariable 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 / syntax / push-resolution.ts View on Github external
break;
        }

        case ExpressionContext.AppendSingleId: {
          let resolver = context.syntax.program.resolverDelegate;
          let name = context.meta.upvars![freeVar];

          let resolvedHelper = resolver.lookupHelper(name, context.meta.referrer);
          let expressions: ExpressionCompileActions;

          if (resolvedHelper) {
            expressions = Call({ handle: resolvedHelper, params: null, hash: null });
          } else {
            // in classic mode, this is always a this-fallback
            expressions = [op(Op.GetVariable, 0), op(Op.GetProperty, name)];
          }

          concatExpressions(encoder, context, expressions, constants);

          break;
        }

        default:
          throw new Error(
            `unimplemented: Can't evaluate expression in context ${expressionContext}`
          );
      }

      break;
    }
    default:
github glimmerjs / glimmer-vm / packages / @glimmer / opcode-compiler / lib / syntax / expressions.ts View on Github external
EXPRESSIONS.add(SexpOpcodes.GetSymbol, ([, head]) => [op(Op.GetVariable, head)]);
github glimmerjs / glimmer-vm / packages / @glimmer / debug / lib / opcode-metadata.ts View on Github external
METADATA[Op.SetJitBlock] = {
  name: 'SetJitBlock',
  mnemonic: 'sjblock',
  before: null,
  stackChange: -3,
  ops: [
    {
      name: 'symbol',
      type: 'u32',
    },
  ],
  operands: 1,
  check: true,
};

METADATA[Op.GetVariable] = {
  name: 'GetVariable',
  mnemonic: 'symload',
  before: null,
  stackChange: 1,
  ops: [
    {
      name: 'symbol',
      type: 'u32',
    },
  ],
  operands: 1,
  check: true,
};

METADATA[Op.GetProperty] = {
  name: 'GetProperty',
github glimmerjs / glimmer-vm / packages / @glimmer / runtime / lib / compiled / opcodes / expressions.ts View on Github external
CheckHelper,
} from './-debug-strip';
import { CONSTANTS } from '../../symbols';

export type FunctionExpression = (vm: PublicVM) => VersionedPathReference;

APPEND_OPCODES.add(Op.Helper, (vm, { op1: handle }) => {
  let stack = vm.stack;
  let helper = check(vm.runtime.resolver.resolve(handle), CheckHelper);
  let args = check(stack.pop(), CheckArguments);
  let value = helper(args, vm);

  vm.loadValue($v0, value);
});

APPEND_OPCODES.add(Op.GetVariable, (vm, { op1: symbol }) => {
  let expr = vm.referenceForSymbol(symbol);
  vm.stack.push(expr);
});

APPEND_OPCODES.add(Op.SetVariable, (vm, { op1: symbol }) => {
  let expr = check(vm.stack.pop(), CheckPathReference);
  vm.scope().bindSymbol(symbol, expr);
});

APPEND_OPCODES.add(
  Op.SetJitBlock,
  (vm, { op1: symbol }) => {
    let handle = check(vm.stack.pop(), CheckOption(CheckCompilableBlock));
    let scope = check(vm.stack.pop(), CheckScope);
    let table = check(vm.stack.pop(), CheckOption(CheckBlockSymbolTable));