OptionalMemberExpression properties are not referenced (#7668)
Fixes #7642.
This commit is contained in:
parent
56cb4baf46
commit
01f4c2368e
@ -17,6 +17,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "7.0.0-beta.44",
|
"@babel/core": "7.0.0-beta.44",
|
||||||
"@babel/helper-plugin-test-runner": "7.0.0-beta.44"
|
"@babel/helper-plugin-test-runner": "7.0.0-beta.44",
|
||||||
|
"@babel/plugin-transform-block-scoping": "7.0.0-beta.44"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
7
packages/babel-plugin-proposal-optional-chaining/test/fixtures/regression/7642/input.js
vendored
Normal file
7
packages/babel-plugin-proposal-optional-chaining/test/fixtures/regression/7642/input.js
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
const foo = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const foo = ({})?.foo;
|
||||||
|
}
|
||||||
3
packages/babel-plugin-proposal-optional-chaining/test/fixtures/regression/7642/options.json
vendored
Normal file
3
packages/babel-plugin-proposal-optional-chaining/test/fixtures/regression/7642/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"plugins": ["proposal-optional-chaining", "transform-block-scoping"]
|
||||||
|
}
|
||||||
8
packages/babel-plugin-proposal-optional-chaining/test/fixtures/regression/7642/output.js
vendored
Normal file
8
packages/babel-plugin-proposal-optional-chaining/test/fixtures/regression/7642/output.js
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
var foo = 1;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
var _ref;
|
||||||
|
|
||||||
|
var _foo = (_ref = {}) === null || _ref === void 0 ? void 0 : _ref.foo;
|
||||||
|
}
|
||||||
@ -14,6 +14,7 @@ export default function isReferenced(node: Object, parent: Object): boolean {
|
|||||||
// no: parent.NODE
|
// no: parent.NODE
|
||||||
case "MemberExpression":
|
case "MemberExpression":
|
||||||
case "JSXMemberExpression":
|
case "JSXMemberExpression":
|
||||||
|
case "OptionalMemberExpression":
|
||||||
if (parent.property === node && parent.computed) {
|
if (parent.property === node && parent.computed) {
|
||||||
return true;
|
return true;
|
||||||
} else if (parent.object === node) {
|
} else if (parent.object === node) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user