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

Support top level statements in event hookup #58475

Merged
merged 2 commits into from
Dec 24, 2021

Conversation

davidwengier
Copy link
Contributor

Fixes #58474

@davidwengier davidwengier enabled auto-merge (squash) December 23, 2021 22:38
@davidwengier davidwengier merged commit 678b269 into dotnet:main Dec 24, 2021
@ghost ghost added this to the Next milestone Dec 24, 2021
@davidwengier davidwengier deleted the EventHookupInTopLevelCode branch December 24, 2021 02:17
}

private static IMethodSymbol GetMethodSymbol(
SemanticDocument semanticDocument,
string eventHandlerMethodName,
AssignmentExpressionSyntax eventHookupExpression,
MethodKind methodKind,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidwengier While this change makes sense, I wonder how things were working in #50726 without this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm.. good question. Perhaps a change in the code generation bits since then?

Apologies for not noticing the existing issue/pr

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps a change in the code generation bits since then?

I took a quick look from sourceroslyn.io and can't really find how this can affect anything. Going to open a quick draft to see what exactly fails as I'm curious.

Apologies for not noticing the existing issue/pr

No problem!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't be surprised if it's unnecessary, but I definitely saw a failure at one point where the access modifier was added to the local function, which obviously was wrong. I can't remember exactly what the rest of the code looked like at that point though :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

event handlers are not generated in top level programs.
4 participants