本文整理汇总了C#中InvocationExpressionSyntax.WithoutTrailingTrivia方法的典型用法代码示例。如果您正苦于以下问题:C# InvocationExpressionSyntax.WithoutTrailingTrivia方法的具体用法?C# InvocationExpressionSyntax.WithoutTrailingTrivia怎么用?C# InvocationExpressionSyntax.WithoutTrailingTrivia使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InvocationExpressionSyntax
的用法示例。
在下文中一共展示了InvocationExpressionSyntax.WithoutTrailingTrivia方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RewriteStatement
/// <summary>
/// Rewrites the expression with a create machine expression.
/// </summary>
/// <param name="node">InvocationExpressionSyntax</param>
/// <returns>SyntaxNode</returns>
private SyntaxNode RewriteStatement(InvocationExpressionSyntax node)
{
var arguments = new List<ArgumentSyntax>(node.ArgumentList.Arguments);
var machineIdentifier = arguments[0].ToString();
SyntaxNode models = null;
var parent = node.FirstAncestorOrSelf<ExpressionStatementSyntax>();
if (parent != null)
{
models = base.GetNextStatement(parent);
if (models != null &&
(models is LocalDeclarationStatementSyntax) &&
(models as LocalDeclarationStatementSyntax).Declaration.
Type.ToString().Equals("models"))
{
if (this.Project.CompilationContext.ActiveCompilationTarget != CompilationTarget.Testing)
{
machineIdentifier = (models as LocalDeclarationStatementSyntax).
Declaration.Variables[0].Identifier.ValueText;
}
}
else
{
models = null;
}
}
arguments[0] = SyntaxFactory.Argument(SyntaxFactory.TypeOfExpression(
SyntaxFactory.IdentifierName(machineIdentifier)));
var text = "";
if (base.IsMonitor(machineIdentifier))
{
if (this.Project.CompilationContext.ActiveCompilationTarget != CompilationTarget.Testing)
{
this.ToRemove.Add(node);
if (models != null)
{
this.ToRemove.Add(models);
}
return node;
}
text += "this.CreateMonitor";
}
else
{
text += "this.CreateMachine";
}
var rewritten = node.
WithArgumentList(SyntaxFactory.ArgumentList(SyntaxFactory.SeparatedList(arguments))).
WithExpression(SyntaxFactory.IdentifierName(text)).
WithTriviaFrom(node);
if (models != null)
{
node = node.WithoutTrailingTrivia();
this.ToReplace.Add(models);
}
return rewritten;
}