Skip to content

Commit 26977ff

Browse files
committed
Add in keyword to pass by ref per Andrew's comments
1 parent 28aaa87 commit 26977ff

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

tracer/src/Datadog.Trace.Tools.Analyzers/ConfigurationAnalyzers/ConfigurationBuilderWithKeysAnalyzer.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,32 +63,32 @@ public override void Initialize(AnalysisContext context)
6363
var wellKnownTypeProvider = WellKnownTypeProvider.GetOrCreate(compilationContext.Compilation);
6464

6565
var configurationBuilder = wellKnownTypeProvider.GetOrCreateTypeByMetadataName(WellKnownTypeNames.ConfigurationBuilder);
66-
if (Helpers.Diagnostics.IsTypeNullAndReportForDatadogTrace(compilationContext, configurationBuilder, nameof(ConfigurationBuilderWithKeysAnalyzer), WellKnownTypeNames.ConfigurationBuilder))
66+
if (Diagnostics.IsTypeNullAndReportForDatadogTrace(compilationContext, configurationBuilder, nameof(ConfigurationBuilderWithKeysAnalyzer), WellKnownTypeNames.ConfigurationBuilder))
6767
{
6868
return;
6969
}
7070

7171
var configurationKeys = wellKnownTypeProvider.GetOrCreateTypeByMetadataName(WellKnownTypeNames.ConfigurationKeys);
72-
if (Helpers.Diagnostics.IsTypeNullAndReportForDatadogTrace(compilationContext, configurationKeys, nameof(ConfigurationBuilderWithKeysAnalyzer), WellKnownTypeNames.ConfigurationKeys))
72+
if (Diagnostics.IsTypeNullAndReportForDatadogTrace(compilationContext, configurationKeys, nameof(ConfigurationBuilderWithKeysAnalyzer), WellKnownTypeNames.ConfigurationKeys))
7373
{
7474
return;
7575
}
7676

7777
var platformKeys = wellKnownTypeProvider.GetOrCreateTypeByMetadataName(WellKnownTypeNames.PlatformKeys);
78-
if (Helpers.Diagnostics.IsTypeNullAndReportForDatadogTrace(compilationContext, platformKeys, nameof(ConfigurationBuilderWithKeysAnalyzer), WellKnownTypeNames.PlatformKeys))
78+
if (Diagnostics.IsTypeNullAndReportForDatadogTrace(compilationContext, platformKeys, nameof(ConfigurationBuilderWithKeysAnalyzer), WellKnownTypeNames.PlatformKeys))
7979
{
8080
return;
8181
}
8282

8383
var targetTypes = new TargetTypeSymbols(configurationBuilder, configurationKeys, platformKeys);
8484

8585
compilationContext.RegisterSyntaxNodeAction(
86-
c => AnalyzeInvocationExpression(c, targetTypes),
86+
c => AnalyzeInvocationExpression(c, in targetTypes),
8787
SyntaxKind.InvocationExpression);
8888
});
8989
}
9090

