@babel/helper-member-expression-to-functions
Advanced tools
Comparing version 7.12.17 to 7.13.0
@@ -133,3 +133,3 @@ 'use strict'; | ||
handle(member) { | ||
handle(member, noDocumentAll) { | ||
const { | ||
@@ -264,7 +264,23 @@ node, | ||
const baseMemoised = baseNeedsMemoised ? t.assignmentExpression("=", t.cloneNode(baseRef), t.cloneNode(startingNode)) : t.cloneNode(baseRef); | ||
if (willEndPathCastToBoolean) { | ||
const nonNullishCheck = t.logicalExpression("&&", t.binaryExpression("!==", baseNeedsMemoised ? t.assignmentExpression("=", t.cloneNode(baseRef), t.cloneNode(startingNode)) : t.cloneNode(baseRef), t.nullLiteral()), t.binaryExpression("!==", t.cloneNode(baseRef), scope.buildUndefinedNode())); | ||
let nonNullishCheck; | ||
if (noDocumentAll) { | ||
nonNullishCheck = t.binaryExpression("!=", baseMemoised, t.nullLiteral()); | ||
} else { | ||
nonNullishCheck = t.logicalExpression("&&", t.binaryExpression("!==", baseMemoised, t.nullLiteral()), t.binaryExpression("!==", t.cloneNode(baseRef), scope.buildUndefinedNode())); | ||
} | ||
replacementPath.replaceWith(t.logicalExpression("&&", nonNullishCheck, regular)); | ||
} else { | ||
const nullishCheck = t.logicalExpression("||", t.binaryExpression("===", baseNeedsMemoised ? t.assignmentExpression("=", t.cloneNode(baseRef), t.cloneNode(startingNode)) : t.cloneNode(baseRef), t.nullLiteral()), t.binaryExpression("===", t.cloneNode(baseRef), scope.buildUndefinedNode())); | ||
let nullishCheck; | ||
if (noDocumentAll) { | ||
nullishCheck = t.binaryExpression("==", baseMemoised, t.nullLiteral()); | ||
} else { | ||
nullishCheck = t.logicalExpression("||", t.binaryExpression("===", baseMemoised, t.nullLiteral()), t.binaryExpression("===", t.cloneNode(baseRef), scope.buildUndefinedNode())); | ||
} | ||
replacementPath.replaceWith(t.conditionalExpression(nullishCheck, isDeleteOperation ? t.booleanLiteral(true) : scope.buildUndefinedNode(), regular)); | ||
@@ -271,0 +287,0 @@ } |
{ | ||
"name": "@babel/helper-member-expression-to-functions", | ||
"version": "7.12.17", | ||
"version": "7.13.0", | ||
"description": "Helper function to replace certain member expressions with function calls", | ||
@@ -18,4 +18,4 @@ "repository": { | ||
"dependencies": { | ||
"@babel/types": "^7.12.17" | ||
"@babel/types": "^7.13.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
44490
327
Updated@babel/types@^7.13.0