From d1055f98e51341efd3a840772abbf1d7a7d89c2a Mon Sep 17 00:00:00 2001 From: Ruben Ayrapetyan Date: Fri, 19 Jun 2015 21:16:20 +0300 Subject: [PATCH] Add set_variable_value to opfunc_native_call. Related issue: #117 JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com --- jerry-core/vm/opcodes-native-call.cpp | 6 ++++-- tests/jerry/regression-test-issue-117.js | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 tests/jerry/regression-test-issue-117.js diff --git a/jerry-core/vm/opcodes-native-call.cpp b/jerry-core/vm/opcodes-native-call.cpp index 070f812ea1..8aca18bda6 100644 --- a/jerry-core/vm/opcodes-native-call.cpp +++ b/jerry-core/vm/opcodes-native-call.cpp @@ -31,9 +31,10 @@ ecma_completion_value_t opfunc_native_call (opcode_t opdata, /**< operation data */ int_data_t *int_data) /**< interpreter context */ { - // const idx_t dst_var_idx = opdata.data.native_call.lhs; + const idx_t dst_var_idx = opdata.data.native_call.lhs; const idx_t native_call_id_idx = opdata.data.native_call.name; const idx_t args_number = opdata.data.native_call.arg_list; + const opcode_counter_t lit_oc = int_data->pos; JERRY_ASSERT (native_call_id_idx < OPCODE_NATIVE_CALL__COUNT); @@ -106,7 +107,8 @@ opfunc_native_call (opcode_t opdata, /**< operation data */ mem_heap_free_block (zt_str_p); - ret_value = ecma_make_empty_completion_value (); + ret_value = set_variable_value (int_data, lit_oc, dst_var_idx, + ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED)); ECMA_FINALIZE (str_value); } diff --git a/tests/jerry/regression-test-issue-117.js b/tests/jerry/regression-test-issue-117.js new file mode 100644 index 0000000000..b360095fcf --- /dev/null +++ b/tests/jerry/regression-test-issue-117.js @@ -0,0 +1,16 @@ +// Copyright 2015 Samsung Electronics Co., Ltd. +// Copyright 2015 University of Szeged. +// +// 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. + +[print(typeof v_1)];