Rich-Harris / periscopic

Utility for analyzing scopes belonging to an ESTree-compliant AST

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support optional chaining

Conduitry opened this issue · comments

ES2020's optional chaining brings some additions to the AST that will need to be addressed here (and in code-red) before they can be supported in Svelte.

The PR estree/estree#204 has not been merged yet but the spec apparently is final. Roughly, there's a new ChainExpression type that only has an expression key, and it's this expression that contains the chain of member and call expressions with a new optional boolean on each one.

Before this can be done properly, we might need to wait for @types/estree to be released.

Digging more into what this library is doing, I'm beginning to think there isn't any work here to do. The only place where we're specially interacting with MemberExpressions is in extracting identifiers/names from variable declarations and function parameters, and ChainExpressions can't occur there in a way that would affect us.