Skip to content

C# -> VB: field events with operators += -= can appear in property events - #515

Merged
GrahamTheCoder merged 5 commits into
icsharpcode:masterfrom
Alexilia:master
Jan 31, 2020
Merged

GrahamTheCoder merged 5 commits into
icsharpcode:masterfrom
Alexilia:master

Conversation

@Alexilia

Copy link
Copy Markdown
Contributor

Have to return AddHandler RemoveHandler RaiseEvent code generation to custom events using field events

Alexilia and others added 5 commits January 30, 2020 12:26
…ents

Have to return AddHandler RemoveHandler RaiseEvent code generation to custom events using field events
Rewriting after visiting makes it hard to keep track of nodes for later analysis (e.g. comment conversion I'm working on in a PR right now)
}
private static StatementSyntax ReplaceExitForToWhile(StatementSyntax statement) {
var exitSyntaxes = statement.DescendantNodesAndSelf().OfType<ExitStatementSyntax>();
return statement.ReplaceNodes(exitSyntaxes, (_, __) => SyntaxFactory.ExitWhileStatement());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Using any of the Replace functions on the conversion result from another Visit method causes issues keeping track of where nodes came from. On PR #512 I'm currently unpicking existing ones of these to try to get comment conversion working C# -> VB.

I've added a commit to replace this with something that also works for nested loops and the continue statement. Feel free to build on that if you can think of other cases.

@GrahamTheCoder

Copy link
Copy Markdown
Member

I haven't tried out the syntax, but your tests and implementation look reasonable other than the minor edit I made, thanks!

@GrahamTheCoder
GrahamTheCoder merged commit c16cefa into icsharpcode:master Jan 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants