Skip to content

Conversation

@cognigy-fabian
Copy link
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings December 16, 2025 10:05
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug where toLocaleString incorrectly accepted a radix argument for Number and BigInt types, which could lead to confusion since the ECMAScript specification defines toLocaleString with different parameters than toString.

  • Introduces new toLocaleString methods that clear arguments before delegating to toString
  • Updates method registration to use the new wrapper methods instead of directly aliasing to toString

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
builtin_number.go Adds numberproto_toLocaleString wrapper method and updates registration to prevent radix argument confusion
builtin_bigint.go Adds bigintproto_toLocaleString wrapper method and updates registration to prevent radix argument confusion

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +35 to +36
call.Arguments = nil
return r.numberproto_toString(call)
Copy link

Copilot AI Dec 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Directly modifying call.Arguments mutates the shared FunctionCall struct, which could affect the caller if they retain a reference to it. Consider creating a new FunctionCall struct with cleared arguments instead of mutating the original.

Suggested change
call.Arguments = nil
return r.numberproto_toString(call)
newCall := FunctionCall{
This: call.This,
Arguments: nil,
Spread: call.Spread,
}
return r.numberproto_toString(newCall)

Copilot uses AI. Check for mistakes.
Comment on lines +222 to +223
call.Arguments = nil
return r.bigintproto_toString(call)
Copy link

Copilot AI Dec 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Directly modifying call.Arguments mutates the shared FunctionCall struct, which could affect the caller if they retain a reference to it. Consider creating a new FunctionCall struct with cleared arguments instead of mutating the original.

Suggested change
call.Arguments = nil
return r.bigintproto_toString(call)
newCall := FunctionCall{
This: call.This,
Arguments: nil,
Spread: call.Spread,
}
return r.bigintproto_toString(newCall)

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants