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

Should throw on invalid LHS in postfix operation #1912

KFlash opened this Issue Feb 8, 2018 · 0 comments


None yet
1 participant
Copy link

KFlash commented Feb 8, 2018

Esprima allow invalid LHS in both postfix and prefix operations.

Steps to reproduce

esprima.parse('function f() { (; }')

Expected output

Should have thrown an error.

Actual output

    "type": "Program",
    "body": [
            "type": "FunctionDeclaration",
            "id": {
                "type": "Identifier",
                "name": "f"
            "params": [],
            "body": {
                "type": "BlockStatement",
                "body": [
                        "type": "ExpressionStatement",
                        "expression": {
                            "type": "UpdateExpression",
                            "operator": "--",
                            "argument": {
                                "type": "MetaProperty",
                                "meta": {
                                    "type": "Identifier",
                                    "name": "new"
                                "property": {
                                    "type": "Identifier",
                                    "name": "target"
                            "prefix": false
            "generator": false,
            "expression": false,
            "async": false
    "sourceType": "script"

Relevant references

Test262 test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment