summaryrefslogtreecommitdiff
path: root/cpp/src/FreezeScript/Parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/FreezeScript/Parser.cpp')
-rw-r--r--cpp/src/FreezeScript/Parser.cpp15
1 files changed, 14 insertions, 1 deletions
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);
}