summaryrefslogtreecommitdiffstatshomepage
path: root/py/emitglue.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-08-15 16:45:41 +0100
committerDamien George <damien.p.george@gmail.com>2014-08-15 16:45:41 +0100
commit2ac4af6946543ae96cf3659468e1b8cabb057f85 (patch)
tree2e19460fec67666259afe529e7f4dff71b6451cf /py/emitglue.h
parent6be0b0a8ec9a6badc601190ccee876755ce7efb7 (diff)
downloadmicropython-2ac4af6946543ae96cf3659468e1b8cabb057f85.tar.gz
micropython-2ac4af6946543ae96cf3659468e1b8cabb057f85.zip
py: Allow viper to have type annotations.
Viper functions can now be annotated with the type of their arguments and return value. Eg: @micropython.viper def f(x:int) -> int: return x + 1
Diffstat (limited to 'py/emitglue.h')
-rw-r--r--py/emitglue.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/py/emitglue.h b/py/emitglue.h
index c6cbb6283d..f8363465e2 100644
--- a/py/emitglue.h
+++ b/py/emitglue.h
@@ -48,6 +48,7 @@ typedef struct _mp_code_t {
} u_byte;
struct {
void *fun;
+ mp_uint_t type_sig; // for viper, compressed as 2-bit types; ret is MSB, then arg0, arg1, etc
} u_native;
};
} mp_raw_code_t;
@@ -55,7 +56,7 @@ typedef struct _mp_code_t {
mp_raw_code_t *mp_emit_glue_new_raw_code(void);
void mp_emit_glue_assign_bytecode(mp_raw_code_t *rc, byte *code, uint len, uint n_pos_args, uint n_kwonly_args, qstr *arg_names, uint scope_flags);
-void mp_emit_glue_assign_native(mp_raw_code_t *rc, mp_raw_code_kind_t kind, void *f, uint len, int n_args);
+void mp_emit_glue_assign_native(mp_raw_code_t *rc, mp_raw_code_kind_t kind, void *f, uint len, int n_args, mp_uint_t type_sig);
mp_obj_t mp_make_function_from_raw_code(mp_raw_code_t *rc, mp_obj_t def_args, mp_obj_t def_kw_args);
mp_obj_t mp_make_closure_from_raw_code(mp_raw_code_t *rc, uint n_closed_over, const mp_obj_t *args);