本文整理汇总了C#中AstNode.AddAnnotation方法的典型用法代码示例。如果您正苦于以下问题:C# AstNode.AddAnnotation方法的具体用法?C# AstNode.AddAnnotation怎么用?C# AstNode.AddAnnotation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AstNode
的用法示例。
在下文中一共展示了AstNode.AddAnnotation方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddReplacementAnnotation
public static void AddReplacementAnnotation(AstNode node, AstNode replacedNode)
{
node.AddAnnotation(new ReplacementNodeAnnotation {
ReplacedNode = replacedNode
});
}
示例2: StartNode
public override void StartNode(AstNode node)
{
node.AddAnnotation(new StartTrackingInfo { CharacterPosition = this.m_Writer.ToString().Length });
base.StartNode(node);
}
示例3: StartNode
public void StartNode(AstNode node)
{
// code mappings
var ranges = node.Annotation<List<ILRange>>();
if (ranges != null && ranges.Count > 0) {
// find the ancestor that has method mapping as annotation
if (node.Parent != null)
{
var n = node.Ancestors.FirstOrDefault(a => a.Annotation<MemberMapping>() != null);
if (n != null) {
MemberMapping mapping = n.Annotation<MemberMapping>();
// add all ranges
foreach (var range in ranges) {
mapping.MemberCodeMappings.Add(new SourceCodeMapping {
ILInstructionOffset = range,
SourceCodeLine = output.CurrentLine,
MemberMapping = mapping
});
}
}
}
}
// definitions of types and their members
Predicate<AstNode> predicate = n => n is AttributedNode;
if (predicate(node)) {
var n = node as AttributedNode;
int c = 0;
if (n != null)
c = n.Attributes.Count;
node.AddAnnotation(Tuple.Create(output.CurrentLine + c, output.CurrentColumn));
}
nodeStack.Push(node);
}
示例4: EndNode
public override void EndNode(AstNode node)
{
base.EndNode(node);
node.AddAnnotation(new EndTrackingInfo { CharacterPosition = this.m_Writer.ToString().Length });
}