Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { PrimitiveReference } from '../../references';
import { CompilableTemplate } from '../../syntax/interfaces';
import { VM, UpdatingVM } from '../../vm';
import { Arguments } from '../../vm/arguments';
import { LazyConstants, PrimitiveType } from "@glimmer/program";
import { CheckReference } from './-debug-strip';
APPEND_OPCODES.add(Op.ChildScope, vm => vm.pushChildScope());
APPEND_OPCODES.add(Op.PopScope, vm => vm.popScope());
APPEND_OPCODES.add(Op.PushDynamicScope, vm => vm.pushDynamicScope());
APPEND_OPCODES.add(Op.PopDynamicScope, vm => vm.popDynamicScope());
APPEND_OPCODES.add(Op.Constant, (vm: VM & { constants: LazyConstants }, { op1: other }) => {
vm.stack.push(vm.constants.getOther(other));
});
APPEND_OPCODES.add(Op.Primitive, (vm, { op1: primitive }) => {
let stack = vm.stack;
let flag = primitive & 7; // 111
let value = primitive >> 3;
switch (flag) {
case PrimitiveType.NUMBER:
stack.push(value);
break;
case PrimitiveType.FLOAT:
stack.push(vm.constants.getFloat(value));
break;
case PrimitiveType.STRING:
import { PrimitiveReference } from '../../references';
import { UpdatingVM } from '../../vm';
import { LazyConstants, PrimitiveType } from '@glimmer/program';
import { CheckReference, CheckScope } from './-debug-strip';
import { CONSTANTS } from '../../symbols';
APPEND_OPCODES.add(Op.ChildScope, vm => vm.pushChildScope(), OpcodeKind.Mut);
APPEND_OPCODES.add(Op.PopScope, vm => vm.popScope(), OpcodeKind.Mut);
APPEND_OPCODES.add(Op.PushDynamicScope, vm => vm.pushDynamicScope(), OpcodeKind.Mut);
APPEND_OPCODES.add(Op.PopDynamicScope, vm => vm.popDynamicScope(), OpcodeKind.Mut);
APPEND_OPCODES.add(
Op.Constant,
(vm, { op1: other }) => {
vm.stack.push((vm[CONSTANTS] as LazyConstants).getOther(other));
},
OpcodeKind.Mut
);
APPEND_OPCODES.add(
Op.Primitive,
(vm, { op1: primitive }) => {
let stack = vm.stack;
let flag = primitive & 7; // 111
let value = primitive >> 3;
switch (flag) {
case PrimitiveType.NUMBER:
stack.push(value);