Fix parsing of UTF-8 RegExp literals (#1840)
Fixes #1831 JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
This commit is contained in:
@@ -1821,7 +1821,19 @@ lexer_construct_regexp_object (parser_context_t *context_p, /**< context */
|
||||
const re_compiled_code_t *re_bytecode_p = NULL;
|
||||
ecma_value_t completion_value;
|
||||
|
||||
ecma_string_t *pattern_str_p = ecma_new_ecma_string_from_utf8 (regex_start_p, length);
|
||||
ecma_string_t *pattern_str_p = NULL;
|
||||
|
||||
if (lit_is_valid_cesu8_string (regex_start_p, length))
|
||||
{
|
||||
pattern_str_p = ecma_new_ecma_string_from_utf8 (regex_start_p, length);
|
||||
}
|
||||
else
|
||||
{
|
||||
JERRY_ASSERT (lit_is_valid_utf8_string (regex_start_p, length));
|
||||
pattern_str_p = ecma_new_ecma_string_from_utf8_converted_to_cesu8 (regex_start_p, length);
|
||||
}
|
||||
|
||||
|
||||
completion_value = re_compile_bytecode (&re_bytecode_p,
|
||||
pattern_str_p,
|
||||
current_flags);
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
// Copyright JS Foundation and other contributors, http://js.foundation
|
||||
//
|
||||
// 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.
|
||||
|
||||
//ஃ︠﹍
|
||||
Reference in New Issue
Block a user