Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return [
[
Op.Append,
+normalized.trusted,
0,
0,
buildExpression(normalized.expr, ExpressionContext.Expression, symbols),
],
];
}
case HeadKind.Call: {
let { path, params, hash, trusted } = normalized;
let builtParams: Option = params ? buildParams(params, symbols) : [];
let builtHash: WireFormat.Core.Hash = hash ? buildHash(hash, symbols) : null;
let builtExpr: WireFormat.Expression = buildPath(path, ExpressionContext.CallHead, symbols);
return [[Op.Append, +trusted, 0, 0, [Op.Call, 0, 0, builtExpr, builtParams, builtHash]]];
}
case HeadKind.Literal: {
return [[Op.Append, 1, 0, 0, normalized.value]];
}
case HeadKind.Comment: {
return [[Op.Comment, normalized.value]];
}
case HeadKind.Block: {
let blocks = buildBlocks(normalized.blocks, normalized.blockParams, symbols);
let hash = buildHash(normalized.hash, symbols);
let params = buildParams(normalized.params, symbols);
private mustacheAttrValue(value: AST.TextNode | AST.MustacheStatement): value is AST.TextNode {
if (value.type === 'TextNode') {
this.opcode(['literal', value.chars]);
return true;
} else if (isKeyword(value)) {
this.keyword(value);
} else if (isHelperInvocation(value)) {
this.prepareHelper(value, 'helper');
this.expression(value.path, ExpressionContext.CallHead, value);
this.opcode(['helper'], value);
} else {
this.expression(value.path, ExpressionContext.AppendSingleId, value);
}
return false;
}
context: ExpressionContext,
symbols: Symbols
): WireFormat.Expression {
switch (expr.type) {
case ExpressionKind.Get: {
return buildPath(expr.path, context, symbols);
}
case ExpressionKind.Concat: {
return [Op.Concat, buildConcat(expr.params, symbols)];
}
case ExpressionKind.Call: {
let builtParams = buildParams(expr.params, symbols);
let builtHash = buildHash(expr.hash, symbols);
let builtExpr = buildPath(expr.path, ExpressionContext.CallHead, symbols);
return [Op.Call, 0, 0, builtExpr, builtParams, builtHash];
}
case ExpressionKind.HasBlock: {
return [
Op.HasBlock,
buildVar(
{ kind: VariableKind.Block, name: expr.name },
ExpressionContext.Expression,
symbols
),
];
}
case ExpressionKind.HasBlockParams: {