Catch paramter must not be scanned as function in ES5.1 (#3618)
Fixes #3554 JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
@@ -553,17 +553,26 @@ scanner_pop_literal_pool (parser_context_t *context_p, /**< context */
|
|||||||
|
|
||||||
no_declarations++;
|
no_declarations++;
|
||||||
|
|
||||||
if (type & SCANNER_LITERAL_IS_FUNC)
|
|
||||||
{
|
|
||||||
no_declarations++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (no_reg || (type & no_reg_types))
|
if (no_reg || (type & no_reg_types))
|
||||||
{
|
{
|
||||||
type |= SCANNER_LITERAL_NO_REG;
|
type |= SCANNER_LITERAL_NO_REG;
|
||||||
literal_p->type = type;
|
literal_p->type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (type & SCANNER_LITERAL_IS_FUNC)
|
||||||
|
{
|
||||||
|
no_declarations++;
|
||||||
|
|
||||||
|
#if !ENABLED (JERRY_ES2015)
|
||||||
|
if (type & SCANNER_LITERAL_IS_LOCAL)
|
||||||
|
{
|
||||||
|
/* Catch parameters cannot be functions. */
|
||||||
|
literal_p->type = (uint8_t) (type & ~SCANNER_LITERAL_IS_FUNC);
|
||||||
|
no_declarations--;
|
||||||
|
}
|
||||||
|
#endif /* !ENABLED (JERRY_ES2015) */
|
||||||
|
}
|
||||||
|
|
||||||
intptr_t diff = (intptr_t) (literal_p->char_p - prev_source_p);
|
intptr_t diff = (intptr_t) (literal_p->char_p - prev_source_p);
|
||||||
|
|
||||||
if (diff >= 1 && diff <= UINT8_MAX)
|
if (diff >= 1 && diff <= UINT8_MAX)
|
||||||
|
|||||||
@@ -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 f() {
|
||||||
|
try {
|
||||||
|
assert(e() == 6)
|
||||||
|
throw 8;
|
||||||
|
assert(false);
|
||||||
|
} catch (e) {
|
||||||
|
function e() { return 6 }
|
||||||
|
assert(e == 8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
f();
|
||||||
@@ -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(){try{}catch(e){function e
|
||||||
Reference in New Issue
Block a user