Tagged template object references should be released only in post_processing (#3495)

This patch fixes #3483.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik 2020-01-10 15:25:40 +01:00 committed by GitHub
parent 2960dffb50
commit b3b1dfdabd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 2 deletions

View File

@ -141,8 +141,6 @@ parser_tagged_template_literal_finalize (ecma_object_t *template_obj_p, /**< tem
{
parser_tagged_template_literal_freeze_array (template_obj_p);
parser_tagged_template_literal_freeze_array (raw_strings_p);
ecma_deref_object (template_obj_p);
} /* parser_tagged_template_literal_finalize */
#endif /* ENABLED (JERRY_ES2015) */

View File

@ -1614,6 +1614,14 @@ parser_post_processing (parser_context_t *context_p) /**< context */
}
tagged_base_p[-1] = (ecma_value_t) context_p->tagged_template_literal_cp;
ecma_collection_t *collection_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
context_p->tagged_template_literal_cp);
for (uint32_t i = 0; i < collection_p->item_count; i++)
{
ecma_free_value (collection_p->buffer_p[i]);
}
}
#endif /* ENABLED (JERRY_ES2015) */

View File

@ -0,0 +1,26 @@
// 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 assertThrows(src) {
try {
eval(src);
assert(false);
} catch (e) {
assert(e instanceof SyntaxError);
}
}
assertThrows('Setting `o.bar` to');
assertThrows('Setting `o.bar`; Setting `o.bar` to');
assertThrows('Setting `o.bar`; Setting `o.bar`; Setting `o.bar` to');