tree-sitter marks ERROR nodes extra. The unified walk deferred scope
expiry until the next non-extra node, so a #include left inside_import
set across the recovered subtree. Every leaf then climbed
nearest_import_ancestor with ts_node_parent.
The libtomcrypt LUT prefix is the repro and must finish extracting.
Signed-off-by: tomholford <tomholford@users.noreply.github.com>
A Dockerfile, a compose file, a Terraform block, a workflow and a
kustomization draw REFERENCES_FILE edges to the files they name, and a
Make rule DEPENDS_ON the rules its prerequisites name. An index built
before has none of these edges for its unchanged files, and the changes
that added them did not raise the semantic index version. An
incremental run reads only what changed, so such an index stayed
without them until each config file was edited.
The version is 14 now. An index stamped with an older one rebuilds once
in full on its next run, as with every earlier number.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
The comment on where a resolver NULL admits an absence proof named only
the namespace-only path and a global class `use`; it now names the
unaliased global `use` of a class, a function or a constant, and what
leaves the file unknown. Two test comments said the implementation's
method runs; they now say what is asserted, the edge to the interface's
declaration, and that the constant test passes with the first commit
alone. No behaviour change.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
A `use const` can name nothing the graph holds but a File or Module of
the name: the graph has no node for a PHP constant (a top-level or
namespaced `const`, a class constant and `define()` give none), so the
check for a constant or variable node of the name compared against
nodes that never exist. Say so, and drop that check. Name the proof's
other limits: names are compared as written, while PHP compares class
and function names in any ASCII case; and a function declared inside
another function's body has no node.
Tests: an aliased global `use function` keeps the file's imports
unknown (it binds the alias exception), and a `use const` beside the
project's own `const` leaves the file complete (it binds what the proof
claims for constants). The partner beside a namespaced function of the
same name is dropped: it passed with and without the change it was
meant to guard, because the import resolver binds that use by name
first.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
pass_calls builds its return-type table once any Method carries a return type.
The C# fixtures do now that methods read the `returns` field, and
run_sequential_with_lsp_cross_and_mutator was the one harness helper that did
not call harness_ctx_free_tables: LSan reported the table's strdup'd entries
(test-unix gcc x86, parallel_csharp_parse_damaged_namespace_is_not_global).
Linux arm64 gcc ASan: the parallel suite leaks without this and is clean with it.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
Scored against main on the Scala truth repos, naming the companion object
Owner#object lost 18 pairs on cats and circe, in two shapes:
- `Chain.concat(a, b)` (also As.compose, Free.compile, Epsilon.isFinite)
reached the class's same-named member: import_map and same_module tried
Owner.m before Owner#object.m, and the qualified tail called the pair
X.m / X#object.m ambiguous. The term `Owner` is the object, so both
lookups now try the object first and the qualified tail takes the
object's twin.
- `ev.abs(a)` reached a member nested in the companion object: the name
scorer's last tie-break is strcmp, and '#' sorts before '.'. Ties now
order as if the fence were absent (the order before it existed), and of
two twins a call through a value takes the class member.
All four are gated on a registered object fence, so a registry without
Scala resolves exactly as before. Scala truth, main vs this branch:
+465 / -10 pairs (before this change +440 / -21); cats + circe +166 / -3,
new wrong edges 24 vs 19 removed. The 73 dev/other repos of the other
languages score identically.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
tree-sitter-make gives up on some valid makefiles: a nested conditional
indented with tabs inside an indented one turns everything from there to
the end of the file into one error region. The rules after it are still
parsed as rules and have their nodes, but no prerequisite edge was drawn
for a rule inside such a region.
A rule that is a direct child of the error node and stands at the start
of its line now has its prerequisites read like any other. A rule line
indented with spaces and a rule nested in another node of the region stay
undrawn.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
A prerequisite that names a rule of the same makefile draws DEPENDS_ON
{via: prerequisite, line} from each target of the rule to that rule's
node: once per pair, at the first line stating it, as make merges the
prerequisites a target's rules give it. An order-only prerequisite (after
`|`) carries "order_only": true, unless another rule of the target lists
it as a normal one: make then treats it as normal, and the edge carries
that line.
The rule nodes exist already, one per target. The shell pass parses every
makefile it reads; it now keeps each rule's plain prerequisites and matches
them against the rule nodes of that file in one pass over the Function
nodes (the table `make <target>` resolution built, now shared).
A rule line that repeats a target or a prerequisite is read once per name:
the work is the line's words plus its distinct pairs, counted by
g_sh_make_pairs and pinned by a test at 1x, 4x and 16x. If a name cannot
be kept (an allocation fails), no prerequisite edge is drawn at all.
A prerequisite with a variable, a pattern or a glob, one that names a file
or a rule of another makefile, a target naming itself, a static pattern
rule, and a rule line the grammar could not parse cleanly (a
target-specific variable it took for a rule) draw nothing.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
One `use function sprintf;` or `use const PHP_EOL;` that names nothing in
the project left the whole file's import evidence unknown: no binding
snapshot was written, the file's class imports reached the PHP engine as
File QNs, and the typed calls through them fell to a name guess or were
lost (phpmyadmin's controllers). The absence proof a global class `use`
already had now covers these two kinds: unaliased, and no PHP node of a
label such a use can bind (a function, a constant, or a file or module)
carries the name.
With the file's imports complete, its unresolved imports also veto the
name guesses they shadow, as they already did in every other file.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
The files a configMapGenerator or secretGenerator reads (`files`, also as
`key=path`; `envs`; the single `env` of older kustomize) and the entries of
`configurations` draw REFERENCES_FILE {via: configMapGenerator |
secretGenerator | configurations, line} from the kustomization's File node
to the file's, once per kustomization and file at the first line naming it.
They are not imports. An import from a kustomization makes its target a
member of the build, and a generator's input holds no object of the build.
The extractor emits one in-memory fact per entry (CBM_K8S_FACT_FILE); the
K8s pass keeps them beside the patch facts and draws them. Facts are not
part of the stored result. A file the index does not hold, an absolute path
and a path out of the repository draw nothing.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
A local `uses:` of a GitHub workflow or composite action is a path from
the repository root. A step's names an action by its directory, a job's a
reusable workflow by its file. Each draws REFERENCES_FILE {via: uses, line}
from the file stating it to the file it names: the directory's action.yml
or action.yaml (the one it holds), or the workflow file. Once per target,
at the first use.
An action of another repository, a path with an expression, a directory
with no action file or with both spellings, and a path out of the
repository draw nothing.
The CI walk that reads `run:` steps hands the local uses to the shell pass
through a second callback of cbm_ci_commands, in the same walk: a file is
parsed once, as before.
The incremental repair reads no workflow again when an action file is
deleted. A directory with both spellings has no edge, and deleting one of
the two makes the other the action, so that deletion takes the full route
(local_action_pair_deleted).
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
file(), templatefile(), filebase64() and the file hash functions whose
first argument is "${path.module}/<literal path>" read a file of the
repository. Each draws REFERENCES_FILE {via: <the function>, line} from the
top-level block holding the call to that file's File node, once per block
and file at the first call.
A path written without ${path.module} is relative to the directory
Terraform is run in, which the module does not state, so it draws nothing;
neither does path.root or path.cwd, a path with another interpolation, an
expression argument, or a file the index does not hold.
The calls are collected in the module resolver's existing walk over each
top-level block and drawn in its link step, with the string evaluation the
pass already has for literals and ${path.module}.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
The host side of a bind mount (short form beginning with `.`, long form of
type bind), an env_file, and the file of a config or secret a service lists
draw REFERENCES_FILE {via: volume | env_file | config | secret, line} from
the service's node to the file's File node, once per service and file at
the first line naming it.
Compose states these paths relative to the compose file's directory, so
nothing is inferred: a path that is not an indexed file draws nothing, and
neither does a named or anonymous volume, an absolute or home path, a path
out of the repository, a variable without a value, a config without `file:`
or the compose file itself. Variables come from the project's .env through
the reader the compose walk already has.
The compose walk hands the paths to the container pass with each service,
and the pass looks them up among the File nodes. The compose step re-reads
every compose file on each run, so the incremental planner needs no new
rule.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
A COPY or ADD source written as a plain path that is an indexed file under
exactly one of the two contexts a build of the Dockerfile can have (its
directory, the repository root) draws REFERENCES_FILE {via: copy | add,
line} from the Dockerfile's File node to that file's, once per file at the
first instruction naming it. A source of another stage or image (--from),
a URL, a glob, a source a variable supplies, a directory, a path out of its
context, a file under both contexts and a file under one context that is a
directory under the other draw nothing.
The lookup is the one the pass already uses to map a container path back
to the repository for SPAWNS; the pass already recorded every COPY and ADD.
The incremental planner runs the container pass over changed files only.
When a file that has a same-path partner under a Dockerfile's other context
is deleted, the remaining file becomes the only candidate, and its edge
would come from a Dockerfile that did not change. The same holds for a file
below a directory whose same-path partner is a file: once the directory is
empty, that file is the only candidate. Both deletions now take the full
route (docker_context_pair_deleted). The pass's SPAWNS mapping uses the
same lookup and had the first of the two gaps.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
A Scala object with a same-named class, trait or enum in the same scope
(its companion) is now named <Owner>#object and its members
<Owner>#object.<m>, in place of the `$` suffix of the merged change. The
fence works like C's `#macro`: no plain Scala identifier ends in `#object`,
so the registry no longer needs a table of companion owners, the declaring
file's language, or an extra parameter on its helpers to tell a Scala
companion from a Java or JavaScript class named `Foo$`. An object without
such a type beside it keeps its plain QN.
The lookups that let `Owner.m` written in source reach `Owner#object.m`
try the fenced form: the import map (exact and suffix), the same-module
probe, the qualified-tail match, the receiver-chain guard and the package
map's member import. The registry runs the import and same-module probes
only once a Scala companion has been registered. The enclosing-function QN
used by the usage, throw, type-assignment and env-access walkers fences the
object the same way, so those source to the method the def walk emits.
Companion detection answers each object in O(1). A scope's children are
read once with a tree cursor: the def walk reads every class body ahead and
the first query reads the file's top level, where the previous code walked
down from the root for every parent lookup and indexed children one at a
time. The answers are held by pointer in the extraction context and tied to
the source they were built for, so a copied context with another source
builds its own instead of sharing a by-value copy.
CBM_SEMANTIC_INDEX_VERSION goes from 13 to 14: an index built before holds
one merged node for a type and its companion and rebuilds once.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>