mirror of
https://github.com/morluto/rea.git
synced 2026-11-12 01:41:21 +00:00
feat(javascript): discover semantic call literals in feature traces (#7840)
* feat(javascript): discover semantic call literals in feature traces * fix(javascript): bound retained call literals by transfer capacity * test(javascript): align feature no-match diagnostic
This commit is contained in:
1 parent
685f6db960
commit
f9e7571a3d
20 files changed
+681
-15
No files matched your search
@@ -0,0 +1,25 @@
|
||||
import type { JavaScriptSemanticGraphNode } from "./javascriptSemanticGraphSchemas.js";
|
||||
|
||||
/** Read retained direct call literals without interpreting other node properties. */
|
||||
export const semanticCallLiteralValues = (
|
||||
node: JavaScriptSemanticGraphNode,
|
||||
): (string | number | boolean | null)[] => {
|
||||
if (node.kind !== "call-site" || !Array.isArray(node.properties.arguments))
|
||||
return [];
|
||||
return node.properties.arguments.flatMap((argument) => {
|
||||
if (
|
||||
argument === null ||
|
||||
typeof argument !== "object" ||
|
||||
Array.isArray(argument) ||
|
||||
!Object.hasOwn(argument, "value")
|
||||
)
|
||||
return [];
|
||||
const value = argument.value;
|
||||
return value === null ||
|
||||
typeof value === "string" ||
|
||||
typeof value === "number" ||
|
||||
typeof value === "boolean"
|
||||
? [value]
|
||||
: [];
|
||||
});
|
||||
};
|
||||
Reference in new issue
Block a user