Skip to content

Commit

Permalink
Merge pull request #3378 from pavel-mikula-sonarsource/patch-1
Browse files Browse the repository at this point in the history
Fix ignored Namespace attribute in OperationLightupGenerator
  • Loading branch information
sharwell authored Dec 9, 2021
2 parents 0b40032 + 6b7b40d commit ca7ccd2
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private void GenerateOperationInterface(in SourceProductionContext context, Inte
variables: SyntaxFactory.SingletonSeparatedList(SyntaxFactory.VariableDeclarator(
identifier: SyntaxFactory.Identifier("WrappedTypeName"),
argumentList: null,
initializer: SyntaxFactory.EqualsValueClause(SyntaxFactory.LiteralExpression(SyntaxKind.StringLiteralExpression, SyntaxFactory.Literal("Microsoft.CodeAnalysis.Operations." + node.InterfaceName))))))));
initializer: SyntaxFactory.EqualsValueClause(SyntaxFactory.LiteralExpression(SyntaxKind.StringLiteralExpression, SyntaxFactory.Literal($"Microsoft.CodeAnalysis.{node.Namespace}.{node.InterfaceName}"))))))));

// private static readonly Type WrappedType;
members = members.Add(SyntaxFactory.FieldDeclaration(
Expand Down Expand Up @@ -989,6 +989,7 @@ public InterfaceData(DocumentData documentData, XElement node, ImmutableArray<(s

this.OperationKinds = operationKinds;
this.InterfaceName = node.Attribute("Name").Value;
this.Namespace = node.Attribute("Namespace")?.Value ?? "Operations";
this.Name = this.InterfaceName.Substring("I".Length, this.InterfaceName.Length - "I".Length - "Operation".Length);
this.WrapperName = this.InterfaceName + "Wrapper";
this.BaseInterfaceName = node.Attribute("Base").Value;
Expand All @@ -1000,6 +1001,8 @@ public InterfaceData(DocumentData documentData, XElement node, ImmutableArray<(s

public string InterfaceName { get; }

public string Namespace { get; }

public string Name { get; }

public string WrapperName { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace StyleCop.Analyzers.Lightup

internal readonly struct ICaughtExceptionOperationWrapper : IOperationWrapper
{
internal const string WrappedTypeName = "Microsoft.CodeAnalysis.Operations.ICaughtExceptionOperation";
internal const string WrappedTypeName = "Microsoft.CodeAnalysis.FlowAnalysis.ICaughtExceptionOperation";
private static readonly Type WrappedType;
private readonly IOperation operation;
static ICaughtExceptionOperationWrapper()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace StyleCop.Analyzers.Lightup

internal readonly struct IFlowAnonymousFunctionOperationWrapper : IOperationWrapper
{
internal const string WrappedTypeName = "Microsoft.CodeAnalysis.Operations.IFlowAnonymousFunctionOperation";
internal const string WrappedTypeName = "Microsoft.CodeAnalysis.FlowAnalysis.IFlowAnonymousFunctionOperation";
private static readonly Type WrappedType;
private static readonly Func<IOperation, IMethodSymbol> SymbolAccessor;
private readonly IOperation operation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace StyleCop.Analyzers.Lightup

internal readonly struct IFlowCaptureOperationWrapper : IOperationWrapper
{
internal const string WrappedTypeName = "Microsoft.CodeAnalysis.Operations.IFlowCaptureOperation";
internal const string WrappedTypeName = "Microsoft.CodeAnalysis.FlowAnalysis.IFlowCaptureOperation";
private static readonly Type WrappedType;
private static readonly Func<IOperation, IOperation> ValueAccessor;
private readonly IOperation operation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace StyleCop.Analyzers.Lightup

internal readonly struct IFlowCaptureReferenceOperationWrapper : IOperationWrapper
{
internal const string WrappedTypeName = "Microsoft.CodeAnalysis.Operations.IFlowCaptureReferenceOperation";
internal const string WrappedTypeName = "Microsoft.CodeAnalysis.FlowAnalysis.IFlowCaptureReferenceOperation";
private static readonly Type WrappedType;
private readonly IOperation operation;
static IFlowCaptureReferenceOperationWrapper()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace StyleCop.Analyzers.Lightup

internal readonly struct IIsNullOperationWrapper : IOperationWrapper
{
internal const string WrappedTypeName = "Microsoft.CodeAnalysis.Operations.IIsNullOperation";
internal const string WrappedTypeName = "Microsoft.CodeAnalysis.FlowAnalysis.IIsNullOperation";
private static readonly Type WrappedType;
private static readonly Func<IOperation, IOperation> OperandAccessor;
private readonly IOperation operation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace StyleCop.Analyzers.Lightup

internal readonly struct IStaticLocalInitializationSemaphoreOperationWrapper : IOperationWrapper
{
internal const string WrappedTypeName = "Microsoft.CodeAnalysis.Operations.IStaticLocalInitializationSemaphoreOperation";
internal const string WrappedTypeName = "Microsoft.CodeAnalysis.FlowAnalysis.IStaticLocalInitializationSemaphoreOperation";
private static readonly Type WrappedType;
private static readonly Func<IOperation, ILocalSymbol> LocalAccessor;
private readonly IOperation operation;
Expand Down

0 comments on commit ca7ccd2

Please sign in to comment.