diff --git a/src/libcoreint/opcodes-ecma-arithmetics.c b/src/libcoreint/opcodes-ecma-arithmetics.c index 1f24e61c0..3db3857a5 100644 --- a/src/libcoreint/opcodes-ecma-arithmetics.c +++ b/src/libcoreint/opcodes-ecma-arithmetics.c @@ -128,7 +128,20 @@ opfunc_addition (opcode_t opdata, /**< operation data */ if (prim_left_value.value.value_type == ECMA_TYPE_STRING || prim_right_value.value.value_type == ECMA_TYPE_STRING) { - JERRY_UNIMPLEMENTED (); + ECMA_TRY_CATCH (str_left_value, ecma_op_to_string (prim_left_value.value), ret_value); + ECMA_TRY_CATCH (str_right_value, ecma_op_to_string (prim_right_value.value), ret_value); + + ecma_string_t *string1_p = ECMA_GET_POINTER (str_left_value.value.value); + ecma_string_t *string2_p = ECMA_GET_POINTER (str_right_value.value.value); + + ecma_string_t *concat_str_p = ecma_concat_ecma_strings (string1_p, string2_p); + + ret_value = set_variable_value (int_data, dst_var_idx, ecma_make_string_value (concat_str_p)); + + ecma_deref_ecma_string (concat_str_p); + + ECMA_FINALIZE (str_right_value); + ECMA_FINALIZE (str_left_value); } else { diff --git a/tests/jerry/string.js b/tests/jerry/string.js new file mode 100644 index 000000000..2467e7d94 --- /dev/null +++ b/tests/jerry/string.js @@ -0,0 +1,18 @@ +// Copyright 2014 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +var a = 'abcd'; +var b = 'dfgh'; + +c = a + b;