Add more contracts and unit tests

These are added to ast.d, ir.d, object.d and vm.d.