-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't try to ref foreach, Me or Using identifiers - fixes #1052
- Loading branch information
1 parent
de43c73
commit c0745d8
Showing
3 changed files
with
99 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c0745d8
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.
nice!
But also, I kind of liked how I could see the
With
-blocks in translated code. Would it be much of a hassle to output something like the following?Or maybe even the "canonical" form:
c0745d8
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.
In general this isn't something I'd put in the converter since it's the wrong direction of trade off between point 3 and point 5 in the priorities here: https://github.com/icsharpcode/CodeConverter/blob/master/.github/CONTRIBUTING.md#deciding-what-the-output-should-be
I'd be more likely to try to remove the nested braces in some cases where posible
Though perhaps I've missed the reasoning behind wanting to know the old vb code in this case?
c0745d8
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.
The only reason is exactly point 5: unfortunately, I need to look at the original code from time to time (mostly when checking if conversion introduced a bug), and in these cases, it's extremely convenient to have a similar code structure and recognizable code conversion patterns (which is why I'd prefer
var withBlock = this;
).The presence of the same blocks as in the original code also helps in case they are used to "highlight" code blocks (or group logic together), something like:
This block is collapsable in VB.NET, which would be very nice to have in C# as well.
c0745d8
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.
Interesting in the grouping aspect yeah, maybe more like a local method in some cases.
For history I actually do a commit where I rename the vb files to .cs extension right before the commit where I convert so that it's easily visible in git history if needed.
I.e. Do a recursive rename, commit, reset hard to previous commit, reset soft to rename commit, convert, commit.
c0745d8
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.
That's genius!
c0745d8
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've added it as a tip in the wiki too in case it's useful to others.
I have wondered whether to ask people in a dialog box (with a "don't show this again") during project/solution conversion whether to auto-create such a commit, but it's kind of hard to explain succinctly and will probably cause more confusion than good.
c0745d8
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.
"Do you want to create an intermediate commit to have uninterrupted file histories?"
(maybe along with some simple illustration like what Git Extensions does for merges).
Btw, does it need to involve resets? I think you can do the "rename commit", and then revert it (but don't commit reverted changes), thus restoring the state before renaming, then convert and commit - which is, if I'm counting correctly, one less step.
c0745d8
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.
Yep, same effect ☺