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: skip transforming delete something.includes #11530

Merged
merged 1 commit into from
May 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/babel-plugin-transform-runtime/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,8 @@ export default declare((api, options, dirname) => {
enter(path) {
if (!injectCoreJS) return;
if (!path.isReferenced()) return;
// skip transforming `delete something.includes`
if (path.parentPath.isUnaryExpression({ operator: "delete" })) return;

const { node } = path;
const { object } = node;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,4 @@ object.values(arg);
Function.bind

object.something(arg);
delete object.bind;
Original file line number Diff line number Diff line change
Expand Up @@ -240,3 +240,4 @@ _valuesInstanceProperty(object).call(object, arg);
_bindInstanceProperty(Function);

object.something(arg);
delete object.bind;
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,4 @@ JSON.parse
Math.pow

Symbol.something
delete Array.from
Original file line number Diff line number Diff line change
Expand Up @@ -275,3 +275,4 @@ Date.something;
JSON.parse;
Math.pow;
_Symbol.something;
delete Array.from;
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ keys(bar).includes;
foo.includes.apply(bar, [1, 2]);

foo.includes = 42;

delete foo.includes;
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ _includesInstanceProperty(keys(bar));
_includesInstanceProperty(foo).apply(bar, [1, 2]);

foo.includes = 42;
delete foo.includes;