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

Add support for safe navigation operator #57

Closed
elpete opened this issue Feb 14, 2020 · 2 comments
Closed

Add support for safe navigation operator #57

elpete opened this issue Feb 14, 2020 · 2 comments

Comments

@elpete
Copy link
Contributor

elpete commented Feb 14, 2020

It looks like the safe navigation operator (?.) is being interpreted as a ternary operator. This causes some code breakage.

Config: default

Source:

component {

    function functionCallWithSafeNavigationOperator() {
        return getFoo()?.getBar();
    }

    function structWithSafeNavigationOperator() {
        return variables?.foo?.bar;
    }

}

Current Output:

component {

    function functionCallWithSafeNavigationOperator() {
        return getFoo() ? .getBar();
    }

    function structWithSafeNavigationOperator() {
        return variables ? .foo ? .bar;
    }

}
@elpete
Copy link
Contributor Author

elpete commented Feb 14, 2020

Actually, it looks like Lucee still parses this correctly. I'm surprised. However, I don't think that's the aesthetic we want since it looks like a ternary this way.

@jcberquist
Copy link
Owner

Thanks! I didn't have any syntax highlighting support for the safe navigation operator in place.

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

2 participants