(node: Node, module: SourceModule)
| 2970 | |
| 2971 | // whether a computed `this[k]` value cannot escape as a callable function |
| 2972 | const isNonEscapingRead = (node: Node, module: SourceModule): boolean => { |
| 2973 | const [operand, parent] = operatorOf(node) |
| 2974 | if (!parent) return false |
| 2975 | if (parent.type === "ExpressionStatement") return true |
| 2976 | if (parent.type === "UnaryExpression") return true |
| 2977 | if (parent.type === "BinaryExpression") return parent.operator !== "in" |
| 2978 | if (parent.type === "TemplateLiteral") |
| 2979 | return parent.parent?.type !== "TaggedTemplateExpression" |
| 2980 | if (parent.type === "CallExpression" && parent.callee !== operand) { |
| 2981 | const name = globalNameOf(parent.callee, module) |
| 2982 | return !!name && nonCallingGlobals.has(name) |
| 2983 | } |
| 2984 | return false |
| 2985 | } |
no test coverage detected