This commit is contained in:
2022-07-18 02:50:52 +00:00
parent befd344ab0
commit 06181b34d6
8569 changed files with 818704 additions and 352705 deletions
+21 -17
View File
@@ -3,20 +3,24 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.needsWhitespace = needsWhitespace;
exports.needsWhitespaceBefore = needsWhitespaceBefore;
exports.needsWhitespaceAfter = needsWhitespaceAfter;
exports.needsParens = needsParens;
exports.needsWhitespace = needsWhitespace;
exports.needsWhitespaceAfter = needsWhitespaceAfter;
exports.needsWhitespaceBefore = needsWhitespaceBefore;
var whitespace = _interopRequireWildcard(require("./whitespace"));
var whitespace = require("./whitespace");
var parens = _interopRequireWildcard(require("./parentheses"));
var parens = require("./parentheses");
var t = _interopRequireWildcard(require("@babel/types"));
var _t = require("@babel/types");
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
const {
FLIPPED_ALIAS_KEYS,
isCallExpression,
isExpressionStatement,
isMemberExpression,
isNewExpression
} = _t;
function expandAliases(obj) {
const newObj = {};
@@ -30,7 +34,7 @@ function expandAliases(obj) {
}
for (const type of Object.keys(obj)) {
const aliases = t.FLIPPED_ALIAS_KEYS[type];
const aliases = FLIPPED_ALIAS_KEYS[type];
if (aliases) {
for (const alias of aliases) {
@@ -54,17 +58,17 @@ function find(obj, node, parent, printStack) {
}
function isOrHasCallExpression(node) {
if (t.isCallExpression(node)) {
if (isCallExpression(node)) {
return true;
}
return t.isMemberExpression(node) && isOrHasCallExpression(node.object);
return isMemberExpression(node) && isOrHasCallExpression(node.object);
}
function needsWhitespace(node, parent, type) {
if (!node) return 0;
if (!node) return false;
if (t.isExpressionStatement(node)) {
if (isExpressionStatement(node)) {
node = node.expression;
}
@@ -82,10 +86,10 @@ function needsWhitespace(node, parent, type) {
}
if (typeof linesInfo === "object" && linesInfo !== null) {
return linesInfo[type] || 0;
return linesInfo[type] || false;
}
return 0;
return false;
}
function needsWhitespaceBefore(node, parent) {
@@ -99,7 +103,7 @@ function needsWhitespaceAfter(node, parent) {
function needsParens(node, parent, printStack) {
if (!parent) return false;
if (t.isNewExpression(parent) && parent.callee === node) {
if (isNewExpression(parent) && parent.callee === node) {
if (isOrHasCallExpression(node)) return true;
}
+174 -66
View File
@@ -3,38 +3,90 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.NullableTypeAnnotation = NullableTypeAnnotation;
exports.FunctionTypeAnnotation = FunctionTypeAnnotation;
exports.UpdateExpression = UpdateExpression;
exports.ObjectExpression = ObjectExpression;
exports.DoExpression = DoExpression;
exports.ArrowFunctionExpression = ArrowFunctionExpression;
exports.AssignmentExpression = AssignmentExpression;
exports.Binary = Binary;
exports.IntersectionTypeAnnotation = exports.UnionTypeAnnotation = UnionTypeAnnotation;
exports.BinaryExpression = BinaryExpression;
exports.ClassExpression = ClassExpression;
exports.ConditionalExpression = ConditionalExpression;
exports.DoExpression = DoExpression;
exports.FunctionExpression = FunctionExpression;
exports.FunctionTypeAnnotation = FunctionTypeAnnotation;
exports.Identifier = Identifier;
exports.LogicalExpression = LogicalExpression;
exports.NullableTypeAnnotation = NullableTypeAnnotation;
exports.ObjectExpression = ObjectExpression;
exports.OptionalIndexedAccessType = OptionalIndexedAccessType;
exports.OptionalCallExpression = exports.OptionalMemberExpression = OptionalMemberExpression;
exports.SequenceExpression = SequenceExpression;
exports.TSAsExpression = TSAsExpression;
exports.TSInferType = TSInferType;
exports.TSInstantiationExpression = TSInstantiationExpression;
exports.TSTypeAssertion = TSTypeAssertion;
exports.TSIntersectionType = exports.TSUnionType = TSUnionType;
exports.TSInferType = TSInferType;
exports.BinaryExpression = BinaryExpression;
exports.SequenceExpression = SequenceExpression;
exports.AwaitExpression = exports.YieldExpression = YieldExpression;
exports.ClassExpression = ClassExpression;
exports.UnaryLike = UnaryLike;
exports.FunctionExpression = FunctionExpression;
exports.ArrowFunctionExpression = ArrowFunctionExpression;
exports.ConditionalExpression = ConditionalExpression;
exports.OptionalCallExpression = exports.OptionalMemberExpression = OptionalMemberExpression;
exports.AssignmentExpression = AssignmentExpression;
exports.LogicalExpression = LogicalExpression;
exports.IntersectionTypeAnnotation = exports.UnionTypeAnnotation = UnionTypeAnnotation;
exports.UpdateExpression = UpdateExpression;
exports.AwaitExpression = exports.YieldExpression = YieldExpression;
var t = _interopRequireWildcard(require("@babel/types"));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
var _t = require("@babel/types");
const {
isArrayTypeAnnotation,
isArrowFunctionExpression,
isAssignmentExpression,
isAwaitExpression,
isBinary,
isBinaryExpression,
isUpdateExpression,
isCallExpression,
isClass,
isClassExpression,
isConditional,
isConditionalExpression,
isExportDeclaration,
isExportDefaultDeclaration,
isExpressionStatement,
isFor,
isForInStatement,
isForOfStatement,
isForStatement,
isFunctionExpression,
isIfStatement,
isIndexedAccessType,
isIntersectionTypeAnnotation,
isLogicalExpression,
isMemberExpression,
isNewExpression,
isNullableTypeAnnotation,
isObjectPattern,
isOptionalCallExpression,
isOptionalMemberExpression,
isReturnStatement,
isSequenceExpression,
isSwitchStatement,
isTSArrayType,
isTSAsExpression,
isTSInstantiationExpression,
isTSIntersectionType,
isTSNonNullExpression,
isTSOptionalType,
isTSRestType,
isTSTypeAssertion,
isTSUnionType,
isTaggedTemplateExpression,
isThrowStatement,
isTypeAnnotation,
isUnaryLike,
isUnionTypeAnnotation,
isVariableDeclarator,
isWhileStatement,
isYieldExpression
} = _t;
const PRECEDENCE = {
"||": 0,
"??": 0,
"|>": 0,
"&&": 1,
"|": 2,
"^": 3,
@@ -60,16 +112,18 @@ const PRECEDENCE = {
"**": 10
};
const isClassExtendsClause = (node, parent) => (t.isClassDeclaration(parent) || t.isClassExpression(parent)) && parent.superClass === node;
const isClassExtendsClause = (node, parent) => isClass(parent, {
superClass: node
});
const hasPostfixPart = (node, parent) => (t.isMemberExpression(parent) || t.isOptionalMemberExpression(parent)) && parent.object === node || (t.isCallExpression(parent) || t.isOptionalCallExpression(parent) || t.isNewExpression(parent)) && parent.callee === node || t.isTaggedTemplateExpression(parent) && parent.tag === node || t.isTSNonNullExpression(parent);
const hasPostfixPart = (node, parent) => (isMemberExpression(parent) || isOptionalMemberExpression(parent)) && parent.object === node || (isCallExpression(parent) || isOptionalCallExpression(parent) || isNewExpression(parent)) && parent.callee === node || isTaggedTemplateExpression(parent) && parent.tag === node || isTSNonNullExpression(parent);
function NullableTypeAnnotation(node, parent) {
return t.isArrayTypeAnnotation(parent);
return isArrayTypeAnnotation(parent);
}
function FunctionTypeAnnotation(node, parent, printStack) {
return t.isUnionTypeAnnotation(parent) || t.isIntersectionTypeAnnotation(parent) || t.isArrayTypeAnnotation(parent) || t.isTypeAnnotation(parent) && t.isArrowFunctionExpression(printStack[printStack.length - 3]);
return isUnionTypeAnnotation(parent) || isIntersectionTypeAnnotation(parent) || isArrayTypeAnnotation(parent) || isTypeAnnotation(parent) && isArrowFunctionExpression(printStack[printStack.length - 3]);
}
function UpdateExpression(node, parent) {
@@ -77,17 +131,20 @@ function UpdateExpression(node, parent) {
}
function ObjectExpression(node, parent, printStack) {
return isFirstInStatement(printStack, {
considerArrow: true
return isFirstInContext(printStack, {
expressionStatement: true,
arrowBody: true
});
}
function DoExpression(node, parent, printStack) {
return isFirstInStatement(printStack);
return !node.async && isFirstInContext(printStack, {
expressionStatement: true
});
}
function Binary(node, parent) {
if (node.operator === "**" && t.isBinaryExpression(parent, {
if (node.operator === "**" && isBinaryExpression(parent, {
operator: "**"
})) {
return parent.left === node;
@@ -97,24 +154,30 @@ function Binary(node, parent) {
return true;
}
if (hasPostfixPart(node, parent) || t.isUnaryLike(parent) || t.isAwaitExpression(parent)) {
if (hasPostfixPart(node, parent) || isUnaryLike(parent) || isAwaitExpression(parent)) {
return true;
}
if (t.isBinary(parent)) {
if (isBinary(parent)) {
const parentOp = parent.operator;
const parentPos = PRECEDENCE[parentOp];
const nodeOp = node.operator;
const nodePos = PRECEDENCE[nodeOp];
if (parentPos === nodePos && parent.right === node && !t.isLogicalExpression(parent) || parentPos > nodePos) {
if (parentPos === nodePos && parent.right === node && !isLogicalExpression(parent) || parentPos > nodePos) {
return true;
}
}
}
function UnionTypeAnnotation(node, parent) {
return t.isArrayTypeAnnotation(parent) || t.isNullableTypeAnnotation(parent) || t.isIntersectionTypeAnnotation(parent) || t.isUnionTypeAnnotation(parent);
return isArrayTypeAnnotation(parent) || isNullableTypeAnnotation(parent) || isIntersectionTypeAnnotation(parent) || isUnionTypeAnnotation(parent);
}
function OptionalIndexedAccessType(node, parent) {
return isIndexedAccessType(parent, {
objectType: node
});
}
function TSAsExpression() {
@@ -126,19 +189,23 @@ function TSTypeAssertion() {
}
function TSUnionType(node, parent) {
return t.isTSArrayType(parent) || t.isTSOptionalType(parent) || t.isTSIntersectionType(parent) || t.isTSUnionType(parent) || t.isTSRestType(parent);
return isTSArrayType(parent) || isTSOptionalType(parent) || isTSIntersectionType(parent) || isTSUnionType(parent) || isTSRestType(parent);
}
function TSInferType(node, parent) {
return t.isTSArrayType(parent) || t.isTSOptionalType(parent);
return isTSArrayType(parent) || isTSOptionalType(parent);
}
function TSInstantiationExpression(node, parent) {
return (isCallExpression(parent) || isOptionalCallExpression(parent) || isNewExpression(parent) || isTSInstantiationExpression(parent)) && !!parent.typeParameters;
}
function BinaryExpression(node, parent) {
return node.operator === "in" && (t.isVariableDeclarator(parent) || t.isFor(parent));
return node.operator === "in" && (isVariableDeclarator(parent) || isFor(parent));
}
function SequenceExpression(node, parent) {
if (t.isForStatement(parent) || t.isThrowStatement(parent) || t.isReturnStatement(parent) || t.isIfStatement(parent) && parent.test === node || t.isWhileStatement(parent) && parent.test === node || t.isForInStatement(parent) && parent.right === node || t.isSwitchStatement(parent) && parent.discriminant === node || t.isExpressionStatement(parent) && parent.expression === node) {
if (isForStatement(parent) || isThrowStatement(parent) || isReturnStatement(parent) || isIfStatement(parent) && parent.test === node || isWhileStatement(parent) && parent.test === node || isForInStatement(parent) && parent.right === node || isSwitchStatement(parent) && parent.discriminant === node || isExpressionStatement(parent) && parent.expression === node) {
return false;
}
@@ -146,36 +213,38 @@ function SequenceExpression(node, parent) {
}
function YieldExpression(node, parent) {
return t.isBinary(parent) || t.isUnaryLike(parent) || hasPostfixPart(node, parent) || t.isAwaitExpression(parent) && t.isYieldExpression(node) || t.isConditionalExpression(parent) && node === parent.test || isClassExtendsClause(node, parent);
return isBinary(parent) || isUnaryLike(parent) || hasPostfixPart(node, parent) || isAwaitExpression(parent) && isYieldExpression(node) || isConditionalExpression(parent) && node === parent.test || isClassExtendsClause(node, parent);
}
function ClassExpression(node, parent, printStack) {
return isFirstInStatement(printStack, {
considerDefaultExports: true
return isFirstInContext(printStack, {
expressionStatement: true,
exportDefault: true
});
}
function UnaryLike(node, parent) {
return hasPostfixPart(node, parent) || t.isBinaryExpression(parent, {
return hasPostfixPart(node, parent) || isBinaryExpression(parent, {
operator: "**",
left: node
}) || isClassExtendsClause(node, parent);
}
function FunctionExpression(node, parent, printStack) {
return isFirstInStatement(printStack, {
considerDefaultExports: true
return isFirstInContext(printStack, {
expressionStatement: true,
exportDefault: true
});
}
function ArrowFunctionExpression(node, parent) {
return t.isExportDeclaration(parent) || ConditionalExpression(node, parent);
return isExportDeclaration(parent) || ConditionalExpression(node, parent);
}
function ConditionalExpression(node, parent) {
if (t.isUnaryLike(parent) || t.isBinary(parent) || t.isConditionalExpression(parent, {
if (isUnaryLike(parent) || isBinary(parent) || isConditionalExpression(parent, {
test: node
}) || t.isAwaitExpression(parent) || t.isTSTypeAssertion(parent) || t.isTSAsExpression(parent)) {
}) || isAwaitExpression(parent) || isTSTypeAssertion(parent) || isTSAsExpression(parent)) {
return true;
}
@@ -183,62 +252,101 @@ function ConditionalExpression(node, parent) {
}
function OptionalMemberExpression(node, parent) {
return t.isCallExpression(parent, {
return isCallExpression(parent, {
callee: node
}) || t.isMemberExpression(parent, {
}) || isMemberExpression(parent, {
object: node
});
}
function AssignmentExpression(node, parent, printStack) {
if (t.isObjectPattern(node.left)) {
function AssignmentExpression(node, parent) {
if (isObjectPattern(node.left)) {
return true;
} else {
return ConditionalExpression(node, parent, printStack);
return ConditionalExpression(node, parent);
}
}
function LogicalExpression(node, parent) {
switch (node.operator) {
case "||":
if (!t.isLogicalExpression(parent)) return false;
if (!isLogicalExpression(parent)) return false;
return parent.operator === "??" || parent.operator === "&&";
case "&&":
return t.isLogicalExpression(parent, {
return isLogicalExpression(parent, {
operator: "??"
});
case "??":
return t.isLogicalExpression(parent) && parent.operator !== "??";
return isLogicalExpression(parent) && parent.operator !== "??";
}
}
function isFirstInStatement(printStack, {
considerArrow = false,
considerDefaultExports = false
} = {}) {
function Identifier(node, parent, printStack) {
var _node$extra;
if ((_node$extra = node.extra) != null && _node$extra.parenthesized && isAssignmentExpression(parent, {
left: node
}) && (isFunctionExpression(parent.right) || isClassExpression(parent.right)) && parent.right.id == null) {
return true;
}
if (node.name === "let") {
const isFollowedByBracket = isMemberExpression(parent, {
object: node,
computed: true
}) || isOptionalMemberExpression(parent, {
object: node,
computed: true,
optional: false
});
return isFirstInContext(printStack, {
expressionStatement: isFollowedByBracket,
forHead: isFollowedByBracket,
forInHead: isFollowedByBracket,
forOfHead: true
});
}
return node.name === "async" && isForOfStatement(parent) && node === parent.left;
}
function isFirstInContext(printStack, {
expressionStatement = false,
arrowBody = false,
exportDefault = false,
forHead = false,
forInHead = false,
forOfHead = false
}) {
let i = printStack.length - 1;
let node = printStack[i];
i--;
let parent = printStack[i];
while (i > 0) {
if (t.isExpressionStatement(parent, {
while (i >= 0) {
if (expressionStatement && isExpressionStatement(parent, {
expression: node
}) || considerDefaultExports && t.isExportDefaultDeclaration(parent, {
}) || exportDefault && isExportDefaultDeclaration(parent, {
declaration: node
}) || considerArrow && t.isArrowFunctionExpression(parent, {
}) || arrowBody && isArrowFunctionExpression(parent, {
body: node
}) || forHead && isForStatement(parent, {
init: node
}) || forInHead && isForInStatement(parent, {
left: node
}) || forOfHead && isForOfStatement(parent, {
left: node
})) {
return true;
}
if (hasPostfixPart(node, parent) && !t.isNewExpression(parent) || t.isSequenceExpression(parent) && parent.expressions[0] === node || t.isConditional(parent, {
if (hasPostfixPart(node, parent) && !isNewExpression(parent) || isSequenceExpression(parent) && parent.expressions[0] === node || isUpdateExpression(parent) && !parent.prefix || isConditional(parent, {
test: node
}) || t.isBinary(parent, {
}) || isBinary(parent, {
left: node
}) || t.isAssignmentExpression(parent, {
}) || isAssignmentExpression(parent, {
left: node
})) {
node = parent;
+43 -34
View File
@@ -3,27 +3,40 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.list = exports.nodes = void 0;
exports.nodes = exports.list = void 0;
var t = _interopRequireWildcard(require("@babel/types"));
var _t = require("@babel/types");
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
const {
FLIPPED_ALIAS_KEYS,
isArrayExpression,
isAssignmentExpression,
isBinary,
isBlockStatement,
isCallExpression,
isFunction,
isIdentifier,
isLiteral,
isMemberExpression,
isObjectExpression,
isOptionalCallExpression,
isOptionalMemberExpression,
isStringLiteral
} = _t;
function crawl(node, state = {}) {
if (t.isMemberExpression(node) || t.isOptionalMemberExpression(node)) {
if (isMemberExpression(node) || isOptionalMemberExpression(node)) {
crawl(node.object, state);
if (node.computed) crawl(node.property, state);
} else if (t.isBinary(node) || t.isAssignmentExpression(node)) {
} else if (isBinary(node) || isAssignmentExpression(node)) {
crawl(node.left, state);
crawl(node.right, state);
} else if (t.isCallExpression(node) || t.isOptionalCallExpression(node)) {
} else if (isCallExpression(node) || isOptionalCallExpression(node)) {
state.hasCall = true;
crawl(node.callee, state);
} else if (t.isFunction(node)) {
} else if (isFunction(node)) {
state.hasFunction = true;
} else if (t.isIdentifier(node)) {
} else if (isIdentifier(node)) {
state.hasHelper = state.hasHelper || isHelper(node.callee);
}
@@ -31,21 +44,21 @@ function crawl(node, state = {}) {
}
function isHelper(node) {
if (t.isMemberExpression(node)) {
if (isMemberExpression(node)) {
return isHelper(node.object) || isHelper(node.property);
} else if (t.isIdentifier(node)) {
} else if (isIdentifier(node)) {
return node.name === "require" || node.name[0] === "_";
} else if (t.isCallExpression(node)) {
} else if (isCallExpression(node)) {
return isHelper(node.callee);
} else if (t.isBinary(node) || t.isAssignmentExpression(node)) {
return t.isIdentifier(node.left) && isHelper(node.left) || isHelper(node.right);
} else if (isBinary(node) || isAssignmentExpression(node)) {
return isIdentifier(node.left) && isHelper(node.left) || isHelper(node.right);
} else {
return false;
}
}
function isType(node) {
return t.isLiteral(node) || t.isObjectExpression(node) || t.isArrayExpression(node) || t.isIdentifier(node) || t.isMemberExpression(node);
return isLiteral(node) || isObjectExpression(node) || isArrayExpression(node) || isIdentifier(node) || isMemberExpression(node);
}
const nodes = {
@@ -62,13 +75,13 @@ const nodes = {
SwitchCase(node, parent) {
return {
before: node.consequent.length || parent.cases[0] === node,
before: !!node.consequent.length || parent.cases[0] === node,
after: !node.consequent.length && parent.cases[parent.cases.length - 1] === node
};
},
LogicalExpression(node) {
if (t.isFunction(node.left) || t.isFunction(node.right)) {
if (isFunction(node.left) || isFunction(node.right)) {
return {
after: true
};
@@ -76,7 +89,7 @@ const nodes = {
},
Literal(node) {
if (node.value === "use strict") {
if (isStringLiteral(node) && node.value === "use strict") {
return {
after: true
};
@@ -84,7 +97,7 @@ const nodes = {
},
CallExpression(node) {
if (t.isFunction(node.callee) || isHelper(node)) {
if (isFunction(node.callee) || isHelper(node)) {
return {
before: true,
after: true
@@ -93,7 +106,7 @@ const nodes = {
},
OptionalCallExpression(node) {
if (t.isFunction(node.callee)) {
if (isFunction(node.callee)) {
return {
before: true,
after: true
@@ -121,7 +134,7 @@ const nodes = {
},
IfStatement(node) {
if (t.isBlockStatement(node.consequent)) {
if (isBlockStatement(node.consequent)) {
return {
before: true,
after: true
@@ -143,7 +156,7 @@ nodes.ObjectProperty = nodes.ObjectTypeProperty = nodes.ObjectMethod = function
nodes.ObjectTypeCallProperty = function (node, parent) {
var _parent$properties;
if (parent.callProperties[0] === node && !((_parent$properties = parent.properties) == null ? void 0 : _parent$properties.length)) {
if (parent.callProperties[0] === node && !((_parent$properties = parent.properties) != null && _parent$properties.length)) {
return {
before: true
};
@@ -153,7 +166,7 @@ nodes.ObjectTypeCallProperty = function (node, parent) {
nodes.ObjectTypeIndexer = function (node, parent) {
var _parent$properties2, _parent$callPropertie;
if (parent.indexers[0] === node && !((_parent$properties2 = parent.properties) == null ? void 0 : _parent$properties2.length) && !((_parent$callPropertie = parent.callProperties) == null ? void 0 : _parent$callPropertie.length)) {
if (parent.indexers[0] === node && !((_parent$properties2 = parent.properties) != null && _parent$properties2.length) && !((_parent$callPropertie = parent.callProperties) != null && _parent$callPropertie.length)) {
return {
before: true
};
@@ -163,7 +176,7 @@ nodes.ObjectTypeIndexer = function (node, parent) {
nodes.ObjectTypeInternalSlot = function (node, parent) {
var _parent$properties3, _parent$callPropertie2, _parent$indexers;
if (parent.internalSlots[0] === node && !((_parent$properties3 = parent.properties) == null ? void 0 : _parent$properties3.length) && !((_parent$callPropertie2 = parent.callProperties) == null ? void 0 : _parent$callPropertie2.length) && !((_parent$indexers = parent.indexers) == null ? void 0 : _parent$indexers.length)) {
if (parent.internalSlots[0] === node && !((_parent$properties3 = parent.properties) != null && _parent$properties3.length) && !((_parent$callPropertie2 = parent.callProperties) != null && _parent$callPropertie2.length) && !((_parent$indexers = parent.indexers) != null && _parent$indexers.length)) {
return {
before: true
};
@@ -186,16 +199,12 @@ const list = {
};
exports.list = list;
[["Function", true], ["Class", true], ["Loop", true], ["LabeledStatement", true], ["SwitchStatement", true], ["TryStatement", true]].forEach(function ([type, amounts]) {
if (typeof amounts === "boolean") {
amounts = {
after: amounts,
before: amounts
};
}
[type].concat(t.FLIPPED_ALIAS_KEYS[type] || []).forEach(function (type) {
[type].concat(FLIPPED_ALIAS_KEYS[type] || []).forEach(function (type) {
nodes[type] = function () {
return amounts;
return {
after: amounts,
before: amounts
};
};
});
});