endel/js2php

return x[1];

Opened this issue · 4 comments

zaoqi commented
function f(x) {
    return x[1];
}

http://endel.me/js2php/

It cannot translate it.

zaoqi commented

But it can translate

function f(x) {
    return x[0];
}
zaoqi commented

and

function f(x) {
    return x[1+0];
}
zaoqi commented
function f(x) {
    return x[1+1];
}

and so on

function f(x) {
return x[+1];
}

The + operator triggers numeric conversion in this case. Does js2php support JS types coercion?

Very interesting issue anyway.