mirror of
https://github.com/github/codeql.git
synced 2026-05-05 05:35:13 +02:00
JS(extractor): support optional chaining
This commit is contained in:
13
javascript/extractor/tests/esnext/input/optional-chaining.js
Normal file
13
javascript/extractor/tests/esnext/input/optional-chaining.js
Normal file
@@ -0,0 +1,13 @@
|
||||
a1?.b1;
|
||||
|
||||
a2?.[x2];
|
||||
|
||||
a3?.b3();
|
||||
|
||||
a4?.();
|
||||
|
||||
o5?.3:2;
|
||||
|
||||
a6?.b6[x6].c6?.(y6).d6;
|
||||
|
||||
delete a?.b
|
||||
@@ -0,0 +1 @@
|
||||
new a?.();
|
||||
@@ -0,0 +1 @@
|
||||
a?.`{b}`;
|
||||
@@ -0,0 +1 @@
|
||||
new a?.b();
|
||||
@@ -0,0 +1 @@
|
||||
a?.b`{c}`;
|
||||
@@ -0,0 +1 @@
|
||||
a?.b = c;
|
||||
@@ -0,0 +1 @@
|
||||
new a.b?.c();
|
||||
@@ -0,0 +1,29 @@
|
||||
a?.b.c(++x).d;
|
||||
|
||||
a?.b[3].c?.(x).d;
|
||||
|
||||
(a?.b).c;
|
||||
|
||||
(a?.b.c).d;
|
||||
|
||||
a?.[b?.c?.d].e?.f;
|
||||
|
||||
a?.()[b?.().c?.().d].e?.().f;
|
||||
|
||||
if (a?.b) {
|
||||
true;
|
||||
} else {
|
||||
false;
|
||||
}
|
||||
|
||||
if (!a?.b) {
|
||||
true;
|
||||
} else {
|
||||
false;
|
||||
}
|
||||
|
||||
if (a?.b && c?.d) {
|
||||
true;
|
||||
} else {
|
||||
false;
|
||||
}
|
||||
Reference in New Issue
Block a user