nl_tokens: Instrumenting function strictly needed for statement coverage only in case of defun ( function definition ) however the block function does not correspond to a new statement . This method allows to track every function call ( function coverage ) .
pl_tokens: function countFunction ( ) { var ret ; if ( isFirstLine ) { isFirstLine = false ; return ret ; } if ( this [ 0 ] . start && analyzing . indexOf ( this ) < 0 ) { var defun = this [ 0 ] . name === "defun" ; var lineId = this [ 0 ] . start . line + lineOffset + '' ; //this[0].name + ":" + this[0].start.line + ":" + this[0].start.pos; var fnName = this [ 1 ] || this [ 0 ] . anonymousName || "(?)" ; var fnId = fnName + ':' + ( this [ 0 ] . start . line + lineOffset ) + ":" + this [ 0 ] . <mask> . pos ; var body = this [ 3 ] ; analyzing . push ( this ) ; // put a new function call inside the body, works also on empty functions if ( options [ "function" ] ) { body . splice ( 0 , 0 , [ "stat" , [ "call" , [ "dot" , [ "name" , "require" ] , "coverage_function" ] , [ [ "string" , moduleName ] , [ "string" , fnId ] ] ] ] ) ; // It would be great to instrument the 'exit' from a function // but it means tracking all return statements, maybe in the future... rememberFunction ( fnId ) ; } if ( defun ) { // 'defun' should also be remembered as statements rememberStatement ( lineId ) ; ret = [ "splice" , [ [ "stat" , [ "call" , [ "dot" , [ "name" , "require" ] , "coverage_line" ] , [ [ "string" , moduleName ] , [ "string" , lineId ] ] ] ] , walker . walk ( this ) ] ] ; } else { ret = walker . walk ( this ) ; } analyzing . pop ( this ) ; } return ret ; }