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

Fix JS optional-chained member expression. #467

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3189,22 +3189,22 @@ inherit .containing_class_value
;; ##### Member Expressions

(member_expression
(_)@object . (_)@property)@member_expr
{

node member_push
node property_push
object:(_)@object
property:(_)@property
)@member_expr {
node member_push
node property_push

; scopes flow into object then back out
edge @object.before_scope -> @member_expr.before_scope
edge @member_expr.after_scope -> @object.after_scope

; value is a member projection on the value of the object ie. a push then push dot
attr (member_push) push_symbol = "GUARD:MEMBER"
attr (property_push) node_reference = @property
edge property_push -> member_push
edge @member_expr.value -> property_push
edge member_push -> @object.value
attr (member_push) push_symbol = "GUARD:MEMBER"
attr (property_push) node_reference = @property
edge property_push -> member_push
edge @member_expr.value -> property_push
edge member_push -> @object.value

; (member_expression) nodes can occur in patterns
node @member_expr.covalue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@ let x = 1;
// Flow around

/**/ x;
// ^ defined: 1
// ^ defined: 1

// Optional chain

/**/ x?.foo
// ^ defined: 1
Loading