// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-namespace Microsoft.JScript.Tmp
-{
- using System;
+using System;
+
+namespace Microsoft.JScript {
+
+ public class BooleanPrototype : BooleanObject {
+
+ internal static BooleanPrototype Proto = new BooleanPrototype (null, null);
- public class BooleanPrototype : BooleanObject
- {
public static BooleanConstructor constructor {
- get { throw new NotImplementedException (); }
+ get { return BooleanConstructor.Ctr; }
}
-
+ [JSFunctionAttribute (JSFunctionAttributeEnum.HasThisObject, JSBuiltin.Boolean_toString)]
public static string toString (object thisObj)
{
- throw new NotImplementedException ();
- }
+ 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)
{
- throw new NotImplementedException ();
+ 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)
+ {
}
}
-}
\ No newline at end of file
+}
+
+