public class BooleanPrototype : BooleanObject {
+ internal static BooleanPrototype Proto = new BooleanPrototype (null, null);
+
public static BooleanConstructor constructor {
get { return BooleanConstructor.Ctr; }
}
[JSFunctionAttribute (JSFunctionAttributeEnum.HasThisObject, JSBuiltin.Boolean_toString)]
public static string toString (object thisObj)
{
- SemanticAnalyser.assert_type (thisObj, typeof (BooleanObject));
+ if (!Convert.IsBoolean (thisObj))
+ throw new JScriptException (JSError.BooleanExpected);
+
+ if (thisObj is bool)
+ return (bool) thisObj ? "true" : "false";
+
BooleanObject bo = thisObj as BooleanObject;
return bo.value ? "true" : "false";
}
[JSFunctionAttribute (JSFunctionAttributeEnum.HasThisObject, JSBuiltin.Boolean_valueOf)]
public static object valueOf (object thisObj)
{
- SemanticAnalyser.assert_type (thisObj, typeof (BooleanObject));
+ if (!Convert.IsBoolean (thisObj))
+ throw new JScriptException (JSError.BooleanExpected);
+
+ if (thisObj is bool)
+ return thisObj;
+
BooleanObject bo = thisObj as BooleanObject;
return bo.value;
}
protected BooleanPrototype (ObjectPrototype prototype, Type baseType)
{
- throw new NotImplementedException ();
}
}
}