Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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:
EXPRESSIONS.add(SexpOpcodes.GetSymbol, ([, head]) => [op(Op.GetVariable, head)]);
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',
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));