Skip to content

Fix ignored Namespace attribute in OperationLightupGenerator #3378

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private void GenerateOperationInterface(in GeneratorExecutionContext context, In
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 @@ -988,6 +988,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 @@ -999,6 +1000,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