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.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/Sencha-lang/Elements/SenchaObject.cpp b/Sencha-lang/Elements/SenchaObject.cpp
index 56af04c..56c6f3a 100644
--- a/Sencha-lang/Elements/SenchaObject.cpp
+++ b/Sencha-lang/Elements/SenchaObject.cpp
@@ -396,4 +396,19 @@ SenchaObject SenchaObject::operator<= (const SenchaObject& right) const
return result;
}
+SenchaObject SenchaObject::operator-() const
+{
+ SenchaObject result = *this;
+ if(this->type == integer_number) result.integer = - result.integer;
+ else if(this->type == float_number) result.number = - result.number;
+ else result.type = invalid;
+ return result;
+}
+SenchaObject SenchaObject::operator!() const
+{
+ SenchaObject result = *this;
+ if(this->type == boolean) result.truthy = ! result.truthy;
+ else result.type = invalid;
+ return result;
+}
//TODO change code above to something more generic