You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0e0f123
Browse filesBrowse the repository at this point in the historyBrowse files
Fix: class transform should not drop method definition when key contains non-BMP characters (#14897)
* polish: improve helper-function-name typings
* fix: support non-BMP method name in class transform
* polish: use nullish coalescing
* add Babel 8 test cases
* update JSDoc annotations
Copy file name to clipboardExpand all lines: packages/babel-helper-function-name/src/index.ts
+18-5Lines changed: 18 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -197,9 +197,22 @@ function visit(
197
197
}
198
198
199
199
/**
200
-
* @param {NodePath} param0
201
-
* @param {Boolean} localBinding whether a name could shadow a self-reference (e.g. converting arrow function)
202
-
* @param {Boolean} supportUnicodeId whether a target support unicodeId or not
200
+
* Add id to function/class expression inferred from the AST
201
+
*
202
+
* @export
203
+
* @template N The unamed expression type
204
+
* @param {Object} nodePathLike The NodePath-like input
205
+
* @param {N} nodePathLike.node an AST node
206
+
* @param {NodePath<N>["parent"]} [nodePathLike.parent] The parent of the AST node
207
+
* @param {Scope} nodePathLike.scope The scope associated to the AST node
208
+
* @param {t.LVal | t.StringLiteral | t.NumericLiteral | t.BigIntLiteral} [nodePathLike.id] the fallback naming source when the helper
209
+
* can not infer the function name from the AST
210
+
* @param {boolean} [localBinding=false] whether a name could shadow a self-reference (e.g. converting arrow function)
211
+
* @param {boolean} [supportUnicodeId=false] whether the compilation target supports unicodeId (non-BMP characters) or not
212
+
* @returns {(N | t.CallExpression | void)}
213
+
* - modified node when name can be inferred,
214
+
* - an IIFE when `node` contains a binding shadowing the inferred function name (e.g. `let f = function (f) {}`),
215
+
* - `void` when `node` has `id` property or the helper can not inferred the name or the inferred name contains non-BMP characters that is not supported by current target
0 commit comments