Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / @typescript-eslint / experimental-utils / dist / ast-utils / eslint-utils / astUtilities.js
1 "use strict";
2 var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3     if (k2 === undefined) k2 = k;
4     Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5 }) : (function(o, m, k, k2) {
6     if (k2 === undefined) k2 = k;
7     o[k2] = m[k];
8 }));
9 var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10     Object.defineProperty(o, "default", { enumerable: true, value: v });
11 }) : function(o, v) {
12     o["default"] = v;
13 });
14 var __importStar = (this && this.__importStar) || function (mod) {
15     if (mod && mod.__esModule) return mod;
16     var result = {};
17     if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18     __setModuleDefault(result, mod);
19     return result;
20 };
21 Object.defineProperty(exports, "__esModule", { value: true });
22 exports.isParenthesized = exports.hasSideEffect = exports.getStringIfConstant = exports.getStaticValue = exports.getPropertyName = exports.getFunctionNameWithKind = exports.getFunctionHeadLocation = void 0;
23 const eslintUtils = __importStar(require("eslint-utils"));
24 /**
25  * Get the proper location of a given function node to report.
26  *
27  * @see {@link https://eslint-utils.mysticatea.dev/api/ast-utils.html#getfunctionheadlocation}
28  */
29 const getFunctionHeadLocation = eslintUtils.getFunctionHeadLocation;
30 exports.getFunctionHeadLocation = getFunctionHeadLocation;
31 /**
32  * Get the name and kind of a given function node.
33  *
34  * @see {@link https://eslint-utils.mysticatea.dev/api/ast-utils.html#getfunctionnamewithkind}
35  */
36 const getFunctionNameWithKind = eslintUtils.getFunctionNameWithKind;
37 exports.getFunctionNameWithKind = getFunctionNameWithKind;
38 /**
39  * Get the property name of a given property node.
40  * If the node is a computed property, this tries to compute the property name by the getStringIfConstant function.
41  *
42  * @see {@link https://eslint-utils.mysticatea.dev/api/ast-utils.html#getpropertyname}
43  * @returns The property name of the node. If the property name is not constant then it returns `null`.
44  */
45 const getPropertyName = eslintUtils.getPropertyName;
46 exports.getPropertyName = getPropertyName;
47 /**
48  * Get the value of a given node if it can decide the value statically.
49  * If the 2nd parameter `initialScope` was given, this function tries to resolve identifier references which are in the
50  * given node as much as possible. In the resolving way, it does on the assumption that built-in global objects have
51  * not been modified.
52  * For example, it considers `Symbol.iterator`, ` String.raw``hello`` `, and `Object.freeze({a: 1}).a` as static.
53  *
54  * @see {@link https://eslint-utils.mysticatea.dev/api/ast-utils.html#getstaticvalue}
55  * @returns The `{ value: any }` shaped object. The `value` property is the static value. If it couldn't compute the
56  * static value of the node, it returns `null`.
57  */
58 const getStaticValue = eslintUtils.getStaticValue;
59 exports.getStaticValue = getStaticValue;
60 /**
61  * Get the string value of a given node.
62  * This function is a tiny wrapper of the getStaticValue function.
63  *
64  * @see {@link https://eslint-utils.mysticatea.dev/api/ast-utils.html#getstringifconstant}
65  */
66 const getStringIfConstant = eslintUtils.getStringIfConstant;
67 exports.getStringIfConstant = getStringIfConstant;
68 /**
69  * Check whether a given node has any side effect or not.
70  * The side effect means that it may modify a certain variable or object member. This function considers the node which
71  * contains the following types as the node which has side effects:
72  * - `AssignmentExpression`
73  * - `AwaitExpression`
74  * - `CallExpression`
75  * - `ImportExpression`
76  * - `NewExpression`
77  * - `UnaryExpression([operator = "delete"])`
78  * - `UpdateExpression`
79  * - `YieldExpression`
80  * - When `options.considerGetters` is `true`:
81  *   - `MemberExpression`
82  * - When `options.considerImplicitTypeConversion` is `true`:
83  *   - `BinaryExpression([operator = "==" | "!=" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "|" | "^" | "&" | "in"])`
84  *   - `MemberExpression([computed = true])`
85  *   - `MethodDefinition([computed = true])`
86  *   - `Property([computed = true])`
87  *   - `UnaryExpression([operator = "-" | "+" | "!" | "~"])`
88  *
89  * @see {@link https://eslint-utils.mysticatea.dev/api/ast-utils.html#hassideeffect}
90  */
91 const hasSideEffect = eslintUtils.hasSideEffect;
92 exports.hasSideEffect = hasSideEffect;
93 /**
94  * Check whether a given node is parenthesized or not.
95  * This function detects it correctly even if it's parenthesized by specific syntax.
96  *
97  * @see {@link https://eslint-utils.mysticatea.dev/api/ast-utils.html#isparenthesized}
98  * @returns `true` if the node is parenthesized.
99  * If `times` was given, it returns `true` only if the node is parenthesized the `times` times.
100  * For example, `isParenthesized(2, node, sourceCode)` returns true for `((foo))`, but not for `(foo)`.
101  */
102 const isParenthesized = eslintUtils.isParenthesized;
103 exports.isParenthesized = isParenthesized;
104 //# sourceMappingURL=astUtilities.js.map