本文整理汇总了C#中LNode.WithName方法的典型用法代码示例。如果您正苦于以下问题:C# LNode.WithName方法的具体用法?C# LNode.WithName怎么用?C# LNode.WithName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LNode
的用法示例。
在下文中一共展示了LNode.WithName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TranslateWordAttr
static LNode TranslateWordAttr(LNode node, IMacroContext ctx, Symbol attr)
{
if (node.ArgCount == 0) {
if (node.IsId && ctx.IsAttribute)
return node.WithName(attr);
return null;
} else {
if (node.ArgCount == 1)
return node.Args[0].PlusAttrs(node.Attrs.Add(F.Id(attr)));
else // designed for LESv1; this branch is not very useful in LESv2
return node.PlusAttr(F.Id(attr)).With(node.Args[0], node.Args.RemoveAt(0));
}
}
示例2: MaybeRecognizeVarAsKeyword
private void MaybeRecognizeVarAsKeyword(ref LNode type)
{
SourceRange rng;
Symbol name = type.Name;
if ((name == _var || name == _dynamic) && type.IsId && (rng = type.Range).Source.Text.TryGet(rng.StartIndex, '\0') != '@') {
type = type.WithName(name == _var ? S.Missing : S.Dynamic);
}
}
示例3: NamedArg
public static LNode NamedArg(LNode node, IMessageSink sink)
{
if (node.Calls(S.Colon, 2) && node.Args[0].IsId)
return node.WithName(S.NamedArg);
return null;
}
示例4: TranslateId
private static LNode TranslateId(LNode node, Symbol symbol, IMacroContext checkIsAttr = null)
{
if (!node.IsId) return null;
if (checkIsAttr != null && !checkIsAttr.IsAttribute) return null;
return node.WithName(symbol);
}
示例5:
public static LNode @base(LNode node, IMessageSink sink)
{
return node.WithName(S.Base);
}
示例6: Identity
public static LNode Identity(LNode node, IMessageSink sink)
{
return node.WithName(S.Splice);
}
示例7: MaybeRecognizeVarAsKeyword
private void MaybeRecognizeVarAsKeyword(ref LNode type)
{
// Recognize "var" (but not @var) as a contextual keyword.
SourceRange rng;
Symbol name = type.Name;
if ((name == _var) && type.IsId
&& (rng = type.Range).Source.Text.TryGet(rng.StartIndex, '\0') != '@') {
type = type.WithName(S.Missing);
}
}
示例8: TranslateId
private static LNode TranslateId(LNode node, Symbol symbol)
{
if (!node.IsId) return null;
return node.WithName(symbol);
}