mozilla / spiderflunky

Static analysis of JavaScript
5 stars 3 forks source link

Type Inference #14

Open mvcisback opened 10 years ago

mvcisback commented 10 years ago

Annotate the Syntax Tree with types (this will be probabilistic in the general case, so we should support annotating multiple types for a given symbol)

mvcisback commented 10 years ago
mvcisback commented 10 years ago

Maybe we should consider handing this off to a http://ternjs.net/ server. The algorithm doesn't appear to be as sophisticated as CFA2 in doctorjs, but its actively maintained.

Relevant blog post: http://marijnhaverbeke.nl/blog/tern.html

erikrose commented 10 years ago

And now we're using it in Firefox's new WebIDE, so we'd have mutual question-asking ability with the Dev Tools team. jlongster on IRC might be a good one to ask what he thinks of ternjs, or at least he'd know who knows.

mvcisback commented 10 years ago

Here's a test branch https://github.com/mvcisback/spiderflunky/tree/tern that uses ternjs to infer the types.