Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » How to extend javascript type inference
How to extend javascript type inference [message #723531] Thu, 08 September 2011 14:30 Go to previous message
Ning Wang is currently offline Ning Wang
Messages: 10
Registered: July 2011
Junior Member
Hi folk,

I have asked a similar question on ATF and were suggested to post it here. Javascript type inference has done pretty awesome job on inferring type based on javascript docs annotation.

For example,

/*
* @param {String} a [required]
* @return {myobj}
*/
function foo(a) { return new mynewobj(a); }


function bar() {
var ret = foo ("hello");
var ret1 = ret
ret1 // rec's type is myobj
}

But myobj is a generic object, it is extended based on the parameter passing into mynewobj. In order to make the type inference more useful, I want to augment the inferred type "myobj" with the extra information passed to mynewobj.

I noticed that org.eclipse.wst.jsdt.core.inferrenceSupport is the extension point for type inference. In this case, I don't need to modify how type is populated along the AST, but only need to inject extra info to the initial type that is returned from foo based on its formal parameter. Is this doable with the above extension point or I have to modify the wst.jsdt.core code?

Any suggestion is highly appreciated.
Ning







 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic:Eclipse
Next Topic:target namespace of CMElementDeclaration
Goto Forum:
  


Current Time: Fri May 24 02:39:29 EDT 2013

Powered by FUDForum. Page generated in 0.02284 seconds