Persper / js-callgraph

Construct approximate static call graph for JavaScript & Typescript
Eclipse Public License 2.0
180 stars 52 forks source link

cg.fg.dotify is not a function #35

Closed bandtank closed 5 years ago

bandtank commented 5 years ago

I'm not sure what I've done wrong, but I'm seeing the following error when I try to use --fg:

$ js-callgraph --fg repositories/pse-timesheet/res/js/
/usr/local/lib/node_modules/@persper/js-callgraph/src/runner.js:157
            console.log(cg.fg.dotify());
                              ^

TypeError: cg.fg.dotify is not a function
    at Object.build (/usr/local/lib/node_modules/@persper/js-callgraph/src/runner.js:157:31)
    at Object.<anonymous> (/usr/local/lib/node_modules/@persper/js-callgraph/js-callgraph.js:117:5)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3

Using --cg with the same path appears to work as expected. npm is 6.5.0.

gaborantal commented 5 years ago

Hello there @bandtank,

I checked your issue. The line calls a method dotify which is now not working as graph representation was completely replaced. I used serialize() provided by this representation to print out the flowgraph. In my recent PR, you can check out the fix and test yourself.

Cheers, Gabor

hezyin commented 5 years ago

A fix has been merged. Thanks for reporting! @bandtank