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?