Improvements to Variable for codegen

I added new attributes ``.dtype_str`` and ``.dynamic`` to ``Variable`` and created a test for them. Fixes #293.