jerryscript icon indicating copy to clipboard operation
jerryscript copied to clipboard

Function to string does not comply with ECMAScript specification

Open ayuan0828 opened this issue 9 months ago • 1 comments

Description

When a user-defined function (not a built-in function) is converted to a string, the jerryscript engine returns a placeholder for '/* ecmascript */' instead of the actual function body string. This is inconsistent with the ECMAScript specification and mainstream engine behavior, and may have an impact on the relevant code.

Version

v3.0.0

Testcase

var functionArray = [
    function () {}
];
functionArray = functionArray + functionArray;
print(functionArray.length);

Output

64

Expected output

28

ayuan0828 avatar Mar 02 '25 09:03 ayuan0828

Good catch.

  • Does the English doc need the same change?
  • Should merge this change into master as well.

kayx23 avatar Apr 15 '25 02:04 kayx23

Hi @wynejan, is this PR still being processed?

Baoyuantop avatar Apr 28 '25 07:04 Baoyuantop

Any update?

kayx23 avatar Jun 06 '25 09:06 kayx23

I'll convert this PR to draft first, if the changes are done please request review again.

Baoyuantop avatar Jun 16 '25 07:06 Baoyuantop

This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 4 weeks if no further activity occurs. If you think that's incorrect or this pull request should instead be reviewed, please simply write any comment. Even if closed, you can still revive the PR at any time or discuss it on the [email protected] list. Thank you for your contributions.

github-actions[bot] avatar Aug 15 '25 10:08 github-actions[bot]

This pull request/issue has been closed due to lack of activity. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time.

github-actions[bot] avatar Sep 12 '25 10:09 github-actions[bot]