flexxui / pscript

Python to JavaScript compiler
http://pscript.readthedocs.io
BSD 2-Clause "Simplified" License
256 stars 25 forks source link

Problems when translating class #61

Closed streetartist closed 3 years ago

streetartist commented 3 years ago

When transferring a class, the operation of generating a class instance is treated as a calling function, and a type check should be added to avoid this problem

You can't tell whether it's a class by the capitalized initials

a = aclass()

Translated into

a = aclass();
almarklein commented 3 years ago

In PScript, if you have a function call where the function name starts with a capital, it is assumed to be a class instantiation. See https://pscript.readthedocs.io/en/latest/intro.html#caveats