Skip to content

Checking for equality to magic string in ecma_new_ecma_string_from_number #127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions jerry-core/ecma/base/ecma-helpers-string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,12 @@ ecma_new_ecma_string_from_number (ecma_number_t num) /**< ecma-number */
str_buf,
sizeof (str_buf));

ecma_magic_string_id_t magic_string_id;
if (ecma_is_zt_string_magic (str_buf, &magic_string_id))
{
return ecma_get_magic_string (magic_string_id);
}

ecma_string_t* string_desc_p = ecma_alloc_string ();
string_desc_p->refs = 1;
string_desc_p->is_stack_var = false;
Expand Down
16 changes: 16 additions & 0 deletions tests/jerry/regression-test-issue-113.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 2015 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.

v_1 = [];
v_1 * v_1[v_1 % v_1];