DoctorJS--, simple type inference for JavaScript
MIT License
DoctorJS-- is a simple static analysis tool for JavaScript, written in CoffeeScript. It uses a cut-down version of Brian Hackett's type inference algorithm, which is now part of the SpiderMonkey JavaScript engine (used in Firefox). Its output is in Exuberant Ctags format.
DoctorJS-- is neither as precise nor as sophisticated (nor, right now, as complete) as its big brother DoctorJS, but on the plus side it's designed to be small and easy to hack. If you need to do anything sophisticated, please use DoctorJS instead!
To get started, run make
and then use bin/jsctagsmm path/to/file.js
. Output
is written to a tags
file in the current directory.
Have fun!
Prerequisites:
npm
. Tested with version 1.0.27.Files of interest:
lib/dom.coffee
— You can add new functions and properties to the globallib/infer.coffee
— Defines the abstract interpreter that performs the typelib/absvalue.coffee
— Contains documentation for the abstract valueMajor known issues:
parse-js
.)for in
is missing in the interpreter.Thanks:
parse-js
module from UglifyJS.