Skip to content

Fix Iterator.prototype#690

Merged
saghul merged 1 commit intomasterfrom
fix-iterator-proto
Nov 15, 2024
Merged

Fix Iterator.prototype#690
saghul merged 1 commit intomasterfrom
fix-iterator-proto

Conversation

@saghul
Copy link
Copy Markdown
Contributor

@saghul saghul commented Nov 15, 2024

Make sure all descriptors are attached to the one and only iterator prototype.

Make sure all descriptors are attached to the one and only iterator
prototype.
@saghul saghul requested a review from bnoordhuis November 15, 2024 08:15
Comment thread test262_errors.txt
test262/test/built-ins/Iterator/from/return-method-returns-iterator-result.js:18: strict mode: TypeError: not a function
test262/test/built-ins/Iterator/from/return-method-throws-for-invalid-this.js:16: TypeError: not a function
test262/test/built-ins/Iterator/from/return-method-throws-for-invalid-this.js:16: strict mode: TypeError: not a function
test262/test/built-ins/Iterator/prototype/Symbol.iterator/prop-desc.js:15: Test262Error: obj should have an own property Symbol(Symbol.iterator)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is what made me realize something was off.

Comment thread test262_errors.txt
test262/test/built-ins/Date/prototype/setUTCSeconds/date-value-read-before-tonumber-when-date-is-invalid.js:26: strict mode: Test262Error: time updated in valueOf Expected SameValue(«NaN», «0») to be true
test262/test/built-ins/Iterator/from/get-return-method-when-call-return.js:24: TypeError: not a function
test262/test/built-ins/Iterator/from/get-return-method-when-call-return.js:24: strict mode: TypeError: not a function
test262/test/built-ins/Iterator/from/result-proto.js:10: unexpected error: Test262Error: Expected SameValue(«[object Object]», «[object Iterator]») to be true
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'll fix this as part of #689 which I'll rebase on top of this PR.

Comment thread quickjs.c
JS_NewObjectProtoClass(ctx, ctx->class_proto[JS_CLASS_ITERATOR],
JS_CLASS_ITERATOR);

ctx->class_proto[JS_CLASS_ITERATOR_HELPER] = JS_NewObjectProto(ctx, ctx->iterator_proto);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Note how we had 2 iterator prototypes, sort of. Oops!

@saghul saghul merged commit 559029b into master Nov 15, 2024
@saghul saghul deleted the fix-iterator-proto branch November 15, 2024 12:16
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