Ignore:
Timestamp:
12/12/24 17:06:06 (5 weeks ago)
Author:
stefan toskovski <stefantoska84@…>
Branches:
main
Parents:
d565449
Message:

Pred finalna verzija

File:
1 edited

Legend:

Unmodified
Added
Removed
  • imaps-frontend/node_modules/@babel/generator/lib/node/parentheses.js

    rd565449 r0c6b92a  
    44  value: true
    55});
    6 exports.ArrowFunctionExpression = ArrowFunctionExpression;
    76exports.AssignmentExpression = AssignmentExpression;
    87exports.Binary = Binary;
    98exports.BinaryExpression = BinaryExpression;
    109exports.ClassExpression = ClassExpression;
    11 exports.ConditionalExpression = ConditionalExpression;
     10exports.ArrowFunctionExpression = exports.ConditionalExpression = ConditionalExpression;
    1211exports.DoExpression = DoExpression;
    1312exports.FunctionExpression = FunctionExpression;
     
    3433  isBinaryExpression,
    3534  isCallExpression,
    36   isExportDeclaration,
    3735  isForOfStatement,
    3836  isIndexedAccessType,
     
    4038  isObjectPattern,
    4139  isOptionalMemberExpression,
    42   isYieldExpression
     40  isYieldExpression,
     41  isStatement
    4342} = _t;
    4443const PRECEDENCE = new Map([["||", 0], ["??", 0], ["|>", 0], ["&&", 1], ["|", 2], ["^", 3], ["&", 4], ["==", 5], ["===", 5], ["!=", 5], ["!==", 5], ["<", 6], [">", 6], ["<=", 6], [">=", 6], ["in", 6], ["instanceof", 6], [">>", 7], ["<<", 7], [">>>", 7], ["+", 8], ["-", 8], ["*", 9], ["/", 9], ["%", 9], ["**", 10]]);
     
    6766function FunctionTypeAnnotation(node, parent, tokenContext) {
    6867  const parentType = parent.type;
    69   return parentType === "UnionTypeAnnotation" || parentType === "IntersectionTypeAnnotation" || parentType === "ArrayTypeAnnotation" || Boolean(tokenContext & _index.TokenContext.arrowFlowReturnType);
     68  return (parentType === "UnionTypeAnnotation" || parentType === "IntersectionTypeAnnotation" || parentType === "ArrayTypeAnnotation" || Boolean(tokenContext & _index.TokenContext.arrowFlowReturnType)
     69  );
    7070}
    7171function UpdateExpression(node, parent) {
    7272  return hasPostfixPart(node, parent) || isClassExtendsClause(node, parent);
    7373}
     74function needsParenBeforeExpressionBrace(tokenContext) {
     75  return Boolean(tokenContext & (_index.TokenContext.expressionStatement | _index.TokenContext.arrowBody));
     76}
    7477function ObjectExpression(node, parent, tokenContext) {
    75   return Boolean(tokenContext & (_index.TokenContext.expressionStatement | _index.TokenContext.arrowBody));
     78  return needsParenBeforeExpressionBrace(tokenContext);
    7679}
    7780function DoExpression(node, parent, tokenContext) {
     
    116119function TSUnionType(node, parent) {
    117120  const parentType = parent.type;
    118   return parentType === "TSArrayType" || parentType === "TSOptionalType" || parentType === "TSIntersectionType" || parentType === "TSUnionType" || parentType === "TSRestType";
     121  return parentType === "TSArrayType" || parentType === "TSOptionalType" || parentType === "TSIntersectionType" || parentType === "TSRestType";
    119122}
    120123function TSInferType(node, parent) {
     
    131134function SequenceExpression(node, parent) {
    132135  const parentType = parent.type;
    133   if (parentType === "ForStatement" || parentType === "ThrowStatement" || parentType === "ReturnStatement" || parentType === "IfStatement" && parent.test === node || parentType === "WhileStatement" && parent.test === node || parentType === "ForInStatement" && parent.right === node || parentType === "SwitchStatement" && parent.discriminant === node || parentType === "ExpressionStatement" && parent.expression === node) {
     136  if (parentType === "SequenceExpression" || parentType === "ParenthesizedExpression" || parentType === "MemberExpression" && parent.property === node || parentType === "OptionalMemberExpression" && parent.property === node || parentType === "TemplateLiteral") {
    134137    return false;
    135138  }
    136   return true;
     139  if (parentType === "ClassDeclaration") {
     140    return true;
     141  }
     142  if (parentType === "ForOfStatement") {
     143    return parent.right === node;
     144  }
     145  if (parentType === "ExportDefaultDeclaration") {
     146    return true;
     147  }
     148  return !isStatement(parent);
    137149}
    138150function YieldExpression(node, parent) {
     
    149161  return Boolean(tokenContext & (_index.TokenContext.expressionStatement | _index.TokenContext.exportDefault));
    150162}
    151 function ArrowFunctionExpression(node, parent) {
    152   return isExportDeclaration(parent) || ConditionalExpression(node, parent);
    153 }
    154163function ConditionalExpression(node, parent) {
    155164  const parentType = parent.type;
     
    162171  return isCallExpression(parent) && parent.callee === node || isMemberExpression(parent) && parent.object === node;
    163172}
    164 function AssignmentExpression(node, parent) {
    165   if (isObjectPattern(node.left)) {
     173function AssignmentExpression(node, parent, tokenContext) {
     174  if (needsParenBeforeExpressionBrace(tokenContext) && isObjectPattern(node.left)) {
    166175    return true;
    167176  } else {
     
    182191  }
    183192}
    184 function Identifier(node, parent, tokenContext) {
     193function Identifier(node, parent, tokenContext, _inForInit, getRawIdentifier) {
    185194  var _node$extra;
    186195  const parentType = parent.type;
     
    190199      return true;
    191200    }
     201  }
     202  if (getRawIdentifier && getRawIdentifier(node) !== node.name) {
     203    return false;
    192204  }
    193205  if (node.name === "let") {
Note: See TracChangeset for help on using the changeset viewer.