本文整理匯總了C#中AnalysisUnit.FindAnalysisValueByName方法的典型用法代碼示例。如果您正苦於以下問題:C# AnalysisUnit.FindAnalysisValueByName方法的具體用法?C# AnalysisUnit.FindAnalysisValueByName怎麽用?C# AnalysisUnit.FindAnalysisValueByName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類AnalysisUnit
的用法示例。
在下文中一共展示了AnalysisUnit.FindAnalysisValueByName方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ProcessTags
private IAnalysisSet ProcessTags(Node node, AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames, Dictionary<string, TagInfo> tags) {
if (args.Length >= 3) {
// library.filter(name, value)
foreach (var name in args[1]) {
var constName = name.GetConstantValue();
if (constName == Type.Missing) {
if (name.Name != null) {
RegisterTag(unit.Project, tags, name.Name, name.Documentation);
}
} else {
var strName = name.GetConstantValueAsString();
if (strName != null) {
RegisterTag(unit.Project, tags, strName);
}
}
}
foreach (var func in args[2]) {
// TODO: Find a better node
var parser = unit.FindAnalysisValueByName(node, "django.template.base.Parser");
if (parser != null) {
func.Call(node, unit, new[] { parser, AnalysisSet.Empty }, NameExpression.EmptyArray);
}
}
} else if (args.Length >= 2) {
// library.filter(value)
foreach (var name in args[1]) {
string tagName = name.Name ?? name.GetConstantValueAsString();
if (tagName != null) {
RegisterTag(unit.Project, tags, tagName, name.Documentation);
}
if (name.MemberType != PythonMemberType.Constant) {
var parser = unit.FindAnalysisValueByName(node, "django.template.base.Parser");
if (parser != null) {
name.Call(node, unit, new[] { parser, AnalysisSet.Empty }, NameExpression.EmptyArray);
}
}
}
} else if (args.Length == 1) {
foreach (var name in args[0]) {
if (name.MemberType == PythonMemberType.Constant) {
// library.filter('name')
DeferredDecorator dec;
if (!_decoratorTable.TryGetValue(node, out dec)) {
dec = new DeferredDecorator(this, name, tags);
_decoratorTable.Add(node, dec);
}
return dec;
} else if (name.Name != null) {
// library.filter
RegisterTag(unit.Project, tags, name.Name, name.Documentation);
}
}
}
return AnalysisSet.Empty;
}