Thea Flowers 84e1d7f304
Make the @micropython.native decorator no-op if support isn't enabled
When adding the ability for boards to turn on the `@micropython.native`, `viper`, and `asm_thumb` decorators it was pointed out that it's somewhat awkward to write libraries and drivers that can take advantage of this since the decorators raise `SyntaxErrors` if they aren't enabled. In the case of `viper` and `asm_thumb` this behavior makes sense as they require writing non-normative code. Drivers could have a normal and viper/thumb implementation and implement them as such:

```python
try:
    import _viper_impl as _impl
except SyntaxError:
    import _python_impl as _impl

def do_thing():
    return _impl.do_thing()
```

For `native`, however, this behavior and the pattern to work around it is less than ideal. Since `native` code should also be valid Python code (although not necessarily the other way around) using the pattern above means *duplicating* the Python implementation and adding `@micropython.native` in the code. This is an unnecessary maintenance burden.

This commit *modifies* the behavior of the `@micropython.native` decorator. On boards with `CIRCUITPY_ENABLE_MPY_NATIVE` turned on it operates as usual. On boards with it turned off it does *nothing*- it doesn't raise a `SyntaxError` and doesn't apply optimizations. This means we can write our drivers/libraries once and take advantage of speedups on boards where they are enabled.
2019-11-26 13:09:30 -08:00
..
2018-07-12 14:13:51 -04:00
2018-07-12 14:13:51 -04:00
2018-07-12 14:13:51 -04:00
2018-07-12 14:13:51 -04:00
2018-08-09 13:29:30 -07:00
2019-10-21 18:57:03 -07:00
2018-08-16 17:41:35 -07:00
2018-07-28 13:29:47 -04:00
2018-08-09 13:29:30 -07:00
2019-04-05 21:38:32 +02:00
2018-07-11 16:45:30 -04:00
2018-07-11 16:45:30 -04:00
2018-10-18 10:37:42 -07:00
2019-04-05 21:41:40 +02:00
2019-01-18 17:09:56 -08:00
2018-10-07 19:37:49 +02:00
2018-11-13 22:04:44 +01:00
2017-07-18 11:57:39 +10:00
2018-07-12 14:13:51 -04:00
2018-07-11 16:45:30 -04:00
2018-07-12 14:13:51 -04:00
2018-07-12 14:13:51 -04:00
2018-07-12 14:13:51 -04:00
2019-01-18 11:53:09 -08:00
2019-01-20 17:32:43 -08:00
2019-01-14 18:09:02 -08:00
2019-11-05 17:49:47 -08:00
2019-04-05 21:40:28 +02:00
2019-01-20 16:18:34 -08:00
2018-08-09 13:29:30 -07:00
2018-08-07 14:58:57 -07:00
2018-05-14 17:41:17 -04:00
2018-05-14 17:41:17 -04:00
2019-10-21 18:57:03 -07:00
2018-07-11 16:45:30 -04:00
2019-11-20 14:02:15 -08:00
2018-07-11 16:45:30 -04:00
2019-02-15 16:53:19 -08:00
2019-10-21 18:57:03 -07:00