MCPcopy Index your code
hub / github.com/gpujs/gpu.js / assignArgumentBitRatio

Method assignArgumentBitRatio

src/backend/function-builder.js:557–581  ·  view source on GitHub ↗

* @param {string} functionName * @param {string} argumentName * @param {string} calleeFunctionName * @param {number} argumentIndex * @return {number|null}

(functionName, argumentName, calleeFunctionName, argumentIndex)

Source from the content-addressed store, hash-verified

555 * @return {number|null}
556 */
557 assignArgumentBitRatio(functionName, argumentName, calleeFunctionName, argumentIndex) {
558 const node = this._getFunction(functionName);
559 if (this._isNativeFunction(calleeFunctionName)) return null;
560 const calleeNode = this._getFunction(calleeFunctionName);
561 const i = node.argumentNames.indexOf(argumentName);
562 if (i === -1) {
563 throw new Error(`Argument ${argumentName} not found in arguments from function ${functionName}`);
564 }
565 const bitRatio = node.argumentBitRatios[i];
566 if (typeof bitRatio !== 'number') {
567 throw new Error(`Bit ratio for argument ${argumentName} not found in function ${functionName}`);
568 }
569 if (!calleeNode.argumentBitRatios) {
570 calleeNode.argumentBitRatios = new Array(calleeNode.argumentNames.length);
571 }
572 const calleeBitRatio = calleeNode.argumentBitRatios[i];
573 if (typeof calleeBitRatio === 'number') {
574 if (calleeBitRatio !== bitRatio) {
575 throw new Error(`Incompatible bit ratio found at function ${functionName} at argument ${argumentName}`);
576 }
577 return calleeBitRatio;
578 }
579 calleeNode.argumentBitRatios[i] = bitRatio;
580 return bitRatio;
581 }
582
583 trackFunctionCall(functionName, calleeFunctionName, args) {
584 if (!this.functionNodeDependencies[functionName]) {

Callers 1

Calls 2

_getFunctionMethod · 0.95
_isNativeFunctionMethod · 0.95

Tested by

no test coverage detected