mirror of
https://github.com/SerenityOS/serenity
synced 2026-05-14 10:56:35 +02:00
LibJS: Loosen type system
This commits makes effort towards tolerating some of javascript's quirks when it comes to its type system, note that the interpreter's way of handling type coercion is still not mature at all, for example, we still have to implement NaN instead of just crashing when trying to parse a string and failing.
This commit is contained in:
committed by
Andreas Kling
parent
419d57e492
commit
4d22a142f7
@@ -43,6 +43,17 @@ ObjectPrototype::ObjectPrototype()
|
||||
return js_undefined();
|
||||
return Value(this_object->has_own_property(arguments[0].to_string()));
|
||||
});
|
||||
|
||||
put_native_function("toString", [](Object* this_object, Vector<Value>) -> Value {
|
||||
ASSERT(this_object);
|
||||
|
||||
return Value(this_object->to_string());
|
||||
});
|
||||
|
||||
put_native_function("valueOf", [](Object* this_object, Vector<Value>) -> Value {
|
||||
ASSERT(this_object);
|
||||
return this_object->value_of();
|
||||
});
|
||||
}
|
||||
|
||||
ObjectPrototype::~ObjectPrototype()
|
||||
|
||||
Reference in New Issue
Block a user