Files
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_4->s1_5->s1_6->s1_7->s1_9->s1_11;
s1_1->s1_3->s1_10->s1_11;
s1_4->s1_6->s1_8->s1_9;
s1_11->final;
*/
if (obj?.foo) {
if (obj?.bar) {
foo();
} else {
bar();
}
} else {
qiz();
}
/*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\nIfStatement:enter\nChainExpression:enter\nMemberExpression:enter\nIdentifier (obj)"];
s1_2[label="Identifier (foo)\nMemberExpression:exit"];
s1_3[label="ChainExpression:exit"];
s1_4[label="BlockStatement:enter\nIfStatement:enter\nChainExpression:enter\nMemberExpression:enter\nIdentifier (obj)"];
s1_5[label="Identifier (bar)\nMemberExpression:exit"];
s1_6[label="ChainExpression:exit"];
s1_7[label="BlockStatement:enter\nExpressionStatement:enter\nCallExpression:enter\nIdentifier (foo)\nCallExpression:exit\nExpressionStatement:exit\nBlockStatement:exit"];
s1_9[label="IfStatement:exit\nBlockStatement:exit"];
s1_11[label="IfStatement:exit\nProgram:exit"];
s1_10[label="BlockStatement:enter\nExpressionStatement:enter\nCallExpression:enter\nIdentifier (qiz)\nCallExpression:exit\nExpressionStatement:exit\nBlockStatement:exit"];
s1_8[label="BlockStatement:enter\nExpressionStatement:enter\nCallExpression:enter\nIdentifier (bar)\nCallExpression:exit\nExpressionStatement:exit\nBlockStatement:exit"];
initial->s1_1->s1_2->s1_3->s1_4->s1_5->s1_6->s1_7->s1_9->s1_11;
s1_1->s1_3->s1_10->s1_11;
s1_4->s1_6->s1_8->s1_9;
s1_11->final;
}
*/