babel-plugin-proxy
babel-plugin-proxy copied to clipboard
assigning to r value
|
| var getId = exports.getId = function getId() {
| return globalGetInterceptor(global, "id")++;
| };
So, this is the error, not really sure how to fix it
original code:
export const global = {
id: 0
}
export const getId = (): number => global.id++
Oh, ok, I guess the problem is the loader doesn't account for unary expressions...that should be easy enough though, I guess
So, idk why, but it's working in the test cases, so I guess I must be doing something wrong....will report back if something goes wrong
So, this is still a problem
@zwhitchcox can you make sure that this is not related to flow annotations? I mean : number
thing
Yeah, verified with this test:
it('should not mess up update expressions', function () {
const code = `
var x = { i: 0 }
console.log(x.i++)
console.log(++x.i)
`
const runLogs = compileAndRun(code)
expect(runLogs).to.be.deep.eq([0, 2])
})
@zwhitchcox nice, thanks! I am super busy now but I will try to review your PR and take a look at that issue later today :)
Ok, thanks, I'm working on it too