public void Visit(HelperCall astLeaf) { state.SetCursor(astLeaf); var paramContextList = new List <Context>(); foreach (var param in astLeaf.Parameters) { Context paramContext; if (param.TryEvaluate(state, out paramContext)) { paramContextList.Add(paramContext); } } var helperMethod = state.Introspector.GetHelperMethod(astLeaf.FunctionName, paramContextList.Select(x => x.Symbol).ToList()); if (helperMethod != null) { state.RegisterUsing(helperMethod.ContainingNamespace.ToDisplayString()); state.PushStatement( SyntaxHelper.AppendFuntionCallResult( functionName: string.Concat(helperMethod.ContainingType.Name, ".", helperMethod.Name), parameters: paramContextList.Select(x => x.FullPath).ToList(), returnTypeIsString: helperMethod.ReturnType.IsString(), encoded: astLeaf.Type == TokenType.Encoded)); } else {//HelperMethod not found state.AddTypeError($"Could not find Helper Method '{astLeaf.FunctionName}'", HandlebarsTypeErrorKind.UnknownHelper); return; } }
public void Visit(HelperCall astLeaf) { state.SetCursor(astLeaf); var paramContextList = new List<Context>(); foreach(var param in astLeaf.Parameters) { Context paramContext; if (param.TryEvaluate(state, out paramContext)) paramContextList.Add(paramContext); } var helperMethod = state.Introspector.GetHelperMethod(astLeaf.FunctionName, paramContextList.Select(x => x.Symbol).ToList()); if (helperMethod != null) { state.RegisterUsing(helperMethod.ContainingNamespace.ToDisplayString()); state.PushStatement( SyntaxHelper.AppendFuntionCallResult( functionName: string.Concat(helperMethod.ContainingType.Name,".",helperMethod.Name), parameters: paramContextList.Select(x => x.FullPath).ToList(), returnTypeIsString: helperMethod.ReturnType.IsString(), encoded: astLeaf.Type == TokenType.Encoded)); } else {//HelperMethod not found state.AddTypeError($"Could not find Helper Method '{astLeaf.FunctionName}'", HandlebarsTypeErrorKind.UnknownHelper); return; } }