summaryrefslogtreecommitdiffstats
path: root/Sencha-lang/Elements/SenchaObject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Sencha-lang/Elements/SenchaObject.cpp')
-rw-r--r--Sencha-lang/Elements/SenchaObject.cpp84
1 files changed, 64 insertions, 20 deletions
diff --git a/Sencha-lang/Elements/SenchaObject.cpp b/Sencha-lang/Elements/SenchaObject.cpp
index 5a22bb1..5031171 100644
--- a/Sencha-lang/Elements/SenchaObject.cpp
+++ b/Sencha-lang/Elements/SenchaObject.cpp
@@ -91,10 +91,6 @@ std::string SenchaObject::repr()
representation = "type: null\n";
representation += "null";
break;
- case symbol:
- representation = "type: symbol\n";
- representation += this->text;
- break;
case invalid:
representation = "type: invalid\n";
representation += "some crap";
@@ -122,9 +118,6 @@ std::string SenchaObject::str()
case null:
representation += "null";
break;
- case symbol:
- representation += this->text;
- break;
case invalid:
representation += "some crap";
break;
@@ -150,6 +143,15 @@ SenchaObject SenchaObject::operator+(const SenchaObject& right)const
case float_number:
result.set_value(this->number + right.number);
break;
+ case boolean:
+ result.type = invalid;
+ break;
+ case invalid:
+ result.type = invalid;
+ break;
+ case null:
+ result.type = invalid;
+ break;
}
}
else if(type == float_number && right.type == integer_number )
@@ -184,6 +186,15 @@ SenchaObject SenchaObject::operator-(const SenchaObject& right)const
case float_number:
result.set_value(this->number - right.number);
break;
+ case boolean:
+ result.type = invalid;
+ break;
+ case invalid:
+ result.type = invalid;
+ break;
+ case null:
+ result.type = invalid;
+ break;
}
}
else if(type == float_number && right.type == integer_number )
@@ -217,6 +228,15 @@ SenchaObject SenchaObject::operator*(const SenchaObject& right)const
case float_number:
result.set_value(this->number * right.number);
break;
+ case boolean:
+ result.type = invalid;
+ break;
+ case invalid:
+ result.type = invalid;
+ break;
+ case null:
+ result.type = invalid;
+ break;
}
}
else if(type == float_number && right.type == integer_number )
@@ -250,6 +270,15 @@ SenchaObject SenchaObject::operator/(const SenchaObject& right)const
case float_number:
result.set_value(this->number / right.number);
break;
+ case boolean:
+ result.type = invalid;
+ break;
+ case invalid:
+ result.type = invalid;
+ break;
+ case null:
+ result.type = invalid;
+ break;
}
}
else if(type == float_number && right.type == integer_number )
@@ -269,7 +298,7 @@ SenchaObject SenchaObject::operator/(const SenchaObject& right)const
}
SenchaObject SenchaObject::operator==(const SenchaObject& right)const
- {
+ {
SenchaObject result;
bool value = false;
result.type = boolean;
@@ -301,15 +330,21 @@ SenchaObject SenchaObject::operator==(const SenchaObject& right)const
value = true;
}
break;
+ case invalid:
+ result.type = invalid;
+ break;
+ case null:
+ result.type = invalid;
+ break;
}
}
result.truthy = value;
return result;
- }
+ }
SenchaObject SenchaObject::operator!=(const SenchaObject& right) const
-{
+ {
SenchaObject result;
result.type = boolean;
@@ -319,7 +354,7 @@ SenchaObject SenchaObject::operator!=(const SenchaObject& right) const
else result.truthy = true;
return result;
-}
+ }
SenchaObject SenchaObject::operator>(const SenchaObject& right) const
@@ -349,23 +384,32 @@ SenchaObject SenchaObject::operator>(const SenchaObject& right) const
value = true;
}
break;
+ case invalid:
+ result.type = invalid;
+ break;
+ case boolean:
+ result.type = invalid;
+ break;
+ case null:
+ result.type = invalid;
+ break;
}
}
else if(type == float_number && right.type == integer_number )
- {
- value = (this->number > right.integer);
- }
- else if(type == integer_number && right.type == float_number)
- {
- value = (this->integer > right.number);
- }
+ {
+ value = (this->number > right.integer);
+ }
+ else if(type == integer_number && right.type == float_number)
+ {
+ value = (this->integer > right.number);
+ }
result.truthy = value;
return result;
}
SenchaObject SenchaObject::operator>= (const SenchaObject& right) const
-{
+ {
SenchaObject result;
bool value = false;
result.type = boolean;
@@ -376,7 +420,7 @@ SenchaObject SenchaObject::operator>= (const SenchaObject& right) const
}
result.truthy = value;
return result;
-}
+ }
SenchaObject SenchaObject::operator< (const SenchaObject& right) const
{