Open ai opened 10 years ago
@termi Traceur has same issue: https://github.com/google/traceur-compiler/issues/1200
@termi we can wrap DP$0
into try catch
or detect Rhino.
@termi how I can help with this fix?
Sorry for the long absence. I don't think it should be part of the transpiler, since it's an environment bug and you can wrap it by your self:
var $Object_defineProperty = Object.defineProperty;
Object.defineProperty = function(obj, prop, desc) {
if ( prop === 'prototype' ) {
delete desc['writable'];
arguments[2] = desc;
}
return $Object_defineProperty.apply(this, arguments);
}
But I will do an option for this in one of the future versions. Don't close this issue.
When I try to run compiled JS in Rhino, I get error:
It was generated because of:
Problem is that Rhino deby to replace
prototype
. But this code is unnecessary in Rhino, becauseMyClass.prototype
is already not writable.Rhino support is very important to me, because it allow to run JS code on Java (and languages like JRuby). It is a big market and fix is very small.