Skip to content

Parsing error on object properties #51

Open
@lcwj3

Description

@lcwj3

Hi, I am trying to use this tool to generate call graphs for node.js packages, however, I find a parsing logic error from your tool. Here is my example:

define(function (require, exports) {  
  var test = {  
      keys: ()=>(console.log(a))
  }
  var x = {
    keys: () => (console.log(b))
  }
  test.keys();
  x.keys();
  var c = 9;
  Object.keys(c);
});

When parsing this js file, it seems the dftc algorithm didn't handle cases like property name for different objects. In this case, when function visit1 in dftc.js finds calls for keys of test, it firstly find the expression of func, then prop of 'keys', while here is only use the 'keys' to match call expressions, and finally, the call graph contains calls that from line 8,9,11 to both test.keys and x.keys, 6 calls in total.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions