cincheo / jsweet

A Java to JavaScript transpiler.
http://www.jsweet.org
Other
1.46k stars 160 forks source link

Not handling valid Java "with" parameter name #563

Closed rg-wood closed 4 years ago

rg-wood commented 4 years ago

Using the latest JSweet transpiler getting many (100+) compilation errors for valid Java a bit like this:

ERROR: ',' expected at itext7/kernel/src/main/java/com/itextpdf/kernel/pdf/layer/PdfLayer.java(455)
ERROR: ';' expected at itext7/kernel/src/main/java/com/itextpdf/kernel/pdf/layer/PdfLayer.java(455)

With the following code:

    public Vector cross(Vector with) {
        float x = vals[I2] * with.vals[I3] - vals[I3] * with.vals[I2];
        float y = vals[I3] * with.vals[I1] - vals[I1] * with.vals[I3];
        float z = vals[I1] * with.vals[I2] - vals[I2] * with.vals[I1];
        return new Vector(x, y, z);
    }

Workaround: Renaming the variable name resolves this compilation issue.

Note: with is a reserved keyword in JavaScript.

lgrignon commented 4 years ago

Hello @rg-wood This is nice, thanks for reporting.

lgrignon commented 4 years ago

Will be fixed in JSweet 2 & 3