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

Optional chaining #16

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft

Conversation

LivingInSyn
Copy link

Hi All,

This PR is a port of the following PR from the main esprima project:

jquery/esprima#2048

I've hit a bit of a wall when running unit tests getting the added optional parameter to get serialized when toDict is called. Any help you can provide to fix that and get this merged would be great!

@LivingInSyn
Copy link
Author

An example is:

test/fixtures/declaration/function/migrated_0006.js

The expected output has this in the output:

Where the actual just doesn't have optional as a member of the CallExpression object:

"expression": {
              "arguments": [],
              "callee": {
                "loc": {
                  "end": {
                    "column": 25,
                    "line": 1
                  },
                  "start": {
                    "column": 20,
                    "line": 1
                  }
                },
                "name": "sayHi",
                "range": [
                  20,
                  25
                ],
                "type": "Identifier"
              },
              "loc": {
                "end": {
                  "column": 27,
                  "line": 1
                },
                "start": {
                  "column": 20,
                  "line": 1
                }
              },
              "optional": false,
              "range": [
                20,
                27
              ],
              "type": "CallExpression"
            }
            

@LivingInSyn
Copy link
Author

Update: I was using the pip installed version while running tests

Removed unsupported tests. I plan on pulling in the following PRs in the near future:

jquery/esprima#1190
jquery/esprima#2032
jquery/esprima#2039

Only two problems left to fix

@LivingInSyn
Copy link
Author

@Kronuz : spent a bit more time but I'm not sure how to where the last errors are coming from. On test/fixtures/expression/primary/literal/regular-expression/u-flag-surrogate-pair.js I get

"init": {
            "loc": {
              "end": {
                "column": 41, 
                "line": 1
              }, 
              "start": {
                "column": 8, 
                "line": 1
              }
            }, 
            "range": [
              8, 
              41
            ], 
            "raw": "/[\\uD834\\uDF06-\\uD834\\uDF08a-z]/u", 
            "regex": {
              "flags": "u", 
              "pattern": "[\\uD834\\uDF06-\\uD834\\uDF08a-z]"
            }, 
            "type": "Literal", 
            "value": {}
          }

I'm not sure where "value": {} is coming from given the changes made for this feature.

Any help you can provide would be appreciated

@djn3m0
Copy link

djn3m0 commented Feb 16, 2022

Any idea when this is going to be done and merged?

@LivingInSyn
Copy link
Author

@djn3m0 I dropped this work since I changed positions, sorry. IIRC we changed from esprima-python to using https://github.com/eslint/espree directly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants