diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/includes.h | 1 | ||||
-rw-r--r-- | src/value.cpp | 28 |
2 files changed, 17 insertions, 12 deletions
diff --git a/src/includes.h b/src/includes.h index ae8956f..18e9951 100644 --- a/src/includes.h +++ b/src/includes.h @@ -37,6 +37,7 @@ */ #include "../include/type.h" #include "../include/value.h" +#include "../include/array.h" #include "../include/hiddenpointer.h" #include "../include/globals.h" #include "../include/argument.h" diff --git a/src/value.cpp b/src/value.cpp index b0c3350..194934d 100644 --- a/src/value.cpp +++ b/src/value.cpp @@ -299,7 +299,7 @@ Value &Value::operator=(Value &&value) } // update the object - return *this; + return validate(); } /** @@ -345,7 +345,7 @@ Value &Value::operator=(const Value &value) } // update the object - return *this; + return validate(); } /** @@ -365,7 +365,7 @@ Value &Value::operator=(int16_t value) ZVAL_LONG(_val, value); // update the object - return *this; + return validate(); } /** @@ -385,7 +385,7 @@ Value &Value::operator=(int32_t value) ZVAL_LONG(_val, value); // update the object - return *this; + return validate(); } /** @@ -405,7 +405,7 @@ Value &Value::operator=(int64_t value) ZVAL_LONG(_val, value); // update the object - return *this; + return validate(); } /** @@ -425,7 +425,7 @@ Value &Value::operator=(bool value) ZVAL_BOOL(_val, value); // update the object - return *this; + return validate(); } /** @@ -445,7 +445,7 @@ Value &Value::operator=(char value) ZVAL_STRINGL(_val, &value, 1, 1); // update the object - return *this; + return validate(); } /** @@ -465,7 +465,7 @@ Value &Value::operator=(const std::string &value) ZVAL_STRINGL(_val, value.c_str(), value.size(), 1); // update the object - return *this; + return validate(); } /** @@ -485,7 +485,7 @@ Value &Value::operator=(const char *value) ZVAL_STRING(_val, value, 1); // update the object - return *this; + return validate(); } /** @@ -505,7 +505,7 @@ Value &Value::operator=(double value) ZVAL_DOUBLE(_val, value); // update the object - return *this; + return validate(); } /** @@ -971,8 +971,6 @@ long Value::numericValue() const // already a long? if (isNumeric()) return Z_LVAL_P(_val); - std::cout << "clone to numeric" << std::endl; - // make a clone return clone(numericType).numericValue(); } @@ -1208,6 +1206,9 @@ const Value &Value::set(int index, const Value &value) // the variable has one more reference (the array entry) Z_ADDREF_P(value._val); + // object should stay valid + validate(); + // done return value; } @@ -1243,6 +1244,9 @@ const Value &Value::set(const char *key, int size, const Value &value) // the variable has one more reference (the array entry) Z_ADDREF_P(value._val); + // object should stay valid + validate(); + // done return value; } |