always use an IIFE for classes - fixes #435
This commit is contained in:
@@ -5,16 +5,20 @@ var _prototypeProperties = function (child, staticProps, instanceProps) {
|
||||
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
|
||||
};
|
||||
|
||||
var Test = function Test() {};
|
||||
var Test = (function () {
|
||||
var Test = function Test() {};
|
||||
|
||||
_prototypeProperties(Test, null, {
|
||||
test: {
|
||||
get: function () {
|
||||
return 5 + 5;
|
||||
},
|
||||
set: function (val) {
|
||||
this._test = val;
|
||||
},
|
||||
enumerable: true
|
||||
}
|
||||
});
|
||||
_prototypeProperties(Test, null, {
|
||||
test: {
|
||||
get: function () {
|
||||
return 5 + 5;
|
||||
},
|
||||
set: function (val) {
|
||||
this._test = val;
|
||||
},
|
||||
enumerable: true
|
||||
}
|
||||
});
|
||||
|
||||
return Test;
|
||||
})();
|
||||
|
||||
@@ -5,13 +5,17 @@ var _prototypeProperties = function (child, staticProps, instanceProps) {
|
||||
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
|
||||
};
|
||||
|
||||
var Test = function Test() {};
|
||||
var Test = (function () {
|
||||
var Test = function Test() {};
|
||||
|
||||
_prototypeProperties(Test, null, {
|
||||
test: {
|
||||
get: function () {
|
||||
return 5 + 5;
|
||||
},
|
||||
enumerable: true
|
||||
}
|
||||
});
|
||||
_prototypeProperties(Test, null, {
|
||||
test: {
|
||||
get: function () {
|
||||
return 5 + 5;
|
||||
},
|
||||
enumerable: true
|
||||
}
|
||||
});
|
||||
|
||||
return Test;
|
||||
})();
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
var Test = function Test() {};
|
||||
var Test = (function () {
|
||||
var Test = function Test() {};
|
||||
|
||||
Test.prototype.test = function () {
|
||||
return 5 + 5;
|
||||
};
|
||||
Test.prototype.test = function () {
|
||||
return 5 + 5;
|
||||
};
|
||||
|
||||
return Test;
|
||||
})();
|
||||
|
||||
@@ -5,13 +5,17 @@ var _prototypeProperties = function (child, staticProps, instanceProps) {
|
||||
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
|
||||
};
|
||||
|
||||
var Test = function Test() {};
|
||||
var Test = (function () {
|
||||
var Test = function Test() {};
|
||||
|
||||
_prototypeProperties(Test, null, {
|
||||
test: {
|
||||
set: function (val) {
|
||||
this._test = val;
|
||||
},
|
||||
enumerable: true
|
||||
}
|
||||
});
|
||||
_prototypeProperties(Test, null, {
|
||||
test: {
|
||||
set: function (val) {
|
||||
this._test = val;
|
||||
},
|
||||
enumerable: true
|
||||
}
|
||||
});
|
||||
|
||||
return Test;
|
||||
})();
|
||||
|
||||
@@ -5,14 +5,18 @@ var _prototypeProperties = function (child, staticProps, instanceProps) {
|
||||
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
|
||||
};
|
||||
|
||||
var A = function A() {};
|
||||
var A = (function () {
|
||||
var A = function A() {};
|
||||
|
||||
A.a = function () {};
|
||||
A.a = function () {};
|
||||
|
||||
_prototypeProperties(A, {
|
||||
b: {
|
||||
get: function () {},
|
||||
set: function (b) {},
|
||||
enumerable: true
|
||||
}
|
||||
});
|
||||
_prototypeProperties(A, {
|
||||
b: {
|
||||
get: function () {},
|
||||
set: function (b) {},
|
||||
enumerable: true
|
||||
}
|
||||
});
|
||||
|
||||
return A;
|
||||
})();
|
||||
|
||||
@@ -14,21 +14,25 @@ var _defineProperty = function (obj, key, value) {
|
||||
});
|
||||
};
|
||||
|
||||
var Foo = function Foo() {};
|
||||
var Foo = (function () {
|
||||
var Foo = function Foo() {};
|
||||
|
||||
_prototypeProperties(Foo, null, _defineProperty({
|
||||
bar: {
|
||||
_prototypeProperties(Foo, null, _defineProperty({
|
||||
bar: {
|
||||
get: function () {
|
||||
return _defineProperty(this, "bar", complex()).bar;
|
||||
},
|
||||
enumerable: true
|
||||
}
|
||||
}, bar, {
|
||||
get: function () {
|
||||
return _defineProperty(this, "bar", complex()).bar;
|
||||
return _defineProperty(this, bar, complex())[bar];
|
||||
},
|
||||
enumerable: true
|
||||
}
|
||||
}, bar, {
|
||||
get: function () {
|
||||
return _defineProperty(this, bar, complex())[bar];
|
||||
},
|
||||
enumerable: true
|
||||
}));
|
||||
}));
|
||||
|
||||
return Foo;
|
||||
})();
|
||||
|
||||
var foo = Object.defineProperties({}, _defineProperty({
|
||||
bar: {
|
||||
|
||||
@@ -5,16 +5,20 @@ var _prototypeProperties = function (child, staticProps, instanceProps) {
|
||||
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
|
||||
};
|
||||
|
||||
var Test = function Test() {};
|
||||
var Test = (function () {
|
||||
var Test = function Test() {};
|
||||
|
||||
_prototypeProperties(Test, null, {
|
||||
bar: {
|
||||
get: function () {
|
||||
throw new Error("wow");
|
||||
},
|
||||
enumerable: true
|
||||
}
|
||||
});
|
||||
_prototypeProperties(Test, null, {
|
||||
bar: {
|
||||
get: function () {
|
||||
throw new Error("wow");
|
||||
},
|
||||
enumerable: true
|
||||
}
|
||||
});
|
||||
|
||||
return Test;
|
||||
})();
|
||||
|
||||
var test = new Test();
|
||||
test.bar;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"column": 10
|
||||
},
|
||||
"generated": {
|
||||
"line": 13,
|
||||
"column": 13
|
||||
"line": 14,
|
||||
"column": 15
|
||||
}
|
||||
}]
|
||||
|
||||
Reference in New Issue
Block a user