Move an assertion after post processing. (#3754)

Fixes #3752.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2020-05-18 13:14:17 +02:00
committed by GitHub
parent 09ac2ffa67
commit 2570f8e745
2 changed files with 22 additions and 7 deletions
+7 -7
View File
@@ -2183,13 +2183,6 @@ parser_parse_source (const uint8_t *arg_list_p, /**< function argument list */
parser_parse_statements (&context);
/* When the parsing is successful, only the
* dummy value can be remained on the stack. */
JERRY_ASSERT (context.stack_top_uint8 == CBC_MAXIMUM_BYTE_VALUE
&& context.stack.last_position == 1
&& context.stack.first_p != NULL
&& context.stack.first_p->next_p == NULL
&& context.stack.last_p == NULL);
JERRY_ASSERT (context.last_statement.current_p == NULL);
JERRY_ASSERT (context.last_cbc_opcode == PARSER_CBC_UNAVAILABLE);
@@ -2206,6 +2199,13 @@ parser_parse_source (const uint8_t *arg_list_p, /**< function argument list */
compiled_code_p = parser_post_processing (&context);
parser_list_free (&context.literal_pool);
/* When parsing is successful, only the dummy value can be remained on the stack. */
JERRY_ASSERT (context.stack_top_uint8 == CBC_MAXIMUM_BYTE_VALUE
&& context.stack.last_position == 1
&& context.stack.first_p != NULL
&& context.stack.first_p->next_p == NULL
&& context.stack.last_p == NULL);
JERRY_ASSERT (arg_list_p != NULL || !(context.status_flags & PARSER_ARGUMENTS_NEEDED));
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
@@ -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.
Function("a = 5, b, c = function() { for (var a = 0; a < 4; a++) ; return a; } ()", "eval ('super (a, b, c, d)')")