Closed
Description
This was a weird one to track down. Here’s a reduced reproduction.
class X {
public normal: i32;
public viaThis: i32;
constructor(private x: i32) {
this.viaThis = this.x;
this.normal = x;
}
}
const x = new X(4);
export function normal(): u32 {
return x.normal;
}
export function viaThis(): u32 {
return x.viaThis;
}
console.assert(instance.exports.normal() === 4);
// This will throw. With asc 0.9.4 it will return `0`
console.assert(instance.exports.viaThis() === 4);
Fun fact: If you swap the assignments in the constructor, both return 4 🤷