(n,node,method)
| 845 | } |
| 846 | } |
| 847 | function doBlock(n,node,method){ |
| 848 | // console.log('do block',method) |
| 849 | if(!n)return |
| 850 | |
| 851 | |
| 852 | n._file=file |
| 853 | n._flow_id=n.value+'_'+node._flow_id |
| 854 | n._flow_from=r.showIf?node._flow_id:method |
| 855 | if(n.type=="FunctionDefine"||n.type=="MethodDefine"){ |
| 856 | r.FlowNode[n._flow_id]=n |
| 857 | traverseFunction(n,node,file) |
| 858 | }else if(n.type=="LoopStatement"){ |
| 859 | r.FlowNode[n._flow_id]=n |
| 860 | if(r.showIf){ |
| 861 | r.Flow+=` ${n._flow_id}((${n.value}))\nclick ${n._flow_id} "javascript:void(onFlowClick('${n._flow_id}','${file}'))"\n` |
| 862 | r.FDPNode[n._flow_id]={id:n._flow_id,w:0,text:'🔵'} |
| 863 | } |
| 864 | if(n.condition&&n.condition.value)n._flow_condition='|'+mermaidRepl(n.condition.value)+'|' |
| 865 | if(n.body){ |
| 866 | for(let nn of n.body){ |
| 867 | doBlock(nn,n,method) |
| 868 | } |
| 869 | } |
| 870 | }else if(n.type=="IfStatement"){ |
| 871 | r.FlowNode[n._flow_id]=n |
| 872 | if(r.showIf){ |
| 873 | r.Flow+=` ${n._flow_id}{${n.value}}\nclick ${n._flow_id} "javascript:void(onFlowClick('${n._flow_id}','${file}'))"\n` |
| 874 | r.FDPNode[n._flow_id]={id:n._flow_id,w:0,text:'🔷'} |
| 875 | } |
| 876 | if(n.condition&&n.condition.value)n._flow_condition='|'+mermaidRepl(n.condition.value)+'|' |
| 877 | if(n.body){ |
| 878 | for(let nn of n.body){ |
| 879 | doBlock(nn,n,method) |
| 880 | } |
| 881 | } |
| 882 | }else if(n.type=="CallExpression"){ |
| 883 | if(node.type=='Variable'){ |
| 884 | r.FlowVarNew[node.value]=n.value |
| 885 | } |
| 886 | // console.log('callee',node,n) |
| 887 | n._flow_callee=node.type=='FunctionDefine'||node.type=="MethodDefine"?n.value:node.value; |
| 888 | if(r.FlowNode[n._flow_id])n._flow_id=n._flow_callee+n._flow_id; |
| 889 | r.FlowNode[n._flow_id]=n |
| 890 | if(!r.FlowFilter[n._flow_id])return true//filter===false click once show call detail |
| 891 | n._flow_str=` ${n._flow_id}([${n.value}])\nclick ${n._flow_id} "javascript:void(onFlowClick('${n._flow_id}','${file}'))"\n` |
| 892 | r.FDPNode[n._flow_id]={id:n._flow_id,w:n.value.length*gD3fontSize/1.6+gD3fontSize*2,text:n.value+'()'} |
| 893 | r.Flow+=n._flow_str |
| 894 | }else if(n.type=='Variable'||n.type=="Expression"||n.type=="WithStatement"||n.type=="TryStatement"||n.type=="ExceptStatement"||n.type=="FinallyStatement"||n.type=="MemberExpression"){ |
| 895 | r.FlowNode[n._flow_id]=n |
| 896 | n._flow_id=node._flow_id; |
| 897 | if(n.body){ |
| 898 | for(let nn of n.body){ |
| 899 | doBlock(nn,n,method) |
| 900 | } |
| 901 | } |
| 902 | } |
| 903 | } |
| 904 |
no test coverage detected