Make references to native arrays work properly. Also makes the rewriting rules
a bit more regular.
Merge pull request #91 from pjonsson/native-fixes

Make references to native arrays work properly in code generated from scan.