JSDT: types scoping differs from browsers [message #209764] |
Thu, 06 March 2008 06:05  |
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  |
Eclipse User |
|
|
|
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
>
|
|
|
Powered by
FUDForum. Page generated in 0.02679 seconds