Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let name = context.meta.upvars![freeVar];
concatExpressions(encoder, context, [op(Op.ResolveMaybeLocal, name)], constants);
break;
}
switch (expressionContext) {
case ExpressionContext.Expression: {
// in classic mode, this is always a this-fallback
let name = context.meta.upvars![freeVar];
concatExpressions(
encoder,
context,
[op(Op.GetVariable, 0), op(Op.GetProperty, name)],
constants
);
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 {
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',
mnemonic: 'getprop',
before: null,
stackChange: 0,
ops: [
{
name: 'property',
type: 'str',
},
],
operands: 1,
check: true,
};
METADATA[Op.GetBlock] = {
name: 'GetBlock',
let name = vm[CONSTANTS].getString(_name);
let locals = vm.scope().getPartialMap()!;
let ref = locals[name];
if (ref === undefined) {
ref = vm.getSelf().get(name);
}
vm.stack.push(ref);
});
APPEND_OPCODES.add(Op.RootScope, (vm, { op1: symbols }) => {
vm.pushRootScope(symbols);
});
APPEND_OPCODES.add(Op.GetProperty, (vm, { op1: _key }) => {
let key = vm[CONSTANTS].getString(_key);
let expr = check(vm.stack.pop(), CheckPathReference);
vm.stack.push(expr.get(key));
});
APPEND_OPCODES.add(Op.GetBlock, (vm, { op1: _block }) => {
let { stack } = vm;
let block = vm.scope().getBlock(_block);
stack.push(block);
});
APPEND_OPCODES.add(Op.JitSpreadBlock, vm => {
let { stack } = vm;
let block = stack.pop();
return [op('Expr', head), ...tail.map(p => op(Op.GetProperty, p))];
});