diff options
| author | Damien George <damien.p.george@gmail.com> | 2014-08-15 16:45:41 +0100 |
|---|---|---|
| committer | Damien George <damien.p.george@gmail.com> | 2014-08-15 16:45:41 +0100 |
| commit | 2ac4af6946543ae96cf3659468e1b8cabb057f85 (patch) | |
| tree | 2e19460fec67666259afe529e7f4dff71b6451cf /py/emit.h | |
| parent | 6be0b0a8ec9a6badc601190ccee876755ce7efb7 (diff) | |
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/emit.h')
| -rw-r--r-- | py/emit.h | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -46,10 +46,14 @@ typedef enum { #define MP_EMIT_BREAK_FROM_FOR (0x8000) +#define MP_EMIT_NATIVE_TYPE_ENABLE (0) +#define MP_EMIT_NATIVE_TYPE_RETURN (1) +#define MP_EMIT_NATIVE_TYPE_ARG (2) + typedef struct _emit_t emit_t; typedef struct _emit_method_table_t { - void (*set_native_types)(emit_t *emit, bool do_native_types); + void (*set_native_type)(emit_t *emit, mp_uint_t op, mp_uint_t arg1, qstr arg2); void (*start_pass)(emit_t *emit, pass_kind_t pass, scope_t *scope); void (*end_pass)(emit_t *emit); bool (*last_emit_was_return_value)(emit_t *emit); |
