Files
eslint/tests/fixtures/code-path-analysis/optional-chaining--complex-1.js
186559de0a Update: optional chaining support (fixes #12642) (#13416)
* update deps (to branch)

* trivial fix for debug output

* update code path analysis

* update accessor-pairs

* update array-callback-return

* add tests for camelcase

* add tests for computed-property-spacing

* update dot-location

* update dot-notation

* update func-name-matching

* update global-require

* update indent

* add tests for getter-return

* update new-cap

* update newline-per-chained-call

* update no-alert

* update no-extend-native

* update no-extra-bind

* update no-extra-parens

* update no-eval

* update no-implicit-coercion

* update eslint-utils

* update no-implied-eval

* update no-import-assign

* update no-magic-numbers

* update no-obj-calls

* update no-prototype-builtins

* add tests for no-restricted-syntax

* update no-self-assign

* update no-setter-return

* update no-unexpected-multiline

* update no-unused-expression

* update no-useless-call

* update no-whitespace-before-property

* update operator-assignment

* update padding-line-between-statements

* update prefer-arrow-callback

* add tests for prefer-destructuring

* update prefer-exponentiation-operator

* update prefer-numeric-literals

* update prefer-promise-reject-errors

* update prefer-regex-literals

* update prefer-spread

* update use-isnan

* update yoda

* update wrap-iife

* remove __proto__

* fix no-import-assign for delete op

* update eslint-visitor-keys

* fix no-unexpected-multiline to just ignore optional chaining

* update func-call-spacing

* update constructor-super

* update dot-location for unstable sort

* update no-extra-boolean-cast

* update func-call-spacing

* update no-extra-parens for false positive on IIFE

* update array-callback-return

* update no-invalid-this (astUtils.isDefaultThisBinding)

* update radix

* update a comment in no-implicit-coercion

* update comments in no-extra-bind

* remove unnecessary change from array-callback-return

* update dot-notation for autofix about `let?.[`

* update new-cap

* update wrap-iife

* update prefer-arrow-callback

* change isSameReference to handle `a.b` and `a?.b` are same

* fix code path analysis for `node.arguments.length == 0` case

* update `astUtils.couldBeError`

* update `astUtils.isMethodWhichHasThisArg`

* improve coverage

* fix isMethodWhichHasThisArg

* update no-self-assign

* Upgrade: [email protected]

Co-authored-by: Kai Cataldo <[email protected]>
2020-07-18 12:40:43 -04:00

39 lines
1.7 KiB
JavaScript

/*expected
initial->s1_1->s1_2->s1_3->s1_5->s1_6->s1_7->s1_8->s1_9->s1_10->s1_11->s1_12->s1_13->s1_16;
s1_1->s1_16;
s1_2->s1_4->s1_5->s1_16;
s1_6->s1_8->s1_16;
s1_9->s1_11->s1_13;
s1_16->final;
*/
obj?.[cond ? k1 : k2]?.[k3 || k4]?.(a1 && a2, b1 ?? b2).foo(arg)
/*DOT
digraph {
node[shape=box,style="rounded,filled",fillcolor=white];
initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25];
final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25];
s1_1[label="Program:enter\nExpressionStatement:enter\nChainExpression:enter\nCallExpression:enter\nMemberExpression:enter\nCallExpression:enter\nMemberExpression:enter\nMemberExpression:enter\nIdentifier (obj)"];
s1_2[label="ConditionalExpression:enter\nIdentifier (cond)"];
s1_3[label="Identifier (k1)"];
s1_5[label="ConditionalExpression:exit\nMemberExpression:exit"];
s1_6[label="LogicalExpression:enter\nIdentifier (k3)"];
s1_7[label="Identifier (k4)"];
s1_8[label="LogicalExpression:exit\nMemberExpression:exit"];
s1_9[label="LogicalExpression:enter\nIdentifier (a1)"];
s1_10[label="Identifier (a2)"];
s1_11[label="LogicalExpression:exit\nLogicalExpression:enter\nIdentifier (b1)"];
s1_12[label="Identifier (b2)"];
s1_13[label="LogicalExpression:exit\nCallExpression:exit\nIdentifier (foo)\nMemberExpression:exit\nIdentifier (arg)\nCallExpression:exit"];
s1_16[label="ChainExpression:exit\nExpressionStatement:exit\nProgram:exit"];
s1_4[label="Identifier (k2)"];
initial->s1_1->s1_2->s1_3->s1_5->s1_6->s1_7->s1_8->s1_9->s1_10->s1_11->s1_12->s1_13->s1_16;
s1_1->s1_16;
s1_2->s1_4->s1_5->s1_16;
s1_6->s1_8->s1_16;
s1_9->s1_11->s1_13;
s1_16->final;
}
*/