All files / vsl/transform/helper generateFunctionMangle.js

0% Statements 0/6
0% Branches 0/2
0% Functions 0/1
0% Lines 0/5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19                                     
/**
 * Given a function's data, the outputs a mangled identifier which will uniquely
 * describe and reference its signature
 * 
 * @param {string} rootName - The root name or primary name of the function.
 *     e.g. in `foo(bar: baz)`, it would be `foo`
 * @param {string[][]} params - A [[name, type]] arrary where `name` and `type`
 *     are strings. type should be determined by `generateTypeMangle`.
 */
export default function generateFunctionMangle(rootName: string, params: string[][]) {
    var paramList = "";
    
    for (var i = 0; i < params.length; i++) {
        if (i > 0) paramList += ",";
        paramList += params[i][0] + ":" + params[i][1];
    }
    
    return rootName + "(" + paramList  + ")";
}