diff options
author | Damien George <damien.p.george@gmail.com> | 2020-04-06 12:19:03 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2020-04-09 16:02:39 +1000 |
commit | 4914731e5831b289f7933e53cf34bdc79c7b7403 (patch) | |
tree | 6c4177f4771547e4e94eaa95b9bfca3922378ace /py/parse.c | |
parent | a5f2ae10fe2daf0acfb4b68090938206857c0582 (diff) | |
download | micropython-4914731e5831b289f7933e53cf34bdc79c7b7403.tar.gz micropython-4914731e5831b289f7933e53cf34bdc79c7b7403.zip |
py/parse: Remove unnecessary check in const folding for ** operator.
In this part of the code there is no way to get the ** operator, so no need
to check for it.
This commit also adds tests for this, and other related, invalid const
operations.
Diffstat (limited to 'py/parse.c')
-rw-r--r-- | py/parse.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/py/parse.c b/py/parse.c index 6ac5447330..bb18904d78 100644 --- a/py/parse.c +++ b/py/parse.c @@ -655,8 +655,8 @@ STATIC bool fold_constants(parser_t *parser, uint8_t rule_id, size_t num_args) { return false; } mp_token_kind_t tok = MP_PARSE_NODE_LEAF_ARG(peek_result(parser, i)); - if (tok == MP_TOKEN_OP_AT || tok == MP_TOKEN_OP_SLASH || tok == MP_TOKEN_OP_DBL_STAR) { - // Can't fold @ or / or ** + if (tok == MP_TOKEN_OP_AT || tok == MP_TOKEN_OP_SLASH) { + // Can't fold @ or / return false; } mp_binary_op_t op = MP_BINARY_OP_LSHIFT + (tok - MP_TOKEN_OP_DBL_LESS); |