Bug: prepending this. incorrectly

(Found in build 209)

A pattern that comes recommended for speeding up events that do not need to worry about thread synchronization is:



Which when reformatting (with all options checked) becomes:


Now the function would probably be done a bit better by naming the local variable with a lowercase name, but I think this is still worth a bug report. Reformatting shouldn't arbitrarily introduce 'this.' where none previously existed, changing the semantics of the code.


As a side note, is it possible to get another option under brace layout for no-brace for single line, but leave the statement on the next line.

if (foo)
bar();

1 comment
Comment actions Permalink

Please could you post this bug to our tracker?

--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Nathan Bird" <no_mail@jetbrains.com> wrote in message
news:990529.1130442058078.JavaMail.itn@is.intellij.net...

(Found in build 209)

>

A pattern that comes recommended for speeding up events that do not need
to worry about thread synchronization is:

>

private static readonly object EventDetailDone = new object() ; > public event CommandEventHandler DetailDone { > add { > Events.AddHandler(EventDetailDone , value) ; > } > remove { > Events.RemoveHandler(EventDetailDone , value) ; > } > } > > > protected virtual void OnDetailDone(CommandEventArgs e) { > CommandEventHandler DetailDone = (CommandEventHandler) > Events[EventDetailDone] ; > if ( DetailDone != null ) { > DetailDone(this , e) ; > } > } > ]]>

>

Which when reformatting (with all options checked) becomes:
protected virtual void OnDetailDone(CommandEventArgs e) { > CommandEventHandler DetailDone = (CommandEventHandler) > Events[EventDetailDone]; > if (DetailDone != null) this.DetailDone(this, e); > } > ]]>

>

Now the function would probably be done a bit better by naming the local
variable with a lowercase name, but I think this is still worth a bug
report. Reformatting shouldn't arbitrarily introduce 'this.' where none
previously existed, changing the semantics of the code.

>
>

As a side note, is it possible to get another option under brace layout
for no-brace for single line, but leave the statement on the next line.

>

if (foo)
bar();



0

Please sign in to leave a comment.