Skip to content

Commit cacc894

Browse files
committed
infer function names at runtime for computed properties
1 parent 2c0a71e commit cacc894

2 files changed

Lines changed: 34 additions & 1 deletion

File tree

src/changes/changes.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
<body>
1010
<release version="4.16.0" date="August 17, 2025" description="StringUtils, Brotli, spread for object literals, Bugfixes">
11+
<action type="update" dev="RhinoTeam">
12+
core-js: infer function names at runtime for computed properties
13+
</action>
1114
<action type="add" dev="rbri">
1215
core-js: Several fixes for calling bind() in the interpreter (regression from 4.14.0)
1316
</action>

src/test/java/org/htmlunit/javascript/FunctionsTest.java

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,6 @@ public void boundWithArg() throws Exception {
326326
loadPageVerifyTitle2(html);
327327
}
328328

329-
330329
/**
331330
* @throws Exception if the test fails
332331
*/
@@ -348,4 +347,35 @@ public void bound() throws Exception {
348347

349348
loadPageVerifyTitle2(html);
350349
}
350+
351+
/**
352+
* @throws Exception if the test fails
353+
*/
354+
@Test
355+
@Alerts({"f1", "f2", "f3", "f4", "f5",
356+
"f6", "g", "3", "[foo]", ""})
357+
public void name() throws Exception {
358+
final String html = DOCTYPE_HTML
359+
+ "<html><head></head>\n"
360+
+ "<body>\n"
361+
+ "<script>\n"
362+
+ LOG_TITLE_FUNCTION
363+
364+
+ "let f1 = function() {}; log(f1.name);\n"
365+
+ "let f2= () => {}; log(f2.name);\n"
366+
+ "let f3 = function() {}; log(f3.name);\n"
367+
+ "let f4 = () => {}; log(f4.name);\n"
368+
+ "let f5 = function() {}; log(f5.name);\n"
369+
370+
+ "let f6 = () => {}; log(f6.name);\n"
371+
+ "let f7 = function g() {}; log(f7.name);\n"
372+
+ "let f8 = { [1 + 2]() {} }; log(f8['3'].name);\n"
373+
+ "let s = Symbol('foo'); let f9 = { [s]() {} }; log(f9[s].name);\n"
374+
+ "let s2 = Symbol(); f10 = { [s2]() {} }; log(f10[s2].name);\n"
375+
376+
+ "</script>\n"
377+
+ "</body></html>";
378+
379+
loadPageVerifyTitle2(html);
380+
}
351381
}

0 commit comments

Comments
 (0)