Skip to content
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

Propagate the 'this' keyword in LibraryImports #102793

Merged
merged 3 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -426,6 +426,12 @@ public static SyntaxTokenList GetManagedParameterModifiers(TypePositionInfo type
}
}

if (typeInfo.IsExplicitThis)
{
tokens = tokens.Add(Token(SyntaxKind.ThisKeyword));
}

jtschuster marked this conversation as resolved.
Show resolved Hide resolved

return tokens;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@

using System;
using System.Collections.Generic;

using System.Linq;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;

namespace Microsoft.Interop
Expand Down Expand Up @@ -77,6 +78,7 @@ public static int IncrementIndex(int index)

public int ManagedIndex { get; init; } = UnsetIndex;
public int NativeIndex { get; init; } = UnsetIndex;
public bool IsExplicitThis { get; init; }

public static TypePositionInfo CreateForParameter(IParameterSymbol paramSymbol, MarshallingInfo marshallingInfo, Compilation compilation)
{
Expand All @@ -88,7 +90,8 @@ public static TypePositionInfo CreateForParameter(IParameterSymbol paramSymbol,
RefKind = paramSymbol.RefKind,
ByValueContentsMarshalKind = byValueContentsMarshalKind,
ByValueMarshalAttributeLocations = (inLocation, outLocation),
ScopedKind = paramSymbol.ScopedKind
ScopedKind = paramSymbol.ScopedKind,
IsExplicitThis = ((ParameterSyntax)paramSymbol.DeclaringSyntaxReferences[0].GetSyntax()).Modifiers.Any(SyntaxKind.ThisKeyword)
};

return typeInfo;
Expand Down
Loading