91-
private static void AnalyzeInvocationExpression(SyntaxNodeAnalysisContext context, TargetTypeSymbols targetTypes)
91+
private static void AnalyzeInvocationExpression(SyntaxNodeAnalysisContext context, in TargetTypeSymbols targetTypes)
9292
{
9393
var invocation = (InvocationExpressionSyntax)context.Node;
9494

tracer/src/Datadog.Trace.Tools.Analyzers/ConfigurationAnalyzers/EnvironmentGetEnvironmentVariableAnalyzer.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,44 +77,44 @@ public override void Initialize(AnalysisContext context)
7777
var wellKnownTypeProvider = WellKnownTypeProvider.GetOrCreate(compilationContext.Compilation);
7878

7979
var environmentHelpers = wellKnownTypeProvider.GetOrCreateTypeByMetadataName(WellKnownTypeNames.EnvironmentHelpers);
80-
if (Helpers.Diagnostics.IsTypeNullAndReportForDatadogTrace(compilationContext, environmentHelpers, nameof(EnvironmentGetEnvironmentVariableAnalyzer), WellKnownTypeNames.EnvironmentHelpers))
80+
if (Diagnostics.IsTypeNullAndReportForDatadogTrace(compilationContext, environmentHelpers, nameof(EnvironmentGetEnvironmentVariableAnalyzer), WellKnownTypeNames.EnvironmentHelpers))
8181
{
8282
return;
8383
}
8484

8585
var environmentHelpersNoLogging = wellKnownTypeProvider.GetOrCreateTypeByMetadataName(WellKnownTypeNames.EnvironmentHelpersNoLogging);
86-
if (Helpers.Diagnostics.IsTypeNullAndReportForDatadogTrace(compilationContext, environmentHelpersNoLogging, nameof(EnvironmentGetEnvironmentVariableAnalyzer), WellKnownTypeNames.EnvironmentHelpersNoLogging))
86+
if (Diagnostics.IsTypeNullAndReportForDatadogTrace(compilationContext, environmentHelpersNoLogging, nameof(EnvironmentGetEnvironmentVariableAnalyzer), WellKnownTypeNames.EnvironmentHelpersNoLogging))
8787
{
8888
return;
8989
}
9090

9191
var iValueProvider = wellKnownTypeProvider.GetOrCreateTypeByMetadataName(WellKnownTypeNames.IValueProvider);
92-
if (Helpers.Diagnostics.IsTypeNullAndReportForDatadogTrace(compilationContext, iValueProvider, nameof(EnvironmentGetEnvironmentVariableAnalyzer), WellKnownTypeNames.IValueProvider))
92+
if (Diagnostics.IsTypeNullAndReportForDatadogTrace(compilationContext, iValueProvider, nameof(EnvironmentGetEnvironmentVariableAnalyzer), WellKnownTypeNames.IValueProvider))
9393
{
9494
return;
9595
}
9696

9797
var configurationKeys = wellKnownTypeProvider.GetOrCreateTypeByMetadataName(WellKnownTypeNames.ConfigurationKeys);
98-
if (Helpers.Diagnostics.IsTypeNullAndReportForDatadogTrace(compilationContext, configurationKeys, nameof(EnvironmentGetEnvironmentVariableAnalyzer), WellKnownTypeNames.ConfigurationKeys))
98+
if (Diagnostics.IsTypeNullAndReportForDatadogTrace(compilationContext, configurationKeys, nameof(EnvironmentGetEnvironmentVariableAnalyzer), WellKnownTypeNames.ConfigurationKeys))
9999
{
100100
return;
101101
}
102102

103103
var platformKeys = wellKnownTypeProvider.GetOrCreateTypeByMetadataName(WellKnownTypeNames.PlatformKeys);
104-
if (Helpers.Diagnostics.IsTypeNullAndReportForDatadogTrace(compilationContext, platformKeys, nameof(EnvironmentGetEnvironmentVariableAnalyzer), WellKnownTypeNames.PlatformKeys))
104+
if (Diagnostics.IsTypeNullAndReportForDatadogTrace(compilationContext, platformKeys, nameof(EnvironmentGetEnvironmentVariableAnalyzer), WellKnownTypeNames.PlatformKeys))
105105
{
106106
return;
107107
}
108108

109109
var targetTypes = new TargetTypeSymbols(environmentHelpers, environmentHelpersNoLogging, iValueProvider, configurationKeys, platformKeys);
110110

111111
compilationContext.RegisterSyntaxNodeAction(
112-
c => AnalyzeInvocationExpression(c, targetTypes),
112+
c => AnalyzeInvocationExpression(c, in targetTypes),
113113
SyntaxKind.InvocationExpression);
114114
});
115115
}
116116

117-
private static void AnalyzeInvocationExpression(SyntaxNodeAnalysisContext context, TargetTypeSymbols targetTypes)
117+
private static void AnalyzeInvocationExpression(SyntaxNodeAnalysisContext context, in TargetTypeSymbols targetTypes)
118118
{
119119
var invocation = (InvocationExpressionSyntax)context.Node;
120120

tracer/src/Datadog.Trace.Tools.Analyzers/ConfigurationAnalyzers/PlatformKeysAnalyzer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public override void Initialize(AnalysisContext context)
5757
var wellKnownTypeProvider = WellKnownTypeProvider.GetOrCreate(compilationContext.Compilation);
5858
var platformKeysType = wellKnownTypeProvider.GetOrCreateTypeByMetadataName(WellKnownTypeNames.PlatformKeys);
5959

60-
if (Helpers.Diagnostics.IsTypeNullAndReportForDatadogTrace(compilationContext, platformKeysType, nameof(PlatformKeysAnalyzer), WellKnownTypeNames.PlatformKeys))
60+
if (Diagnostics.IsTypeNullAndReportForDatadogTrace(compilationContext, platformKeysType, nameof(PlatformKeysAnalyzer), WellKnownTypeNames.PlatformKeys))
6161
{
6262
return;
6363
}

0 commit comments

Comments
 (0)