The default InferenceEngine will create an anonymous type when is sees a 
Object Literal. 
Assuming that you have override handleFunctionCall() in you inferengine to 
process the "qx.Class.define", in that code
you would "drill down" to that object initializer and call "traverse()" in 
its field initializers, thus bypassing the default handling of 
visit(IObjectInitializer).
The handleFunctionCall() should return false, so the InferEngine does not 
visit the children of the function call .

Phil Berkland
IBM Software Group Emerging Technologies



Matthias Kempka <[EMAIL PROTECTED]> 
Sent by: [EMAIL PROTECTED]
04/08/2008 03:41 AM
Please respond to
"General discussion of project-wide or architectural issues." 
<[email protected]>


To
"General discussion of project-wide or architectural issues." 
<[email protected]>
cc

Subject
Re: [wtp-dev] JSDT inference: type of "this"







On Apr 8, 2008, at 2:04 AM, Phil Berkland wrote:
> This "this" should have the same type as the current context in the 
> InferEngine.  You can set the current context by doing 
> "currentContext.currentType= ??".
> If we see a "this.something" in a function, we assume there is 
> somekind of object involved, and if we dont know the type, we create 
> an anonymous type.

True.
But how can I set the currentContext.currentType? Everything about the 
context is package private.

It seems to me the problem goes like this:

When defining a constructor, I work with a definition that looks like 
this:

qx.Class.define("Application", {
                 construct : function(x) { }
});

The function declaration is in the initializer of a first-level object 
literal field. The context is preserved from where the type 
"Application is defined, and thus(?) "this" gets the type "Application".

However, Qooxdoo method declarations go like this:

qx.Class.define("Application", {
                 members : {
                     aMethod : function(x) {
                     }
         }
});

This is an object literal field within the first-level object literal 
field. There, the context type is lost and an anonymous type is 
created. It contains all the members but nothing else of type 
"Application". (I don't really understand why it contains all the 
members  since I'm actually adding them to the inferred type 
"Application".)

What can I do to preserve the type within nested object literal fields?

Best Regards,
Matthias Kempka
-- 
Dipl.-Inform. Matthias Kempka
Innoopract Informationssysteme GmbH
[EMAIL PROTECTED]
Tel:  0721 - 66 47 33 - 0
Fax: 0721 - 66 47 33 29
========================= Legal Disclaimer =====================
According to Section 80 of the German Corporation Act
Innoopract Informationssysteme GmbH must indicate the following 
information:
Address: Stephanienstrasse 20, 76133 Karlsruhe Germany
General Manager: Jochen Krause, Eric von der Heyden
Registered Office: Karlsruhe, Commercial Register Karlsruhe HRB 7883
============================================================





_______________________________________________
wtp-dev mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/wtp-dev

_______________________________________________
wtp-dev mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/wtp-dev

Reply via email to