summaryrefslogtreecommitdiffstats
path: root/Sencha-lang/Elements/SenchaObject.cpp
diff options
context:
space:
mode:
authorJustyna Ilczuk <justyna.ilczuk@gmail.com>2013-01-01 18:05:35 +0100
committerJustyna Ilczuk <justyna.ilczuk@gmail.com>2013-01-01 18:05:35 +0100
commitd65e408e5545963852df43cea93d9c82cd6b8f68 (patch)
tree33353b6c709b35322f127659cd21811ceea7279b /Sencha-lang/Elements/SenchaObject.cpp
parent4526de47cfbcc121e7bb09187b1641c060651322 (diff)
downloadsencha-lang-functions.tar.gz
sencha-lang-functions.tar.bz2
sencha-lang-functions.zip
Functions seem to work. Additionaly unary expressions :>.functions
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