Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bugs in Proxy and this binding #1386

Merged
merged 2 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/parser/CodeBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ bool InterpretedCodeBlock::needsToLoadThisBindingFromEnvironment()
if (isArrowFunctionExpression()) {
InterpretedCodeBlock* cb = m_parent;
while (cb) {
if (cb->isArrowFunctionExpression()) {
if (cb->isArrowFunctionExpression() || cb->isEvalCode()) {
// pass through
} else if (cb->isClassConstructor()) {
return true;
Expand Down
4 changes: 4 additions & 0 deletions src/runtime/ProxyObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,8 @@ bool ProxyObject::set(ExecutionState& state, const ObjectPropertyName& propertyN
// https://www.ecma-international.org/ecma-262/6.0/#sec-proxy-object-internal-methods-and-internal-slots-call-thisargument-argumentslist
Value ProxyObject::call(ExecutionState& state, const Value& receiver, const size_t argc, Value* argv)
{
CHECK_STACK_OVERFLOW(state);

if (UNLIKELY(!m_isCallable)) {
ErrorObject::throwBuiltinError(state, ErrorCode::TypeError, ErrorObject::Messages::NOT_Callable);
}
Expand Down Expand Up @@ -991,6 +993,8 @@ Value ProxyObject::call(ExecutionState& state, const Value& receiver, const size
// https://www.ecma-international.org/ecma-262/6.0/#sec-proxy-object-internal-methods-and-internal-slots-construct-argumentslist-newtarget
Value ProxyObject::construct(ExecutionState& state, const size_t argc, Value* argv, Object* newTarget)
{
CHECK_STACK_OVERFLOW(state);

auto strings = &state.context()->staticStrings();
// 2. If handler is null, throw a TypeError exception.
if (this->handler() == nullptr) {
Expand Down
Loading