Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SpiderMonkey JS engine type

31 views
Skip to first unread message

Alexander Zezulinsky

unread,
Feb 22, 2010, 5:42:41 AM2/22/10
to
Hi.

I am implementing SpiderMonkey JS engine based parser.
JavaScript is dynamic, weakly typed language.
But is it possible to know JavaScript function, function parameters,
variable types using SpiderMonkey?

Example:
function doSomething (Date)
{
try
{
var Res = check(Date);
switch (Res)
{
case 1 :
return (true);
break;
case 0:
return (false);
break;
case -1:
return (false);
break;
default:
var ErrMsg = "Wrong date" + Date;
return report(ErrMsg);
break;
}
}
catch (err)
{
AddError("Error detected!");
return (false);
}
}

Result:
JSBool type for the doSomething function.
JSString type for the Date parameter.
JSInt type for the nRes variable.
JSString type for the ErrMsg parameter.

Is it possible to detect types using SpiderMonkey JS engine?

0 new messages