Repository navigation
fix: perch scan stopped on a function inside a constructor that uses this - #359
Merged
Merged
Conversation
…this A file's record keeps each class's bases in a plain object, and the graph looked them up by name. For a named function inside a constructor, the name it looks up is the method around it, constructor, which finds Object's own constructor and stopped the scan with "function is not iterable". toString, valueOf and the other names on Object did the same. Every lookup of a class's bases now reads only the record's own keys. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Perch Scan: no issues in 88 methods at |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
perch scanstopped withfunction is not iterable (cannot read property Symbol(Symbol.iterator))on a file like this:To find where
this.sqlis assigned, the graph looks up the bases of the class around the caller. Forcolumns, it takes the name of the method around it,constructor, as that class. A file's record keeps each class's bases in a plain object, sobases['constructor']returned Object's own constructor, a function, and iterating it threw. A method namedtoString,valueOfor any other name on Object did the same. It needs a class with a base in the file, so the record has bases at all. 0.4.2 has the bug.All six lookups of a class's bases in
src/graph.jsnow go throughbasesOf, which reads only the record's own keys. Building the object without a prototype would not be enough: records parsed in a child process come back through JSON.A new test in
test/bindings.test.jscovers the constructor and thetoStringcases. It fails with the TypeError without the change.npm run checkpasses: lint, typecheck and 671 tests.Users don't need to change anything.
Closes #358
🤖 Generated with Claude Code