Remove the ENABLED/DISABLED macros (#4515)
The removal of these macros enabled cppcheck to reveal new errors. These errors are also fixed by the patch. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
#include "js-scanner-internal.h"
|
||||
#include "lit-char-helpers.h"
|
||||
|
||||
#if ENABLED (JERRY_PARSER)
|
||||
#if JERRY_PARSER
|
||||
|
||||
/** \addtogroup parser Parser
|
||||
* @{
|
||||
@@ -29,7 +29,7 @@
|
||||
* @{
|
||||
*/
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
|
||||
/**
|
||||
* Add the "async" literal to the literal pool.
|
||||
@@ -245,9 +245,9 @@ scanner_check_arrow_arg (parser_context_t *context_p, /**< context */
|
||||
|
||||
if (context_p->token.type == LEXER_LEFT_BRACE)
|
||||
{
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
parser_stack_push_uint8 (context_p, 0);
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
parser_stack_push_uint8 (context_p, SCAN_STACK_OBJECT_LITERAL);
|
||||
scanner_context_p->mode = SCAN_MODE_PROPERTY_NAME;
|
||||
return;
|
||||
@@ -367,7 +367,7 @@ typedef enum
|
||||
SCANNER_SCAN_BRACKET_ARROW_WITH_ONE_ARG, /**< arrow function with one argument */
|
||||
} scanner_scan_bracket_arrow_type_t;
|
||||
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
/**
|
||||
* Scan bracketed expressions.
|
||||
@@ -377,19 +377,19 @@ scanner_scan_bracket (parser_context_t *context_p, /**< context */
|
||||
scanner_context_t *scanner_context_p) /**< scanner context */
|
||||
{
|
||||
size_t depth = 0;
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
const uint8_t *arrow_source_p;
|
||||
const uint8_t *async_source_p = NULL;
|
||||
scanner_scan_bracket_arrow_type_t arrow_type = SCANNER_SCAN_BRACKET_NO_ARROW;
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
JERRY_ASSERT (context_p->token.type == LEXER_LEFT_PAREN);
|
||||
|
||||
do
|
||||
{
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
arrow_source_p = context_p->source_p;
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
depth++;
|
||||
lexer_next_token (context_p);
|
||||
}
|
||||
@@ -403,13 +403,13 @@ scanner_scan_bracket (parser_context_t *context_p, /**< context */
|
||||
{
|
||||
if (context_p->token.lit_location.type != LEXER_IDENT_LITERAL)
|
||||
{
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
arrow_source_p = NULL;
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
break;
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
const uint8_t *source_p = context_p->source_p;
|
||||
|
||||
if (lexer_check_arrow (context_p))
|
||||
@@ -420,7 +420,7 @@ scanner_scan_bracket (parser_context_t *context_p, /**< context */
|
||||
}
|
||||
|
||||
size_t total_depth = depth;
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
while (depth > 0 && lexer_check_next_character (context_p, LIT_CHAR_RIGHT_PAREN))
|
||||
{
|
||||
@@ -431,19 +431,19 @@ scanner_scan_bracket (parser_context_t *context_p, /**< context */
|
||||
if (context_p->token.keyword_type == LEXER_KEYW_EVAL
|
||||
&& lexer_check_next_character (context_p, LIT_CHAR_LEFT_PAREN))
|
||||
{
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
/* A function call cannot be an eval function. */
|
||||
arrow_source_p = NULL;
|
||||
const uint16_t flags = (uint16_t) (SCANNER_LITERAL_POOL_CAN_EVAL | SCANNER_LITERAL_POOL_HAS_SUPER_REFERENCE);
|
||||
#else /* !ENABLED (JERRY_ESNEXT) */
|
||||
#else /* !JERRY_ESNEXT */
|
||||
const uint16_t flags = SCANNER_LITERAL_POOL_CAN_EVAL;
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
scanner_context_p->active_literal_pool_p->status_flags |= flags;
|
||||
break;
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
if (total_depth == depth)
|
||||
{
|
||||
if (lexer_check_arrow_param (context_p))
|
||||
@@ -473,10 +473,10 @@ scanner_scan_bracket (parser_context_t *context_p, /**< context */
|
||||
}
|
||||
|
||||
arrow_source_p = NULL;
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
break;
|
||||
}
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
case LEXER_THREE_DOTS:
|
||||
case LEXER_LEFT_SQUARE:
|
||||
case LEXER_LEFT_BRACE:
|
||||
@@ -486,23 +486,23 @@ scanner_scan_bracket (parser_context_t *context_p, /**< context */
|
||||
depth--;
|
||||
break;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
default:
|
||||
{
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
arrow_source_p = NULL;
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
if (JERRY_UNLIKELY (scanner_context_p->async_source_p != NULL)
|
||||
&& (arrow_source_p == NULL || depth > 0))
|
||||
{
|
||||
scanner_context_p->async_source_p = NULL;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
while (depth > 0)
|
||||
{
|
||||
@@ -510,7 +510,7 @@ scanner_scan_bracket (parser_context_t *context_p, /**< context */
|
||||
depth--;
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
if (arrow_source_p != NULL)
|
||||
{
|
||||
JERRY_ASSERT (async_source_p == NULL);
|
||||
@@ -558,7 +558,7 @@ scanner_scan_bracket (parser_context_t *context_p, /**< context */
|
||||
scanner_context_p->async_source_p = async_source_p;
|
||||
scanner_check_async_function (context_p, scanner_context_p);
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
} /* scanner_scan_bracket */
|
||||
|
||||
/**
|
||||
@@ -614,4 +614,4 @@ scanner_check_directives (parser_context_t *context_p, /**< context */
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* ENABLED (JERRY_PARSER) */
|
||||
#endif /* JERRY_PARSER */
|
||||
|
||||
Reference in New Issue
Block a user