Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw syntax error on a function call line which ends with a comma and further line(s) without indentation #1108

Open
ceremcem opened this issue Jul 15, 2020 · 3 comments

Comments

@ceremcem
Copy link

ceremcem commented Jul 15, 2020

I've came across with this case numerous times. Consider the following example:

hello foo, bar
hi there

Compiled output is obviously:

hello(foo, bar);
hi(there);

Then I remove the bar parameter, but accidentally forgot to remove the comma. The compiled output becomes:

hello(foo, hi(there));

instead of:

hello(foo);
hi(there);

Proposal

I guess this is not a bug, but a feature. However, I think LiveScript will be more error resistant if this feature is removed and users are forced to use backslash or parenthesis for multi line splitting purposes.

At least, an indentation for further lines must be required for considering a line to be split. to consider the line split.

@vendethiel
Copy link
Contributor

warning when there's no indentation sounds OK, but that's definitely a feature.

@determin1st
Copy link

what will happen with:

callFunc param,
         anotherParam,
         someFlag

beauty will suffer :(

@ceremcem
Copy link
Author

callFunc param,
         anotherParam,
         someFlag

is okay, however the following - which is my vote - will throw syntax error:

callFunc param,
anotherParam,
someFlag

Second one is also confusing to human eye anyway.

@ceremcem ceremcem changed the title Throw exception on a function call line that ends with comma Throw syntax error on a function call line which ends with a comma and further line(s) without indentation Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants