本文整理汇总了C#中SyntaxNode.GetFullText方法的典型用法代码示例。如果您正苦于以下问题:C# SyntaxNode.GetFullText方法的具体用法?C# SyntaxNode.GetFullText怎么用?C# SyntaxNode.GetFullText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SyntaxNode
的用法示例。
在下文中一共展示了SyntaxNode.GetFullText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TrivialSyntaxTree
public TrivialSyntaxTree(string fileName, SyntaxNode rootNode, ParseOptions options)
{
this.fileName = fileName;
this.rootNode = rootNode;
this.options = options;
// TODO: HACK HACK HACK HACK HACK HACK: look away, for this is terribly inefficient
this.text = new StringText(rootNode.GetFullText());
}
示例2: FlattenMethodInvocation
/* Flatten the caller by replacing a invocation of the callee with the code in the callee. */
public static String FlattenMethodInvocation(SyntaxNode caller, SyntaxNode callee, SyntaxNode invocation)
{
// Get the statements in the callee method body except the return statement;
var statements = GetStatementsInNode(GetBlockOfMethod(callee))
.Where(s => !(s is ReturnStatementSyntax));
// Combine the statements into one string;
String replacer = StringUtil.ConcatenateAll("", statements.Select(s => s.GetFullText()).ToArray());
String callerString = caller.GetFullText();
// Replace the invocation with the replacer.
return callerString.Replace(invocation.GetText(), replacer);
}
示例3: AreSyntaxNodesSame
/* Whether two nodes contain the same code, without considering the space. */
public static bool AreSyntaxNodesSame(SyntaxNode node1, SyntaxNode node2)
{
var text1 = node1.GetFullText().Replace(" ", "");
var text2 = node2.GetFullText().Replace(" ", "");
return text1.Equals(text2);
}