@@ -915,7 +915,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
915915 lexer_string_options_t opts ) /**< options */
916916{
917917#if ENABLED (JERRY_ES2015 )
918- size_t raw_length_dec = 0 ;
918+ int32_t raw_length_adjust = 0 ;
919919#else /* ENABLED (JERRY_ES2015) */
920920 JERRY_UNUSED (opts );
921921#endif /* ENABLED (JERRY_ES2015) */
@@ -972,7 +972,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
972972 && * source_p == LIT_CHAR_LF )
973973 {
974974#if ENABLED (JERRY_ES2015 )
975- raw_length_dec ++ ;
975+ raw_length_adjust -- ;
976976#endif /* ENABLED (JERRY_ES2015) */
977977 source_p ++ ;
978978 }
@@ -1121,7 +1121,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
11211121 source_p + 1 < source_end_p &&
11221122 source_p [1 ] == LIT_CHAR_LEFT_BRACE )
11231123 {
1124- raw_length_dec ++ ;
1124+ raw_length_adjust -- ;
11251125 source_p ++ ;
11261126 break ;
11271127 }
@@ -1135,6 +1135,9 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
11351135 length += 2 * 3 ;
11361136 has_escape = true;
11371137 source_p += 4 ;
1138+ #if ENABLED (JERRY_ES2015 )
1139+ raw_length_adjust += 2 ;
1140+ #endif /* ENABLED (JERRY_ES2015) */
11381141 column ++ ;
11391142 continue ;
11401143 }
@@ -1158,7 +1161,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
11581161 && * source_p == LIT_CHAR_LF )
11591162 {
11601163 source_p ++ ;
1161- raw_length_dec ++ ;
1164+ raw_length_adjust -- ;
11621165 }
11631166 line ++ ;
11641167 column = 1 ;
@@ -1206,7 +1209,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
12061209#if ENABLED (JERRY_ES2015 )
12071210 if (opts & LEXER_STRING_RAW )
12081211 {
1209- length = (size_t ) (source_p - string_start_p ) - raw_length_dec ;
1212+ length = (size_t ) (( source_p - string_start_p ) + raw_length_adjust ) ;
12101213 }
12111214#endif /* ENABLED (JERRY_ES2015) */
12121215
0 commit comments