[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
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
mkempka@xxxxxxxxxxxxxx
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
============================================================