Correctly mangle this in the JS backend (#8853)
As shown in pragmagic/karax#67 using `this` as parameter name made the codegen output wrong code (and the user didn't notice the errors in the browser console).
This commit is contained in:
parent
0694c9080f
commit
1a60ffcf1d
3 changed files with 27 additions and 3 deletions
|
|
@ -267,8 +267,8 @@ block:
|
|||
type TestObject = object
|
||||
a: int
|
||||
onWhatever: proc(e: int): int
|
||||
proc handleWhatever(that: TestObject, e: int): int =
|
||||
e + that.a
|
||||
proc handleWhatever(this: TestObject, e: int): int =
|
||||
e + this.a
|
||||
proc test(): bool =
|
||||
let obj = TestObject(a: 9, onWhatever: bindMethod(handleWhatever))
|
||||
obj.onWhatever(1) == 10
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue