diff options
author | Michi Henning <michi@zeroc.com> | 2007-11-15 12:35:06 +1000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2007-11-15 12:35:06 +1000 |
commit | 9a5fc16e4664686c8c33288381eba8d129369a0f (patch) | |
tree | 3b82ae16b3e0e0abc41b2f4421d01cc251aa8776 /cpp/src | |
parent | Fixed bug in TestUtil.py that caused line numbers to be omitted from the stack (diff) | |
parent | - Fixing NullHandleException in FreezeScript when a script attempts to (diff) | |
download | ice-9a5fc16e4664686c8c33288381eba8d129369a0f.tar.bz2 ice-9a5fc16e4664686c8c33288381eba8d129369a0f.tar.xz ice-9a5fc16e4664686c8c33288381eba8d129369a0f.zip |
Merge branch 'master' of ssh://cvs.zeroc.com/home/git/ice
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/FreezeScript/Data.cpp | 1 | ||||
-rw-r--r-- | cpp/src/FreezeScript/Parser.cpp | 15 |
2 files changed, 15 insertions, 1 deletions
diff --git a/cpp/src/FreezeScript/Data.cpp b/cpp/src/FreezeScript/Data.cpp index cc51a8a2d0e..1fa91b65209 100644 --- a/cpp/src/FreezeScript/Data.cpp +++ b/cpp/src/FreezeScript/Data.cpp @@ -1186,6 +1186,7 @@ void FreezeScript::StringData::setValue(const string& v) { _value = v; + _length = IntegerDataPtr::dynamicCast(_factory->createInteger(static_cast<Ice::Long>(_value.size()), true)); } // diff --git a/cpp/src/FreezeScript/Parser.cpp b/cpp/src/FreezeScript/Parser.cpp index ca3c2bdcb9c..0ef4287a0b0 100644 --- a/cpp/src/FreezeScript/Parser.cpp +++ b/cpp/src/FreezeScript/Parser.cpp @@ -275,9 +275,22 @@ FreezeScript::BinaryNode::evaluate(const SymbolTablePtr& st) { DataPtr leftValue = _left->evaluate(st); DataPtr rightValue = _right->evaluate(st); + StringDataPtr sleft = StringDataPtr::dynamicCast(leftValue); + StringDataPtr sright = StringDataPtr::dynamicCast(rightValue); IntegerDataPtr ileft = IntegerDataPtr::dynamicCast(leftValue); IntegerDataPtr iright = IntegerDataPtr::dynamicCast(rightValue); - if(ileft && iright) + if(sleft || sright) + { + if(sleft && sright) + { + result = _factory->createString(leftValue->stringValue() + rightValue->stringValue(), true); + } + else + { + _factory->getErrorReporter()->error("string concatenation requires two string arguments"); + } + } + else if(ileft && iright) { result = _factory->createInteger(leftValue->integerValue() + rightValue->integerValue(), true); } |