| JSDT: types scoping differs from browsers [message #209764] |
Thu, 06 March 2008 06:05  |
|
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
|
|
|