public static GherkinStepKind?GetAttributeStepKind(IClrTypeName typeName) { if (typeName.Equals(GivenAttribute)) { return(GherkinStepKind.Given); } if (typeName.Equals(WhenAttribute)) { return(GherkinStepKind.When); } if (typeName.Equals(ThenAttribute)) { return(GherkinStepKind.Then); } return(null); }
public static bool IsAttributeForKind(GherkinStepKind stepKind, IClrTypeName typeName) { if (typeName.Equals(StepDefinitionAttribute)) { return(true); } if (stepKind == GherkinStepKind.Given && typeName.Equals(GivenAttribute)) { return(true); } if (stepKind == GherkinStepKind.When && typeName.Equals(WhenAttribute)) { return(true); } if (stepKind == GherkinStepKind.Then && typeName.Equals(ThenAttribute)) { return(true); } return(false); }
public static bool IsSerilogContextPushPropertyMethod(this IInvocationExpression invocationExpression) { var typeMember = invocationExpression.Reference.Resolve().DeclaredElement as ITypeMember; var containingType = typeMember?.GetContainingType(); if (containingType == null) { return(false); } return(LogContextFqn.Equals(containingType.GetClrName()) && typeMember.ShortName == "PushProperty"); }
private void CheckAddComponent([NotNull] IInvocationExpression invocationExpressionParam, HotMethodAnalyzerContext context, [NotNull] IClrDeclaredElement declaredElement, [NotNull] IClrTypeName clrTypeName, [NotNull] IReference reference) { if (clrTypeName.Equals(KnownTypes.GameObject)) { if (declaredElement.ShortName.Equals("AddComponent") && invocationExpressionParam.TypeArguments.Count == 1) { context.MarkCurrentAsCostlyReachable(); myConsumer.AddHighlighting(new PerformanceCriticalCodeInvocationHighlighting(reference)); } } }