Allow records in mutual blocks

Now check type on first pass, body on second. Fixes #515.
documentation: added javascript codegen section to tutorial