Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[atf-dev] Inheritance in JavaScript Editor

Hello,

first of all: I'm note sure if I'm right here. I didn't found a mailing
list for JSDT, so the closest thing I found is ATF. So if I'm wrong here
it would be nice if you could point me to the right mailing list.

My question is if there is any other inheritance syntax which is
supported by the JavaScript Editor. Looks like this one works:

function Base()
{
}

function Test()
{
}

Test.prototype=new Base();

If I write this then the JavaScript Editor detects that Test extends
Base and can give me method completion and validation and stuff like
that. The problem is that this kind of inheritance has one flaw: The
constructor of the Base class is called when the javascript file is
loaded. That's why I'm using a different type of inheritance. Basically
it works like that:

var tmpClass = function() {};
tmpClass.prototype = Base.prototype;
Test.prototype=new tmpClass();

So the trick is that I copy the prototype of the Base class into a
temporary class which has an empty constructor. This class is then
extended by the Test class. This works great but the Eclipse JavaScript
editor can not see the inheritance.

That's why I'm asking if there are other inheritance syntaxes supported
by Eclipse? I tried using an @extends JSDoc comment but this didn't
worked either.

-- 
Bye, K <http://www.ailis.de/~k/>
[A735 47EC D87B 1F15 C1E9 53D3 AA03 6173 A723 E391]
(Finger k@xxxxxxxx to get public key)

Attachment: signature.asc
Description: OpenPGP digital signature


Back to the top