Closed mkramb closed 10 years ago
Example file:
Test = function () {}; function buildDialog() { var tt = "11"; }
And then running:
grasp -d 'func[id=#buildDialog]' test2.js
Returns:
options: { debug: true, extensions: [ 'js' ], parser: [ 'acorn', { locations: true } ], lineNumber: true, color: true, _: [ 'func[id=#buildDialog]', 'test2.js' ] } parse-selector: 2ms parsed-selector: {"type":"compound","selectors":[{"type":"matches","selectors":[{"type":"identifier","value":"FunctionDeclaration"},{"type":"identifier","value":"FunctionExpression"}]},{"type":"attribute","name":"id","operator":"=","valType":"complex","value":{"type":"compound","selectors":[{"type":"identifier","value":"Identifier"},{"type":"attribute","name":"name","operator":"=","valType":"primitive","value":{"type":"literal","value":"buildDialog"}}]}}]} parse-input:test2.js: 2ms Cannot read property 'type' of null everything: 11ms
The problem is in definition of Test variable, if I define first function with a name, then it works. For example:
Test = function a() {}; function buildDialog() { var tt = "11"; }
Great tool! Is this a problem of acorn parser or grasp itself? Thanks for any info ...
Example file:
And then running:
Returns:
The problem is in definition of Test variable, if I define first function with a name, then it works. For example:
Great tool! Is this a problem of acorn parser or grasp itself? Thanks for any info ...