PythonExtra/tests/cmdline
Angus Gratton 25ff5b52d9 py/parse: Allow const types other than int to optimise as true/false.
Allows optimisation of cases like:

    import micropython
    _DEBUG = micropython.const(False)
    if _DEBUG:
        print('Debugging info')

Previously the 'if' statement was only optimised out if the type of the
const() argument was integer.

The change is implemented in a way that makes the compiler slightly smaller
(-16 bytes on PYBV11) but compilation will also be very slightly slower.

As a bonus, if const support is enabled then the compiler can now optimise
const truthy/falsey expressions of other types, like:

    while "something":
        pass

... unclear if that is useful, but perhaps it could be.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2022-09-23 16:04:13 +10:00
..
cmd_optimise.py tests/cmdline: Add test for -O option to check optimisation value. 2016-08-26 22:29:38 +10:00
cmd_optimise.py.exp tests/cmdline: Add test for -O option to check optimisation value. 2016-08-26 22:29:38 +10:00
cmd_parsetree.py py: Implement partial PEP-498 (f-string) support. 2021-08-14 16:58:40 +10:00
cmd_parsetree.py.exp py/compile: Allow new qstrs to be allocated at all compiler passes. 2022-05-17 23:39:22 +10:00
cmd_showbc.py py/emit: Suppress unreachable bytecode/native code that follows jump. 2022-06-20 22:28:18 +10:00
cmd_showbc.py.exp py/emit: Suppress unreachable bytecode/native code that follows jump. 2022-06-20 22:28:18 +10:00
cmd_showbc_const.py py/parse: Allow const types other than int to optimise as true/false. 2022-09-23 16:04:13 +10:00
cmd_showbc_const.py.exp py/parse: Allow const types other than int to optimise as true/false. 2022-09-23 16:04:13 +10:00
cmd_showbc_opt.py py/emit: Suppress unreachable bytecode/native code that follows jump. 2022-06-20 22:28:18 +10:00
cmd_showbc_opt.py.exp py/emit: Suppress unreachable bytecode/native code that follows jump. 2022-06-20 22:28:18 +10:00
cmd_verbose.py tests: Add ability to test uPy cmdline executable. 2015-03-13 10:58:34 +00:00
cmd_verbose.py.exp py: Rework bytecode and .mpy file format to be mostly static data. 2022-02-24 18:08:43 +11:00
repl_autocomplete.py py/repl: Generalise REPL autocomplete to use qstr probing. 2018-02-19 16:12:44 +11:00
repl_autocomplete.py.exp py/repl: Generalise REPL autocomplete to use qstr probing. 2018-02-19 16:12:44 +11:00
repl_autoindent.py tests/cmdline: Add test for REPL auto-indent. 2022-04-22 17:00:16 +10:00
repl_autoindent.py.exp tests/cmdline: Add test for REPL auto-indent. 2022-04-22 17:00:16 +10:00
repl_basic.py tests: Improve test coverage of py/compile.c. 2016-10-11 12:30:32 +11:00
repl_basic.py.exp tests: Improve test coverage of py/compile.c. 2016-10-11 12:30:32 +11:00
repl_cont.py py/repl: Check for an identifier char after the keyword. 2016-02-17 08:56:15 +00:00
repl_cont.py.exp py/repl: Check for an identifier char after the keyword. 2016-02-17 08:56:15 +00:00
repl_emacs_keys.py run-tests: Test REPL emacs keys, but only if present. 2015-08-06 00:03:44 +01:00
repl_emacs_keys.py.exp unix: Add exit and paste-mode hints to shell startup banner. 2015-10-12 00:19:00 +01:00
repl_inspect.py unix: Improve command line argument processing. 2021-04-07 12:41:25 +10:00
repl_inspect.py.exp unix: Improve command line argument processing. 2021-04-07 12:41:25 +10:00
repl_micropyinspect tests/cmdline: Add test for MICROPYINSPECT environment variable. 2020-02-04 17:54:31 +11:00
repl_micropyinspect.py tests/cmdline: Add test for MICROPYINSPECT environment variable. 2020-02-04 17:54:31 +11:00
repl_micropyinspect.py.exp tests/cmdline: Add test for MICROPYINSPECT environment variable. 2020-02-04 17:54:31 +11:00
repl_sys_ps1_ps2.py py/modsys: Add optional mutable attributes sys.ps1/ps2 and use them. 2022-03-10 10:58:33 +11:00
repl_sys_ps1_ps2.py.exp py/modsys: Add optional mutable attributes sys.ps1/ps2 and use them. 2022-03-10 10:58:33 +11:00
repl_words_move.py lib/mp-readline: Add word-based move/delete EMACS key sequences. 2020-01-12 13:09:27 +11:00
repl_words_move.py.exp lib/mp-readline: Add word-based move/delete EMACS key sequences. 2020-01-12 13:09:27 +11:00