diff options
author | Jim Mussared <jim.mussared@gmail.com> | 2019-09-26 22:52:04 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2020-04-05 14:11:51 +1000 |
commit | a9a745e4b4838749a47857f1d0c95de52dc85f58 (patch) | |
tree | 60469e58476c5a68999ad0a2e8d58dbca8a6abb8 /py/compile.c | |
parent | 312c699491830daacd33f032a6d6fc6cc6ff0c96 (diff) |
py: Use preprocessor to detect error reporting level (terse/detailed).
Instead of compiler-level if-logic. This is necessary to know what error
strings are included in the build at the preprocessor stage, so that string
compression can be implemented.
Diffstat (limited to 'py/compile.c')
-rw-r--r-- | py/compile.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/py/compile.c b/py/compile.c index 225f20707..750cb9c3d 100644 --- a/py/compile.c +++ b/py/compile.c @@ -2552,21 +2552,21 @@ STATIC void compile_atom_brace_helper(compiler_t *comp, mp_parse_node_struct_t * compile_node(comp, pn_i); if (is_dict) { if (!is_key_value) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { - compile_syntax_error(comp, (mp_parse_node_t)pns, "invalid syntax"); - } else { - compile_syntax_error(comp, (mp_parse_node_t)pns, "expecting key:value for dict"); - } + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE + compile_syntax_error(comp, (mp_parse_node_t)pns, "invalid syntax"); + #else + compile_syntax_error(comp, (mp_parse_node_t)pns, "expecting key:value for dict"); + #endif return; } EMIT(store_map); } else { if (is_key_value) { - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { - compile_syntax_error(comp, (mp_parse_node_t)pns, "invalid syntax"); - } else { - compile_syntax_error(comp, (mp_parse_node_t)pns, "expecting just a value for set"); - } + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE + compile_syntax_error(comp, (mp_parse_node_t)pns, "invalid syntax"); + #else + compile_syntax_error(comp, (mp_parse_node_t)pns, "expecting just a value for set"); + #endif return; } } |