gameStatusUpdate/node_modules/@babel/generator/lib/generators/methods.js.map

1 line
14 KiB
Plaintext
Raw Normal View History

2024-09-18 08:27:46 -07:00
{"version":3,"names":["_t","require","_index","isIdentifier","_params","node","idNode","parentNode","print","typeParameters","nameInfo","_getFuncIdName","call","sourceIdentifierName","name","pos","token","_parameters","params","noLineTerminator","type","returnType","_noLineTerminator","parameters","exit","enterForStatementInit","paramLength","length","i","_param","space","parameter","printJoin","decorators","optional","typeAnnotation","_methodHead","kind","key","word","async","generator","computed","undefined","_predicate","noLineTerminatorAfter","predicate","_functionHead","parent","_endsWithInnerRaw","id","FunctionExpression","body","ArrowFunctionExpression","firstParam","format","retainLines","hasTypesOrComments","printInnerComments","tokenContext","TokenContext","arrowBody","param","_param$leadingComment","_param$trailingCommen","leadingComments","trailingComments","parentType","left","_id$loc","_id$loc2","loc","start","identifierName","_id$loc3","_id$loc4","value"],"sources":["../../src/generators/methods.ts"],"sourcesContent":["import type Printer from \"../printer.ts\";\nimport type * as t from \"@babel/types\";\nimport { isIdentifier, type ParentMaps } from \"@babel/types\";\nimport { TokenContext } from \"../node/index.ts\";\n\ntype ParentsOf<T extends t.Node> = ParentMaps[T[\"type\"]];\n\nexport function _params(\n this: Printer,\n node: t.Function | t.TSDeclareMethod | t.TSDeclareFunction,\n idNode: t.Expression | t.PrivateName,\n parentNode: ParentsOf<typeof node>,\n) {\n this.print(node.typeParameters);\n\n const nameInfo = _getFuncIdName.call(this, idNode, parentNode);\n if (nameInfo) {\n this.sourceIdentifierName(nameInfo.name, nameInfo.pos);\n }\n\n this.token(\"(\");\n this._parameters(node.params);\n this.token(\")\");\n\n const noLineTerminator = node.type === \"ArrowFunctionExpression\";\n this.print(node.returnType, noLineTerminator);\n\n this._noLineTerminator = noLineTerminator;\n}\n\nexport function _parameters(this: Printer, parameters: t.Function[\"params\"]) {\n const exit = this.enterForStatementInit(false);\n\n const paramLength = parameters.length;\n for (let i = 0; i < paramLength; i++) {\n this._param(parameters[i]);\n\n if (i < parameters.length - 1) {\n this.token(\",\");\n this.space();\n }\n }\n\n exit();\n}\n\nexport function _param(\n this: Printer,\n parameter: t.Identifier | t.RestElement | t.Pattern | t.TSParameterProperty,\n) {\n this.printJoin(parameter.decorators);\n this.print(parameter);\n if (\n // @ts-expect-error optional is not in TSParameterProperty\n parameter.optional\n ) {\n this.token(\"?\"); // TS / flow\n }\n\n this.print(\n // @ts-expect-error typeAnnotation is not in TSParameterProperty\n parameter.typeAnnotation,\n ); // TS / flow\n}\n\nexport function _methodHead(this: Printer, node: t.Method | t.TSDeclareMethod) {\n const kind = node.kind;\n const key = node.key;\n\n if (kind === \"get\" || kind === \"set\") {\n this.word(kind);\n this.space();\n }\n\n if (node.async) {\n this.word(\"async\", true);\n this.space();\n }\n\n if (\n kind === \"method\" ||\n // @ts-expect-error Fixme: kind: \"init\" is not defined\n kind === \"init\"\n ) {\n if (node.generator) {\n this.token(\"*\");\n }\n }\n\n if (node.computed) {\n this.token(\"[\");\n this.print(key);\n this.token(\"]\");\n } else {\n this.print(key);\n }\n\n if (\n // @ts-expect-error optional is not in ObjectMethod\n node.optional\n ) {\n // TS\n this.token(\"?\");\n }\n\n this._params(\n node,\n node.computed && node.key.type !== \"StringLiteral\" ? undefined : node.key,\n undefined,\n );\n}\n\nexport function _predicate(\n this: Printer,\n node:\n | t.FunctionDeclaration\n | t.FunctionExpression\n | t.ArrowFunctionExpression,\n noLineTerminatorAfter?: boolean,\n) {\n if (node.predicate) {\n if (!node.returnType) {\n this.token(\":\");\n }\n this.space();\n this.print(node.predicate, noLineTerminatorAfter);\n }\n}\n\nexport functio