fix(extraction): a Go method carries the exportedness of its name - #1734
Open
danusha2345 wants to merge 1 commit into
Open
fix(extraction): a Go method carries the exportedness of its name#1734danusha2345 wants to merge 1 commit into
danusha2345 wants to merge 1 commit into
Conversation
extractMethod never set isExported, so every Go method was indexed as
unexported — 148 of 148 on a 42-file tree, `func (w *rotatingLogWriter)
Close()` included — while plain functions carried the flag from the name's
case. The kernel's go.rs mirrored the omission ("extractMethod passes no
isExported").
A method that is a top-level declaration (methodsAreTopLevel — Go is the
only such extractor) now gets the extractor's isExported like a function
does; go.rs sets is_exported from the same name-case rule in extract_method.
Class members elsewhere keep the flag unset on purpose: their reachability
is the class's, and the JS/TS isExported walks the parent chain, so applying
it to methods would re-mark every member of an exported class and diverge
the tsjs kernel walker.
Same tree, kernel arm: methods 41 exported / 107 unexported (was 0 / 148);
wasm arm identical. kernel-scaffold, kernel-deep-nesting and
kernel-grammar-parity pass with the rebuilt kernel loaded.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Standalone off
main(b9ca4b7), one commit, both extraction arms. The extractor defect noted in #1731.What
extractMethodnever setisExported, so every Go method was indexed as unexported whatever the case of its name — 148 of 148 on a 42-file tree,func (w *rotatingLogWriter) Close()included — while plain functions carried the flag.codegraph-kernel/src/go.rsmirrored the omission literally (// extractMethod passes no isExported).A method that is a top-level declaration (
methodsAreTopLevel— Go is the only such extractor) now receives the extractor'sisExportedexactly as a function does, andgo.rssetsis_exportedfrom the same name-case rule inextract_method. Class members in other languages keep the flag unset on purpose: their reachability is the class's, and the JS/TSisExportedwalks the parent chain, so applying it to methods would re-mark every member of an exported class and diverge the tsjs kernel walker.Measured
Same Go/Kotlin/JS tree, kernel rebuilt from this checkout and confirmed loaded with
CODEGRAPH_KERNEL_DEBUG=1:Close/String→ exported,close→ not. Functions unchanged (135 / 175). The wasm arm (CODEGRAPH_KERNEL=0) gives the same flags.Tests
extraction.test.ts: a four-symbol Go file (Close,flush,Open,helper) asserting the flag on both methods and both functions; passes on the wasm arm and with the kernel loaded.kernel-scaffold,kernel-deep-nesting,kernel-grammar-parity: 31 passed with the rebuilt kernel.Relationship to #1732: that PR judges Go visibility by the name's case precisely because this flag was unusable; with this in, the flag and the case agree, and #1732's rule can later read the flag.
🤖 Generated with Claude Code