JSValue::operator==(const JSValue&)

This commit is contained in:
beard%netscape.com 2000-04-29 14:13:43 +00:00
parent 6d66e9ffb3
commit e9c3fbc2e1
2 changed files with 38 additions and 0 deletions

View File

@ -37,6 +37,25 @@
namespace JavaScript {
namespace JSTypes {
// the canonical undefined value.
const JSValue kUndefinedValue;
int JSValue::operator==(const JSValue& value) const
{
if (this->tag == value.tag) {
#define CASE(T) case T##_tag: return (this->T == value.T)
switch (tag) {
CASE(i8); CASE(u8);
CASE(i16); CASE(u16);
CASE(i32); CASE(u32); CASE(f32);
CASE(i64); CASE(u64); CASE(f64);
CASE(object); CASE(array); CASE(function);
#undef CASE
}
}
return 0;
}
Formatter& operator<<(Formatter& f, const JSValue& value)
{
switch (value.tag) {

View File

@ -37,6 +37,25 @@
namespace JavaScript {
namespace JSTypes {
// the canonical undefined value.
const JSValue kUndefinedValue;
int JSValue::operator==(const JSValue& value) const
{
if (this->tag == value.tag) {
#define CASE(T) case T##_tag: return (this->T == value.T)
switch (tag) {
CASE(i8); CASE(u8);
CASE(i16); CASE(u16);
CASE(i32); CASE(u32); CASE(f32);
CASE(i64); CASE(u64); CASE(f64);
CASE(object); CASE(array); CASE(function);
#undef CASE
}
}
return 0;
}
Formatter& operator<<(Formatter& f, const JSValue& value)
{
switch (value.tag) {