本文整理汇总了C#中Microsoft.CodeAnalysis.CSharp.Syntax.MethodDeclarationSyntax.GetLocation方法的典型用法代码示例。如果您正苦于以下问题:C# MethodDeclarationSyntax.GetLocation方法的具体用法?C# MethodDeclarationSyntax.GetLocation怎么用?C# MethodDeclarationSyntax.GetLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.CodeAnalysis.CSharp.Syntax.MethodDeclarationSyntax
的用法示例。
在下文中一共展示了MethodDeclarationSyntax.GetLocation方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MissingRefitAttributeWarning
public MissingRefitAttributeWarning(InterfaceDeclarationSyntax @interface, MethodDeclarationSyntax method)
: base("RF001")
{
setLocation(method.GetLocation());
InterfaceName = @interface.Identifier.Text;
MethodName = method.Identifier.Text;
Message = string.Format(
"Method {0}.{1} either has no Refit HTTP method attribute or you've used something other than a string literal for the 'path' argument.",
InterfaceName, MethodName);
}
示例2:
/// <summary>
/// Récupère le nom complet du type de la méthode (avec paramètre de type éventuel).
/// </summary>
/// <param name="méthode">La méthode.</param>
/// <param name="méthodeCorrespondante">La méthode correspondante.</param>
/// <param name="modèleSémantique">Le modèle sémantique (pour simplifier les types).</param>
/// <returns>Le nom complet de la méthode.</returns>
private static string RécupérerNomType(MethodDeclarationSyntax méthode, IMethodSymbol méthodeCorrespondante, SemanticModel modèleSémantique) =>
méthodeCorrespondante.ContainingType.ConstructedFrom
.ToMinimalDisplayString(modèleSémantique, méthode.GetLocation().SourceSpan.Start)
.Replace('<', '{').Replace('>', '}');
示例3: WriteDetectedMisuseAsyncUsageToTable
internal void WriteDetectedMisuseAsyncUsageToTable(int type, Microsoft.CodeAnalysis.Document Document, MethodDeclarationSyntax node)
{
string resultfile = @"C:\Users\Semih\Desktop\MisuseTables\" + type + ".txt";
string delimStr = "/";
char[] delimiter = delimStr.ToCharArray();
var location = node.GetLocation().GetLineSpan();
var app = AppName.Replace("+", "/");
var methodName= node.Modifiers.ToString()+ " "+ node.ReturnType.ToString()+ " "+ node.Identifier.ToString() + " "+ node.ParameterList.ToString();
string filepathWithLineNumbers = "http://www.github.com/" + app + "/blob/" + commit + "/" +
Document.FilePath.Replace(@"\", @"/").Split(delimiter, 6)[5] + "#L" + (location.StartLinePosition.Line + 1) + "-" + (location.EndLinePosition.Line + 1);
var row = String.Format(@"<tr><td>{0}</td><td><a href='{1}'>Link to Source Code</a></td> </tr>", methodName, filepathWithLineNumbers);
using (StreamWriter sw = File.AppendText(resultfile))
{
sw.WriteLine(row);
}
}
示例4: WriteNodeToCallTrace
public void WriteNodeToCallTrace(MethodDeclarationSyntax node, int n)
{
var path = node.SyntaxTree.FilePath;
var start = node.GetLocation().GetLineSpan().StartLinePosition;
string message = "";
for (var i = 0; i < n; i++)
message += " ";
message += node.Identifier + " " + n + " @ " + path + ":" + start;
Logs.CallTraceLog.Info(message);
}
示例5: MultipleRefitMethodSameNameWarning
public MultipleRefitMethodSameNameWarning(InterfaceDeclarationSyntax @interface, MethodDeclarationSyntax method)
: base("RF002")
{
setLocation(method.GetLocation());
InterfaceName = @interface.Identifier.Text;
MethodName = method.Identifier.Text;
Message = string.Format(
"Method {0}.{1} has been declared multiple times. Refit doesn't support overloading.",
InterfaceName, MethodName);
}