private void CheckTemplateReference(string templateName, IEnumerable <Expression> children) { if (!this.TemplateMap.ContainsKey(templateName)) { throw new Exception(LGErrors.TemplateNotExist(templateName)); } var expectedArgsCount = this.TemplateMap[templateName].Parameters.Count(); var actualArgsCount = children.Count(); if (actualArgsCount != 0 && expectedArgsCount != actualArgsCount) { throw new Exception(LGErrors.ArgumentMismatch(templateName, expectedArgsCount, actualArgsCount)); } }
private void ValidTemplateReference(Expression expression) { var templateName = expression.Type; if (!this.TemplateMap.ContainsKey(templateName)) { throw new Exception(LGErrors.TemplateNotExist(templateName)); } var expectedArgsCount = this.TemplateMap[templateName].Parameters.Count(); var actualArgsCount = expression.Children.Length; if (expectedArgsCount != actualArgsCount) { throw new Exception(LGErrors.ArgumentMismatch(templateName, expectedArgsCount, actualArgsCount)); } }