Skip to content

Commit

Permalink
add string prototype toString (not inherited from object)
Browse files Browse the repository at this point in the history
  • Loading branch information
dnalborczyk committed Dec 19, 2021
1 parent 06207b5 commit 659a1ae
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/ast/values.ts
Expand Up @@ -199,6 +199,7 @@ const literalStringMembers: MemberDescriptions = assembleMemberDescriptions(
toLocaleLowerCase: returnsString,
toLocaleUpperCase: returnsString,
toLowerCase: returnsString,
toString: returnsString, // overrides the toString() method of the Object object; it does not inherit Object.prototype.toString()
toUpperCase: returnsString,
trim: returnsString,
trimEnd: returnsString,
Expand Down
1 change: 1 addition & 0 deletions test/form/samples/builtin-prototypes/literal/main.js
Expand Up @@ -57,6 +57,7 @@ const _substring = 'ab'.substring( 0, 1 ).trim();
const _toLocaleLowerCase = 'ab'.toLocaleLowerCase().trim();
const _toLocaleUpperCase = 'ab'.toLocaleUpperCase().trim();
const _toLowerCase = 'ab'.toLowerCase().trim();
const _toString = 'ab'.trim();
const _toUpperCase = 'ab'.toUpperCase().trim();
const _trim = 'ab'.trim().trim();
const _trimEnd = 'ab'.trimEnd().trim();
Expand Down

0 comments on commit 659a1ae

Please sign in to comment.