Brian Donovan

Results 80 comments of Brian Donovan

Looks like this is an issue with the normalize stage trying to convert both a post-`if` and post-`for` into normal inline versions: ```coffee if for v,i in [0,1,3] then (i^v)...

Thanks for the bug report. It's an interesting one. I don't have time to fix this right now, but you can check out the [contribution docs](https://github.com/decaffeinate/decaffeinate/blob/master/docs/contribution-guide.md) if you'd like to...

This is the part that triggers it: https://github.com/decaffeinate/decaffeinate/blob/4da99ddc0f3c30f724e1db747fedc5c0f8a702af/src/stages/main/patchers/ConditionalPatcher.ts#L98-L100 Which calls e.g. this: https://github.com/decaffeinate/decaffeinate/blob/4da99ddc0f3c30f724e1db747fedc5c0f8a702af/src/stages/main/patchers/LogicalOpPatcher.ts#L42-L46

A note for future me or whoever might try to fix this: the bug is that the `!` is inserted before the parenthesis at `!(cond1` when it should be inside...

The `!` is inserted at the wrong time because the call to `negate()` immediately inserts a `!` rather than marking the patcher as negated. This may require a non-trivial refactor.

This definitely appears to be a bug. Here's a [minimal reproduction](https://decaffeinate-project.org/repl/#?useCS2=true&useJSModules=true&loose=true&evaluate=true&stage=full&code=(%7B%20a%20%3D%20%40a%20%7D)%20->): ```coffee ({ a = @a }) -> ``` ```js (function({ a = a1 }) { this.a = a1; });...

Have you looked at this? https://github.com/decaffeinate/decaffeinate/blob/master/docs/contribution-guide.md

I was able to fix this case, sort of, by using this: ```diff diff --git a/src/stages/normalize/patchers/MemberAccessOpPatcher.ts b/src/stages/normalize/patchers/MemberAccessOpPatcher.ts index ea944d0d..f1dccf3c 100644 --- a/src/stages/normalize/patchers/MemberAccessOpPatcher.ts +++ b/src/stages/normalize/patchers/MemberAccessOpPatcher.ts @@ -4,6 +4,7 @@ import PassthroughPatcher...

This looks like a bad interaction between patchers. I don't have a good idea what's causing this yet, but I'll look into it.