This commit is contained in:
2025-07-09 13:26:51 +01:00
commit d564cf2cd1
24 changed files with 19728 additions and 0 deletions

35
src/libcalls.mjs Normal file
View File

@@ -0,0 +1,35 @@
//@ts-check
/**
* @typedef {import('estree').Literal["value"]} GenericLiteralType
*/
/**
* Record library calls
*/
export class LibraryCallsRecorder{
/**
* @type {Map<string,Map<string,GenericLiteralType[][]>>}
*/
#calls = new Map();
/**
*
* @param {string} moduleName
* @param {string} libraryFunctionSegment
* @param {any[]} argumentsCalled
*/
pushToMap(moduleName, libraryFunctionSegment, argumentsCalled){
const modulePortion = this.#calls.get(moduleName)?? new Map();
const defArgs = modulePortion.get(libraryFunctionSegment) ?? [];
defArgs.push(argumentsCalled);
modulePortion.set(libraryFunctionSegment,defArgs);
this.#calls.set(moduleName, modulePortion);
}
get calls(){
return this.#calls;
}
}