Commit Graph

14 Commits

Author SHA1 Message Date
Damien George
2bf7c09222 py: Properly implement deletion of locals and derefs, and detect errors.
Needed to reinstate 2 delete opcodes, to specifically check that a local
is not deleted twice.
2014-04-09 15:26:46 +01:00
Damien George
f4c9b33abf py: Remove DELETE_SUBSCR opcode, combine with STORE_SUBSCR.
This makes the runtime and object APIs more consistent.  mp_store_subscr
functionality now moved into objects (ie list and dict store_item).
2014-04-08 21:32:29 +01:00
Damien George
1d24ea5207 py: Finish implementation of all del opcodes.
At this point, all opcodes are now implemented!

Some del opcodes have been combined with store opcodes, with the value
to store being MP_OBJ_NULL.
2014-04-08 21:11:49 +01:00
Damien George
523b575039 py: Add LOAD_NULL bytecode and use it to simplify function calls.
Adding this bytecode allows to remove 4 others related to
function/method calls with * and ** support.  Will also help with
bytecodes that make functions/closures with default positional and
keyword args.
2014-03-31 11:59:23 +01:00
Paul Sokolovsky
2447a5b582 py: Support closures with default args. 2014-03-26 23:17:44 +02:00
Damien George
9aa2a527b5 py: Tidy up BINARY_OPs; negation done by special NOT bytecode.
IS_NOT and NOT_IN are now compiled to IS + NOT and IN + NOT, with a new
special NOT bytecode.
2014-02-01 23:04:09 +00:00
Damien George
cbddb279bb py: Implement break/continue from an exception with finally.
Still todo: break/continue from within the finally block itself.
2014-02-01 20:08:18 +00:00
Paul Sokolovsky
90750029df Implement default function arguments (for Python functions).
TODO: Decide if we really need separate bytecode for creating functions
with default arguments - we would need same for closures, then there're
keywords arguments too. Having all combinations is a small exponential
explosion, likely we need just 2 cases - simplest (no defaults, no kw),
and full - defaults & kw.
2014-02-01 15:38:22 +02:00
Damien George
8d4ccc49ed Merge branch 'master' of github.com:dpgeorge/micropython 2014-01-11 09:37:41 +00:00
Damien George
25042b19d2 py: Make arg to MP_BC_RAISE_VARARGS a byte. 2014-01-11 09:33:39 +00:00
John R. Lenton
b8698fca75 unified the bops 2014-01-11 00:58:59 +00:00
Damien George
e9906ac3d7 Add ellipsis object. 2014-01-04 18:44:46 +00:00
Damien George
6baf76e28b py: make closures work. 2013-12-30 22:32:17 +00:00
Damien
d99b05282d Change object representation from 1 big union to individual structs.
A big change.  Micro Python objects are allocated as individual structs
with the first element being a pointer to the type information (which
is itself an object).  This scheme follows CPython.  Much more flexible,
not necessarily slower, uses same heap memory, and can allocate objects
statically.

Also change name prefix, from py_ to mp_ (mp for Micro Python).
2013-12-21 18:17:45 +00:00