checkAndAddRedundantFunction(func, name, redundantFunctions) {
        if (func.body === null || func.body.body == null) {
            return false;
        }

        const returnIndex = func.body.body.length - 1;

        if (returnIndex < 0)
            // If returnIndex == -1 when function body is empty
            return false;
        else {
            var returnNode = func.body.body[returnIndex];

            if (
                returnNode.type === 'ReturnStatement' &&
                returnNode.argument !== null &&
                this.isPiranhaLiteral(returnNode.argument) &&
                typeof returnNode.argument.value === 'boolean'
            ) {
                redundantFunctions[name] = returnNode.argument.value;
            }

            // TODO introduce a warning here since the assumption of return statement being at the end is violated

            return true;
        }
    }
// The argument `func` refers to a function with a single return statement at the end of its body
The argument `func` refers to a function with a single return statement at the end of its body
The argument ` func ` refers to a function with a single return statement at the end of its body
checkAndAddRedundantFunction(func, name, redundantFunctions) {
        if (func.body === null || func.body.body == null) {
            return false;
        }
        const returnIndex = func.body.body.length - 1;
        if (returnIndex < 0)
            return false;
        else {
            var returnNode = func.body.body[returnIndex];
            if (
                returnNode.type === 'ReturnStatement' &&
                returnNode.argument !== null &&
                this.isPiranhaLiteral(returnNode.argument) &&
                typeof returnNode.argument.value === 'boolean'
            ) {
                redundantFunctions[name] = returnNode.argument.value;
            }
            return true;
        }
    }
checkAndAddRedundantFunction ( func , name , redundantFunctions ) { if ( func . body === null || func . body . body == null ) { return false ; } const returnIndex = func . body . body . length - 1 ; if ( returnIndex < 0 ) return false ; else { var returnNode = func . body . body [ returnIndex ] ; if ( returnNode . type === 'ReturnStatement' && returnNode . argument !== null && this . isPiranhaLiteral ( returnNode . argument ) && typeof returnNode . argument . value === 'boolean' ) { redundantFunctions [ name ] = returnNode . argument . value ; } return true ; } }
The argument `func` refers to a function with a single return statement at the end of its body
The argument ` func ` refers to a function with a single return statement at the end of its body
// If returnIndex == -1 when function body is empty // TODO introduce a warning here since the assumption of return statement being at the end is violated