Add 'exit' intrinsic
This commit is contained in:
@@ -459,6 +459,16 @@ opfunc_call_1 (OPCODE opdata __unused, struct __int_data *int_data)
|
|||||||
ECMA_FINALIZE (cond_value);
|
ECMA_FINALIZE (cond_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!__strcmp ((const char *) str_value.str_p, "exit"))
|
||||||
|
{
|
||||||
|
ECMA_TRY_CATCH (cond_value, get_variable_value (int_data, opdata.data.call_1.arg1_lit_idx, false), ret_value);
|
||||||
|
JERRY_ASSERT(cond_value.value.value_type == ECMA_TYPE_NUMBER );
|
||||||
|
ecma_number_t * num_p = (ecma_number_t*)ecma_get_pointer(cond_value.value.value);
|
||||||
|
opfunc_exitval (getop_exitval ((T_IDX)*num_p), int_data);
|
||||||
|
ret_value = ecma_make_empty_completion_value ();
|
||||||
|
ECMA_FINALIZE (cond_value);
|
||||||
|
}
|
||||||
|
|
||||||
free_string_literal_copy (&str_value);
|
free_string_literal_copy (&str_value);
|
||||||
|
|
||||||
return ret_value;
|
return ret_value;
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
exit(0);
|
||||||
Reference in New Issue
Block a user