I added unit tests to my Ruby CIL DSL, and did a refactoring pass tonight. I now handle named local variable declarations. I’m probably going to auto-include both the System and RbDynamicMethod namespaces by default to get rid of the include noise in the method.
def test_declare_local_name_reference
create_ruby_method('declare_local_name_reference') do
include 'System, RbDynamicMethod'
declare 'Int32', 'count'
ldc_i4 42
stloc 'count'
ldloc 'count'
call 'static Marshal.Int32ToFixnum(Int32)'
ret
end
assert_equal 42, declare_local_name_reference
end