@@ -915,7 +915,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
915
915
lexer_string_options_t opts ) /**< options */
916
916
{
917
917
#if ENABLED (JERRY_ES2015 )
918
- size_t raw_length_dec = 0 ;
918
+ int32_t raw_length_adjust = 0 ;
919
919
#else /* ENABLED (JERRY_ES2015) */
920
920
JERRY_UNUSED (opts );
921
921
#endif /* ENABLED (JERRY_ES2015) */
@@ -972,7 +972,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
972
972
&& * source_p == LIT_CHAR_LF )
973
973
{
974
974
#if ENABLED (JERRY_ES2015 )
975
- raw_length_dec ++ ;
975
+ raw_length_adjust -- ;
976
976
#endif /* ENABLED (JERRY_ES2015) */
977
977
source_p ++ ;
978
978
}
@@ -1121,7 +1121,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
1121
1121
source_p + 1 < source_end_p &&
1122
1122
source_p [1 ] == LIT_CHAR_LEFT_BRACE )
1123
1123
{
1124
- raw_length_dec ++ ;
1124
+ raw_length_adjust -- ;
1125
1125
source_p ++ ;
1126
1126
break ;
1127
1127
}
@@ -1135,6 +1135,9 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
1135
1135
length += 2 * 3 ;
1136
1136
has_escape = true;
1137
1137
source_p += 4 ;
1138
+ #if ENABLED (JERRY_ES2015 )
1139
+ raw_length_adjust += 2 ;
1140
+ #endif /* ENABLED (JERRY_ES2015) */
1138
1141
column ++ ;
1139
1142
continue ;
1140
1143
}
@@ -1158,7 +1161,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
1158
1161
&& * source_p == LIT_CHAR_LF )
1159
1162
{
1160
1163
source_p ++ ;
1161
- raw_length_dec ++ ;
1164
+ raw_length_adjust -- ;
1162
1165
}
1163
1166
line ++ ;
1164
1167
column = 1 ;
@@ -1206,7 +1209,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
1206
1209
#if ENABLED (JERRY_ES2015 )
1207
1210
if (opts & LEXER_STRING_RAW )
1208
1211
{
1209
- length = (size_t ) (source_p - string_start_p ) - raw_length_dec ;
1212
+ length = (size_t ) (( source_p - string_start_p ) + raw_length_adjust ) ;
1210
1213
}
1211
1214
#endif /* ENABLED (JERRY_ES2015) */
1212
1215
0 commit comments