You defined version
as primitive, rather than object. Try this:
window.sys.Bash.version = {};
window.sys.Bash.version.major = 0;
window.sys.Bash.version.minor = 1;
window.sys.Bash.version.build = 1;
Adding properties to primitive is not an error, but the properties will be added to a temporary object that is then lost. Basically, this happened:
window.sys.Bash.version = "";
new String(window.sys.Bash.version).major = 0;
new String(window.sys.Bash.version).minor = 1;
new String(window.sys.Bash.version).build = 1;
This is described here:
Let O be ToObject(base).
Which is effectively the same as Object(str)
, which is effectively the same as new String(str)