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

SpreadElement and Cannot read property 'start' of undefined #132

Open
ainthek opened this issue Sep 3, 2019 · 2 comments
Open

SpreadElement and Cannot read property 'start' of undefined #132

ainthek opened this issue Sep 3, 2019 · 2 comments

Comments

@ainthek
Copy link

ainthek commented Sep 3, 2019

Problem of Flex or Grasp ? Seems like Grasp problem to me:
Can anyone test standalone Flex please ?

This fails:
echo "x={};y={...x}" | grasp -s 'program'
Cannot read property 'start' of undefined

echo "x={};y={...x}" | grasp -s 'program' --parser '(acorn, {locations: true, ecmaVersion: 2018, sourceType: 'script', allowHashBang: true})'
Cannot read property 'start' of undefined

Acorn can parse this and the result is:
$ echo "x={};y={...x}" | acorn --ecma2018
{
"type": "Program",
"start": 0,
"end": 14,
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 5,
"expression": {
"type": "AssignmentExpression",
"start": 0,
"end": 4,
"operator": "=",
"left": {
"type": "Identifier",
"start": 0,
"end": 1,
"name": "x"
},
"right": {
"type": "ObjectExpression",
"start": 2,
"end": 4,
"properties": []
}
}
},
{
"type": "ExpressionStatement",
"start": 5,
"end": 13,
"expression": {
"type": "AssignmentExpression",
"start": 5,
"end": 13,
"operator": "=",
"left": {
"type": "Identifier",
"start": 5,
"end": 6,
"name": "y"
},
"right": {
"type": "ObjectExpression",
"start": 7,
"end": 13,
"properties": [
{
"type": "SpreadElement",
"start": 8,
"end": 12,
"argument": {
"type": "Identifier",
"start": 11,
"end": 12,
"name": "x"
}
}
]
}
}
}
],
"sourceType": "script"
}

@adros
Copy link
Contributor

adros commented Sep 3, 2019

Flow parser is OK. Error occures in grasp-squery/lib/common.js#17 (property.key is undefined)

See screenshot from debugger
scr

@ainthek
Copy link
Author

ainthek commented Mar 29, 2024

Please any fix for this ?

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