escripts (.escript) index like any module — the ELP grammar has a
first-class shebang node, so no source transform is needed; main/1 and its
helpers get full function/call extraction.
OTP application resource files (<app>.app.src and compiled <app>.app) join
the graph as Erlang terms the grammar parses natively. They route by full
suffix (their last-dot extension, .src, is far too generic for the
extension map). The application tuple yields structure: {mod, {Mod, _}}
links the app to its callback module — the app's entry point — and
{applications, [...]} / {included_applications, [...]} connect umbrella
sibling apps, resolving through the OTP app-name == module-name convention;
kernel/stdlib and other out-of-repo apps stay unresolved.
App-file refs resolve only ever to MODULES: validation on emqx caught the
ssl OTP-app dependency resolving to a test helper FUNCTION named ssl (the
same defect class as the earlier -behaviour gate), so the matchReference
module-only gate now covers every ref an .app/.app.src file emits.
Validated on emqx: 2 app.src + 6 escripts indexed, entry-module and
umbrella-dependency edges all namespace-targeted post-gate, escript
functions extracted; a stray legacy/module.src stays unknown.
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
a5b8cd8e25
commit
a0208feaac
@@ -1758,8 +1758,14 @@ export function matchReference(
|
||||
// `-behaviour(supervisor)` resolved to a `-define(supervisor, …)` macro
|
||||
// constant in an unrelated app. Resolve only to the behaviour module's
|
||||
// namespace; an out-of-repo behaviour (OTP's gen_server/supervisor) stays
|
||||
// unresolved rather than guessed.
|
||||
if (ref.language === 'erlang' && ref.referenceKind === 'implements') {
|
||||
// unresolved rather than guessed. The same module-only rule applies to every
|
||||
// ref an `.app`/`.app.src` resource file emits — its `{mod, …}` callback and
|
||||
// `{applications, …}` dependency names can only mean modules, and on emqx
|
||||
// the `ssl` OTP app otherwise resolved to a test helper FUNCTION named ssl.
|
||||
if (
|
||||
ref.language === 'erlang' &&
|
||||
(ref.referenceKind === 'implements' || /\.app(?:\.src)?$/i.test(ref.filePath))
|
||||
) {
|
||||
const modules = context
|
||||
.getNodesByName(ref.referenceName)
|
||||
.filter((n) => n.language === 'erlang' && n.kind === 'namespace');
|
||||
|
||||
Reference in New Issue
Block a user