From 988a626d1a5e8bb74e90a43ce21f5bb83397af1b Mon Sep 17 00:00:00 2001
From: exebetche <guillaume.lemaout@gmail.com>
Date: Thu, 2 Dec 2021 18:46:20 +0100
Subject: [PATCH] Bug fix: assign correct argument bit ratio index

In "assignArgumentBitRatio" the index for "argumentBitRatios" should be the one of the function, not the kernel. Otherwise, you get a "bit ratio not found" error if you pass arguments to a function with a different order than they're passed to the kernel.
Fix #600
---
 src/backend/function-builder.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/function-builder.js b/src/backend/function-builder.js
index 1633f0e8..4b61dc92 100644
--- a/src/backend/function-builder.js
+++ b/src/backend/function-builder.js
@@ -576,7 +576,7 @@ class FunctionBuilder {
       }
       return calleeBitRatio;
     }
-    calleeNode.argumentBitRatios[i] = bitRatio;
+    calleeNode.argumentBitRatios[argumentIndex] = bitRatio;
     return bitRatio;
   }
 
@@ -624,4 +624,4 @@ class FunctionBuilder {
 
 module.exports = {
   FunctionBuilder
-};
\ No newline at end of file
+};