Documentation
¶
Overview ¶
Package solidity implements the CKG parser for .sol files (spec §4.6.3).
We use a vendored copy of github.com/JoranHonig/tree-sitter-solidity v1.2.11 (LANGUAGE_VERSION=14). Upstream github.com/tree-sitter/go-tree-sitter v0.25 supports the ABI window MIN_COMPATIBLE_LANGUAGE_VERSION..LANGUAGE_VERSION (13..15 at the time of writing), so the vendored grammar loads without regeneration.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ABISig ¶
ABISig is a stripped-down function signature used by the cross-language linker (T20). We avoid pulling in solc; signatures are recovered from the AST per spec §4.6.3 ("ABI 추출 부산물"). ParamTypes is left nil in V0 since name-match is sufficient for the typechain-style binds_to heuristic.
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser implements parse.Parser for Solidity source.
abi accumulates per-contract function signatures across ParseFile calls so that the cross-language linker (T20) can match them to TypeScript classes by name. Mutated in place from declVisitor.collectABI under abiMu — buildpipe runs ParseFile concurrently across files.
func (*Parser) ABI ¶
ABI returns the per-contract signatures collected during ParseFile. Used by the cross-language linker (T20). Caller is expected to invoke ABI only after all ParseFile calls have completed (buildpipe enforces this by collecting all results before reading ABI). The mutex guard is defensive — under the documented call sequence there is no contention.
func (*Parser) Extensions ¶
Extensions reports the file extensions this parser handles.
func (*Parser) Resolve ¶
func (p *Parser) Resolve(results []*parse.ParseResult) (*parse.ResolvedGraph, error)
Resolve unions per-file results. V0 cross-file resolution is name-based: pending edges (emits_event, has_modifier, writes_mapping) are matched against any node whose Name (or QualifiedName for mappings) equals the pending TargetQName. Cross-file matches are tagged INFERRED; same-file matches stay EXTRACTED. Mirrors the TypeScript resolver.
W1 (Sol inheritance, 2026-05-11): adds resolution for `is`-clause PendingRefs (DispatchKind="inherit"). The detector (inheritance.go) emits these with a provisional EdgeType=EdgeExtends; this resolver reclassifies to EdgeImplements when the resolved parent is an Interface node. Contract / Interface lookups share the byName index keyed by NodeType.
W2 (Sol virtual/override, 2026-05-11): adds resolution for override-specifier PendingRefs (DispatchKind="override" / "override_explicit"). Bare overrides walk the inheritance graph emitted in W1 to find every parent that declares a same-name function; explicit `override(A, B)` looks up "Parent.method" directly. Both paths emit EdgeOverrides (child → parent) at ConfExtracted (same-file) or ConfInferred (cross-file).
W3 (Sol interface dispatch, 2026-05-11): adds resolution for `IFoo(addr).bar()` PendingRefs (DispatchKind="interface_dispatch"). Two-step lookup: (1) TypeName must resolve to a NodeInterface; (2) `TypeName.MethodName` must resolve to a Function declared on that interface. Both hits → emit EdgeInvokes at ConfAmbiguous (§5.0 Q5 — confidence is constant regardless of file boundary; runtime dispatch makes the resolved target an over-approximation). Any miss → drop (V0 strict-purge — keeps the AMBIGUOUS bucket scoped to real interface dispatch only).
Source Files
¶
- abi.go
- abstract_library.go
- assembly_marker.go
- c3_linearization.go
- chained_external_call.go
- contract_cast.go
- cross_contract_fn_pointer.go
- declarations.go
- dispatch.go
- enum_size.go
- external_call_cast.go
- file_level_operator_form.go
- function_typed_var_marker.go
- high_level_self_call.go
- inheritance.go
- low_level_call.go
- low_level_call_marker.go
- operator_form_recovery.go
- overrides.go
- parser.go
- queries.go
- resolve.go
- struct_size.go
- struct_size_crossfile.go
- type_size.go
- using_for.go
- yul_builtins.go
- yul_low_level_calls.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package binding wraps the tree-sitter-solidity grammar (vendored from github.com/JoranHonig/tree-sitter-solidity v1.2.11, MIT-licensed) into a *sitter.Language usable by github.com/tree-sitter/go-tree-sitter.
|
Package binding wraps the tree-sitter-solidity grammar (vendored from github.com/JoranHonig/tree-sitter-solidity v1.2.11, MIT-licensed) into a *sitter.Language usable by github.com/tree-sitter/go-tree-sitter. |