-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Add support for replace/original to C# parser; add SourceGenerator tests; incorporate PR feedback #9532
Conversation
/// <summary> | ||
/// Return true if the current contextual keyword should be treated as a modifier. | ||
/// </summary> | ||
private bool IsContextualKeywordActualModifier() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like the name would be better if it matched your comment. i.e. "CurrentContextualKeywordShoudlBeTreatedAsAModifier()"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed ShouldCurrentContextualKeywordBeTreatedAsModifier
.
60787d1
to
8608210
Compare
In LanguageParser.cs, reset points do not appear to save and restore The method |
Also should investigate if adding /removing the |
@@ -643,6 +643,21 @@ | |||
<summary>Creates an BaseExpressionSyntax node.</summary> | |||
</FactoryComment> | |||
</Node> | |||
<Node Name="OriginalExpressionSyntax" Base="InstanceExpressionSyntax"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An alternate implementation would be to just have original
be an ordinary identifier token, like value
in a property setter, and let semantic analysis take care of it (i.e. bind it to a method).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gafter I'll keep that approach in mind. For now, this follows the approach used for AwaitExpressionSyntax
.
330a0cc
to
2e176dc
Compare
@gafter, @AlekseyTs Thanks for identifying the incremental parsing issues. I've updated |
@gafter, @AlekseyTs, @VSadov Updated PR to include binding and metadata writing of replaced members. Replaced members are now represented in the containing type similar to partial methods - the replacing member is included in |
@@ -513,6 +513,20 @@ private Symbol GetMemberSymbol(string memberName, TextSpan memberSpan, NamedType | |||
return implementation; | |||
} | |||
} | |||
|
|||
var method = (MethodSymbol)sym; | |||
while (true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a comment explaining why do we need the loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.
All feedback has been addressed in most recent commits. |
bool IInvocationExpression.IsVirtual => | ||
(this.Method.IsVirtual || this.Method.IsAbstract || this.Method.IsOverride) && | ||
((object)this.Method.ReplacedBy == null) && | ||
!this.ReceiverOpt.SuppressVirtualCalls; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there are two more similar places in this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Fixed.
|
||
SourceUserDefinedConversionSymbol previousConversion; | ||
if (conversionsAsConversions.TryGetValue(conversion, out previousConversion)) | ||
if (!conversionsBySignature.Add(conversion)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was the conversionsAsConversions
stuff unnecessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe method signature collisions can be handled by methodsBySignature
alone. As a result, for consistency, conversionsAsConversions
was renamed to conversionsBySignature
.
LGTM aside from the few comments I made. |
e9e6cca
to
a3dfe8a
Compare
Add support for replace/original to C# parser; add tests; and incorporate PR feedback from 5613668.
@dotnet/roslyn-compiler, @dotnet/roslyn-ide, @CyrusNajmabadi, @mattwar please review