Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » JSDT: types scoping differs from browsers
JSDT: types scoping differs from browsers [message #209764] Thu, 06 March 2008 06:05 Go to next message
Eclipse User
Originally posted by: anton.safonov.gmail.com

Hi all!

Posted this to ATF first, but it might be more appropriate here.

I noticed that JSDT (tried both autumn versions and latest tags) handles
type scopes differently when compared with Firefox/IE.
Let's have such a script:
function aaa() {
var localvar = 1;
globalvar = 2;
function myclass() {
myclass.prototype.mymethod = function() {
// assist here
}
}
}

Inside the "mymethod" "localvar" is visible in the browser, but not
visible in JSDT. As far as I've found, the reason is that once there is a
'prototype' mentioned, InferEngine starts working and marks "myclass" as
an inferred type and puts its scope right under CompilationUnitScope, not
under the scope of the "aaa" function.

Is it an expected behavior and based on some standard or it is more like a
bug?
What would be the easiest "fix" for my custom build to work the way
browsers do?

Regards,
Anton Safonov
Re: types scoping differs from browsers [message #210394 is a reply to message #209764] Fri, 14 March 2008 14:41 Go to previous message
Bradley Childs is currently offline Bradley Childs
Messages: 14
Registered: July 2009
Junior Member
Sounds like a bug. Could you report this in bugzilla against the
webtools/wst.jsdt component?

-Brad
"Anton Safonov" <anton.safonov@gmail.com> wrote in message
news:fb36fee78fe3246544a6a84013a32474$1@www.eclipse.org...
> Hi all!
>
> Posted this to ATF first, but it might be more appropriate here.
>
> I noticed that JSDT (tried both autumn versions and latest tags) handles
> type scopes differently when compared with Firefox/IE.
> Let's have such a script:
> function aaa() {
> var localvar = 1;
> globalvar = 2;
> function myclass() {
> myclass.prototype.mymethod = function() {
> // assist here
> }
> }
> }
>
> Inside the "mymethod" "localvar" is visible in the browser, but not
> visible in JSDT. As far as I've found, the reason is that once there is a
> 'prototype' mentioned, InferEngine starts working and marks "myclass" as
> an inferred type and puts its scope right under CompilationUnitScope, not
> under the scope of the "aaa" function.
>
> Is it an expected behavior and based on some standard or it is more like a
> bug?
> What would be the easiest "fix" for my custom build to work the way
> browsers do?
>
> Regards,
> Anton Safonov
>
Previous Topic:EMF XSD Parser Bug for SimpleType Definition in case of List and Union
Next Topic:War Import
Goto Forum:
  


Current Time: Fri Aug 29 04:17:23 EDT 2014

Powered by FUDForum. Page generated in 0.03095 seconds