fix(es/compat): Fix handling of private getters and setters (#3695)

This commit is contained in:
Austaras 2022-02-25 14:08:35 +08:00 committed by GitHub
parent 25b54ae7a8
commit 05de029cfa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
301 changed files with 5770 additions and 3013 deletions

View File

@ -3,30 +3,44 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return descriptor.value;
}
function _classApplyDescriptorSet(receiver, descriptor, value) {
if (descriptor.set) {
descriptor.set.call(receiver, value);
} else {
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
}
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _classPrivateFieldGet(receiver, privateMap) {
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver).value;
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
function _classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
_classApplyDescriptorSet(receiver, descriptor, value);
return value;
}
function _defineProperties(target, props) {
@ -43,6 +57,7 @@ function _createClass(Constructor, protoProps, staticProps) {
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
var _name = new WeakMap();
var Animal = /*#__PURE__*/ function() {
"use strict";
function Animal(name) {
@ -63,4 +78,3 @@ var Animal = /*#__PURE__*/ function() {
]);
return Animal;
}();
var _name = new WeakMap();

View File

@ -3,30 +3,44 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return descriptor.value;
}
function _classApplyDescriptorSet(receiver, descriptor, value) {
if (descriptor.set) {
descriptor.set.call(receiver, value);
} else {
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
}
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _classPrivateFieldGet(receiver, privateMap) {
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver).value;
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
function _classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
_classApplyDescriptorSet(receiver, descriptor, value);
return value;
}
function _defineProperties(target, props) {
@ -43,6 +57,7 @@ function _createClass(Constructor, protoProps, staticProps) {
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
var _name = new WeakMap();
var Animal = /*#__PURE__*/ function() {
"use strict";
function Animal(name) {
@ -63,4 +78,3 @@ var Animal = /*#__PURE__*/ function() {
]);
return Animal;
}();
var _name = new WeakMap();

View File

@ -4,16 +4,27 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return privateMap.get(receiver).value;
return descriptor.value;
}
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
var _ws = new WeakMap(), _ws2 = new WeakMap();
class Foo {
get connected() {
return _classPrivateFieldGet(this, _ws2) && _classPrivateFieldGet(this, _ws).readyState === _ws1.default.OPEN;
@ -29,5 +40,3 @@ class Foo {
});
}
}
var _ws = new WeakMap();
var _ws2 = new WeakMap();

View File

@ -12,25 +12,39 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return privateMap.get(receiver).value;
return descriptor.value;
}
function _classApplyDescriptorSet(receiver, descriptor, value) {
if (descriptor.set) {
descriptor.set.call(receiver, value);
} else {
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
}
}
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
function _classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
_classApplyDescriptorSet(receiver, descriptor, value);
return value;
}
function _interopRequireDefault(obj) {
@ -39,6 +53,31 @@ function _interopRequireDefault(obj) {
};
}
const connectionStates = Object.keys(_ws.default);
var /**
* The serialization handler.
* @type {Serialization}
*/ _serialization1 = new WeakMap(), /**
* The compression handler.
* @type {Compression}
*/ _compression1 = new WeakMap(), /**
* The current sequence.
* @type {number}
*/ _seq = new WeakMap(), /**
* The shard sequence when the websocket last closed.
* @type {number}
*/ _closingSeq = new WeakMap(), /**
* The rate-limit bucket.
* @type {Bucket}
*/ _bucket = new WeakMap(), /**
* The rate-limit bucket for presence updates.
* @type {Bucket}
*/ _presenceBucket = new WeakMap(), /**
* The current connection.
* @type {WebSocket}
*/ _ws1 = new WeakMap(), /**
* Packets that are waiting to be sent.
* @type {DiscordPacket[]}
*/ _queue = new WeakMap();
class Shard extends _utils.Emitter {
/**
* The current sequence
@ -342,59 +381,35 @@ class Shard extends _utils.Emitter {
* @param {number} id The ID of this shard.
*/ constructor(manager, id){
super();
_classPrivateFieldInit(this, /**
* The serialization handler.
* @type {Serialization}
*/ _serialization1, {
_classPrivateFieldInit(this, _serialization1, {
writable: true,
value: void 0
});
_classPrivateFieldInit(this, /**
* The compression handler.
* @type {Compression}
*/ _compression1, {
_classPrivateFieldInit(this, _compression1, {
writable: true,
value: void 0
});
_classPrivateFieldInit(this, /**
* The current sequence.
* @type {number}
*/ _seq, {
_classPrivateFieldInit(this, _seq, {
writable: true,
value: void 0
});
_classPrivateFieldInit(this, /**
* The shard sequence when the websocket last closed.
* @type {number}
*/ _closingSeq, {
_classPrivateFieldInit(this, _closingSeq, {
writable: true,
value: void 0
});
_classPrivateFieldInit(this, /**
* The rate-limit bucket.
* @type {Bucket}
*/ _bucket, {
_classPrivateFieldInit(this, _bucket, {
writable: true,
value: void 0
});
_classPrivateFieldInit(this, /**
* The rate-limit bucket for presence updates.
* @type {Bucket}
*/ _presenceBucket, {
_classPrivateFieldInit(this, _presenceBucket, {
writable: true,
value: void 0
});
_classPrivateFieldInit(this, /**
* The current connection.
* @type {WebSocket}
*/ _ws1, {
_classPrivateFieldInit(this, _ws1, {
writable: true,
value: void 0
});
_classPrivateFieldInit(this, /**
* Packets that are waiting to be sent.
* @type {DiscordPacket[]}
*/ _queue, {
_classPrivateFieldInit(this, _queue, {
writable: true,
value: void 0
});
@ -448,11 +463,3 @@ class Shard extends _utils.Emitter {
* @property {number} [code=1000] The code to use.
*/
exports.Shard = Shard;
var _serialization1 = new WeakMap();
var _compression1 = new WeakMap();
var _seq = new WeakMap();
var _closingSeq = new WeakMap();
var _bucket = new WeakMap();
var _presenceBucket = new WeakMap();
var _ws1 = new WeakMap();
var _queue = new WeakMap();

View File

@ -11,11 +11,21 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return privateMap.get(receiver).value;
return descriptor.value;
}
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
@ -33,6 +43,10 @@ const headers = [
"x-ratelimit-reset",
"via"
];
var /**
* Used for sequential requests.
* @type {AsyncQueue}
*/ _queue = new WeakMap();
class RequestHandler {
/**
* Whether this handler is inactive or not.
@ -186,10 +200,7 @@ class RequestHandler {
* @param {Rest} rest The REST Manager.
* @param {string} id The ID of this request handler.
*/ constructor(rest, id){
_classPrivateFieldInit(this, /**
* Used for sequential requests.
* @type {AsyncQueue}
*/ _queue, {
_classPrivateFieldInit(this, _queue, {
writable: true,
value: new _utils.AsyncQueue()
});
@ -216,7 +227,6 @@ class RequestHandler {
}
}
exports.RequestHandler = RequestHandler;
var _queue = new WeakMap();
/**
* Bulk fetch headers from a node-fetch response.
* @param {Response} res The request response.

View File

@ -3,16 +3,26 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return descriptor.value;
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _classPrivateFieldGet(receiver, privateMap) {
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver).value;
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
@ -56,7 +66,7 @@ function _templateObject1() {
};
return data;
}
var _tag = new WeakSet();
var _tag = new WeakSet(), _tag2 = new WeakMap();
var Foo = function Foo() {
"use strict";
_classCallCheck(this, Foo);
@ -70,7 +80,6 @@ var Foo = function Foo() {
var receiver2 = _classPrivateFieldGet(this, _tag2).bind(this)(_templateObject1());
console.log(receiver2 === this);
};
var _tag2 = new WeakMap();
function tag() {
return this;
}

View File

@ -3,29 +3,44 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return privateMap.get(receiver).value;
return descriptor.value;
}
function _classApplyDescriptorSet(receiver, descriptor, value) {
if (descriptor.set) {
descriptor.set.call(receiver, value);
} else {
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
}
}
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
function _classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
_classApplyDescriptorSet(receiver, descriptor, value);
return value;
}
// @target: esnext, es2022, es2015
let getX;
var _x = new WeakMap();
class C {
constructor(x){
_classPrivateFieldInit(this, _x, {
@ -35,7 +50,6 @@ class C {
_classPrivateFieldSet(this, _x, x);
}
}
var _x = new WeakMap();
var __ = {
writable: true,
value: (()=>{

View File

@ -3,34 +3,49 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return descriptor.value;
}
function _classApplyDescriptorSet(receiver, descriptor, value) {
if (descriptor.set) {
descriptor.set.call(receiver, value);
} else {
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
}
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _classPrivateFieldGet(receiver, privateMap) {
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver).value;
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
function _classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
_classApplyDescriptorSet(receiver, descriptor, value);
return value;
}
// @target: esnext, es2022, es2015
var getX;
var _x = new WeakMap();
var C = function C(x) {
"use strict";
_classCallCheck(this, C);
@ -40,7 +55,6 @@ var C = function C(x) {
});
_classPrivateFieldSet(this, _x, x);
};
var _x = new WeakMap();
var __ = {
writable: true,
value: function() {

View File

@ -1,6 +1,6 @@
var C = function(x) {
var _x = new WeakMap(), C = function(x) {
"use strict";
var obj, privateMap, value;
var obj, privateMap, value, receiver, privateMap, value, descriptor;
!function(instance, Constructor) {
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
}(this, C), obj = this, value = {
@ -8,10 +8,14 @@ var C = function(x) {
value: 1
}, (function(obj, privateCollection) {
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
})(obj, privateMap = _x), privateMap.set(obj, value), (function(receiver, privateMap, value) {
})(obj, privateMap = _x), privateMap.set(obj, value), receiver = this, privateMap = _x, value = x, descriptor = (function(receiver, privateMap, action) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to set private field on non-instance");
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
descriptor.value = value;
})(this, _x, x);
}, _x = new WeakMap();
return privateMap.get(receiver);
})(receiver, privateMap, "set"), (function(receiver, descriptor, value) {
if (descriptor.set) descriptor.set.call(receiver, value);
else {
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
descriptor.value = value;
}
})(receiver, descriptor, value);
};

View File

@ -1,8 +1,23 @@
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return descriptor.value;
}
function _classCheckPrivateStaticFieldDescriptor(descriptor, action) {
if (descriptor === undefined) {
throw new TypeError("attempted to " + action + " private static field before its declaration");
}
}
function _classStaticPrivateFieldSpecGet(receiver, classConstructor, descriptor) {
_classCheckPrivateStaticAccess(receiver, classConstructor);
_classCheckPrivateStaticFieldDescriptor(descriptor, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classCheckPrivateStaticAccess(receiver, classConstructor) {
if (receiver !== classConstructor) {
throw new TypeError("Private static access of wrong provenance");
}
return descriptor.value;
}
// @useDefineForClassFields: false
// @target: es2015

View File

@ -1,9 +1,14 @@
class C {
}
!function(receiver, classConstructor, descriptor) {
if (receiver !== classConstructor) throw new TypeError("Private static access of wrong provenance");
return descriptor.value;
}(C, C, {
var _x = {
writable: !0,
value: 1
});
};
(()=>{
var receiver, classConstructor, descriptor, receiver, descriptor;
receiver = C, classConstructor = C, descriptor = _x, (function(receiver, classConstructor) {
if (receiver !== classConstructor) throw new TypeError("Private static access of wrong provenance");
})(receiver, classConstructor), (function(descriptor, action) {
if (void 0 === descriptor) throw new TypeError("attempted to get private static field before its declaration");
})(descriptor, "get"), (descriptor = descriptor).get ? descriptor.get.call(receiver) : descriptor.value;
})();

View File

@ -1,13 +1,28 @@
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return descriptor.value;
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _classCheckPrivateStaticFieldDescriptor(descriptor, action) {
if (descriptor === undefined) {
throw new TypeError("attempted to " + action + " private static field before its declaration");
}
}
function _classStaticPrivateFieldSpecGet(receiver, classConstructor, descriptor) {
_classCheckPrivateStaticAccess(receiver, classConstructor);
_classCheckPrivateStaticFieldDescriptor(descriptor, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classCheckPrivateStaticAccess(receiver, classConstructor) {
if (receiver !== classConstructor) {
throw new TypeError("Private static access of wrong provenance");
}
return descriptor.value;
}
var C = function C() {
"use strict";

View File

@ -3,11 +3,15 @@ var C = function() {
!function(instance, Constructor) {
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
}(this, C);
};
!function(receiver, classConstructor, descriptor) {
if (receiver !== classConstructor) throw new TypeError("Private static access of wrong provenance");
return descriptor.value;
}(C, C, {
}, _x = {
writable: !0,
value: 1
});
};
!function() {
var receiver, classConstructor, descriptor, receiver, descriptor;
receiver = C, classConstructor = C, descriptor = _x, (function(receiver, classConstructor) {
if (receiver !== classConstructor) throw new TypeError("Private static access of wrong provenance");
})(receiver, classConstructor), (function(descriptor, action) {
if (void 0 === descriptor) throw new TypeError("attempted to get private static field before its declaration");
})(descriptor, "get"), (descriptor = descriptor).get ? descriptor.get.call(receiver) : descriptor.value;
}();

View File

@ -1,8 +1,23 @@
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return descriptor.value;
}
function _classCheckPrivateStaticFieldDescriptor(descriptor, action) {
if (descriptor === undefined) {
throw new TypeError("attempted to " + action + " private static field before its declaration");
}
}
function _classStaticPrivateFieldSpecGet(receiver, classConstructor, descriptor) {
_classCheckPrivateStaticAccess(receiver, classConstructor);
_classCheckPrivateStaticFieldDescriptor(descriptor, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classCheckPrivateStaticAccess(receiver, classConstructor) {
if (receiver !== classConstructor) {
throw new TypeError("Private static access of wrong provenance");
}
return descriptor.value;
}
// @target: esnext, es2022, es2015
// @useDefineForClassFields: true

View File

@ -1,6 +1,11 @@
function _classStaticPrivateFieldSpecGet(receiver, classConstructor, descriptor) {
var receiver, descriptor;
return _classCheckPrivateStaticAccess(receiver, classConstructor), !function(descriptor, action) {
if (void 0 === descriptor) throw new TypeError("attempted to get private static field before its declaration");
}(descriptor, "get"), descriptor.get ? descriptor.get.call(receiver) : descriptor.value;
}
function _classCheckPrivateStaticAccess(receiver, classConstructor) {
if (receiver !== classConstructor) throw new TypeError("Private static access of wrong provenance");
return descriptor.value;
}
class C {
foo() {

View File

@ -1,13 +1,23 @@
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return descriptor.value;
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _classStaticPrivateFieldSpecGet(receiver, classConstructor, descriptor) {
if (receiver !== classConstructor) {
throw new TypeError("Private static access of wrong provenance");
function _classCheckPrivateStaticFieldDescriptor(descriptor, action) {
if (descriptor === undefined) {
throw new TypeError("attempted to " + action + " private static field before its declaration");
}
return descriptor.value;
}
function _classStaticPrivateFieldSpecGet(receiver, classConstructor, descriptor) {
_classCheckPrivateStaticAccess(receiver, classConstructor);
_classCheckPrivateStaticFieldDescriptor(descriptor, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _defineProperties(target, props) {
for(var i = 0; i < props.length; i++){
@ -23,6 +33,11 @@ function _createClass(Constructor, protoProps, staticProps) {
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
function _classCheckPrivateStaticAccess(receiver, classConstructor) {
if (receiver !== classConstructor) {
throw new TypeError("Private static access of wrong provenance");
}
}
var C = // @target: esnext, es2022, es2015
// @useDefineForClassFields: true
/*#__PURE__*/ function() {

View File

@ -1,6 +1,8 @@
function _classStaticPrivateFieldSpecGet(receiver, classConstructor, descriptor) {
if (receiver !== classConstructor) throw new TypeError("Private static access of wrong provenance");
return descriptor.value;
var receiver, descriptor;
return _classCheckPrivateStaticAccess(receiver, classConstructor), !function(descriptor, action) {
if (void 0 === descriptor) throw new TypeError("attempted to get private static field before its declaration");
}(descriptor, "get"), descriptor.get ? descriptor.get.call(receiver) : descriptor.value;
}
function _defineProperties(target, props) {
for(var i = 0; i < props.length; i++){
@ -8,6 +10,9 @@ function _defineProperties(target, props) {
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _classCheckPrivateStaticAccess(receiver, classConstructor) {
if (receiver !== classConstructor) throw new TypeError("Private static access of wrong provenance");
}
var C = function() {
"use strict";
var Constructor, protoProps, staticProps;

View File

@ -3,29 +3,44 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return privateMap.get(receiver).value;
return descriptor.value;
}
function _classApplyDescriptorSet(receiver, descriptor, value) {
if (descriptor.set) {
descriptor.set.call(receiver, value);
} else {
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
}
}
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
function _classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
_classApplyDescriptorSet(receiver, descriptor, value);
return value;
}
// @target: es2015
let friendA;
var _x = new WeakMap();
class A {
getX() {
return _classPrivateFieldGet(this, _x);
@ -38,7 +53,6 @@ class A {
_classPrivateFieldSet(this, _x, v);
}
}
var _x = new WeakMap();
var __ = {
writable: true,
value: (()=>{

View File

@ -1,12 +1,20 @@
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to " + action + " private field on non-instance");
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
return privateMap.get(receiver).value;
var receiver, descriptor, descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return descriptor.get ? descriptor.get.call(receiver) : descriptor.value;
}
function _classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to set private field on non-instance");
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
return descriptor.value = value, value;
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
return !function(receiver, descriptor, value) {
if (descriptor.set) descriptor.set.call(receiver, value);
else {
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
descriptor.value = value;
}
}(receiver, descriptor, value), value;
}
let friendA;
var _x = new WeakMap();

View File

@ -3,30 +3,44 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return descriptor.value;
}
function _classApplyDescriptorSet(receiver, descriptor, value) {
if (descriptor.set) {
descriptor.set.call(receiver, value);
} else {
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
}
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _classPrivateFieldGet(receiver, privateMap) {
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver).value;
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
function _classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
_classApplyDescriptorSet(receiver, descriptor, value);
return value;
}
function _defineProperties(target, props) {
@ -45,6 +59,7 @@ function _createClass(Constructor, protoProps, staticProps) {
}
// @target: es2015
var friendA;
var _x = new WeakMap();
var A = /*#__PURE__*/ function() {
"use strict";
function A(v) {
@ -65,7 +80,6 @@ var A = /*#__PURE__*/ function() {
]);
return A;
}();
var _x = new WeakMap();
var __ = {
writable: true,
value: function() {

View File

@ -1,15 +1,23 @@
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
}
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to " + action + " private field on non-instance");
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
return privateMap.get(receiver).value;
var receiver, descriptor, descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return descriptor.get ? descriptor.get.call(receiver) : descriptor.value;
}
function _classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to set private field on non-instance");
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
return descriptor.value = value, value;
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
return !function(receiver, descriptor, value) {
if (descriptor.set) descriptor.set.call(receiver, value);
else {
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
descriptor.value = value;
}
}(receiver, descriptor, value), value;
}
function _defineProperties(target, props) {
for(var i = 0; i < props.length; i++){
@ -17,7 +25,7 @@ function _defineProperties(target, props) {
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
}
var friendA, A = function() {
var friendA, _x = new WeakMap(), A = function() {
"use strict";
var Constructor, protoProps, staticProps;
function A(v) {
@ -37,7 +45,7 @@ var friendA, A = function() {
}
}
], _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), A;
}(), _x = new WeakMap();
}();
friendA = {
getX: function(obj) {
return _classPrivateFieldGet(obj, _x);

View File

@ -3,27 +3,42 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return privateMap.get(receiver).value;
return descriptor.value;
}
function _classApplyDescriptorSet(receiver, descriptor, value) {
if (descriptor.set) {
descriptor.set.call(receiver, value);
} else {
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
}
}
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
function _classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
_classApplyDescriptorSet(receiver, descriptor, value);
return value;
}
var _value = new WeakMap();
// @target: esnext
// @lib: esnext
// @declaration: true
@ -48,5 +63,4 @@ function _classPrivateFieldSet(receiver, privateMap, value) {
_classPrivateFieldSet(this, _value, initialValue);
}
}
var _value = new WeakMap();
new Box(3).value = 3;

View File

@ -1,16 +1,22 @@
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to " + action + " private field on non-instance");
return privateMap.get(receiver);
}
function _classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to set private field on non-instance");
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
return descriptor.value = value, value;
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
return !function(receiver, descriptor, value) {
if (descriptor.set) descriptor.set.call(receiver, value);
else {
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
descriptor.value = value;
}
}(receiver, descriptor, value), value;
}
var _value = new WeakMap();
new class {
get value() {
return (function(receiver, privateMap) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
return privateMap.get(receiver).value;
})(this, _value);
var receiver, privateMap, descriptor, receiver, descriptor;
return receiver = this, (descriptor = descriptor = _classExtractFieldDescriptor(receiver, privateMap = _value, "get")).get ? descriptor.get.call(receiver) : descriptor.value;
}
set value(value) {
_classPrivateFieldSet(this, _value, value);

View File

@ -3,30 +3,44 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return descriptor.value;
}
function _classApplyDescriptorSet(receiver, descriptor, value) {
if (descriptor.set) {
descriptor.set.call(receiver, value);
} else {
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
}
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _classPrivateFieldGet(receiver, privateMap) {
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver).value;
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
function _classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
_classApplyDescriptorSet(receiver, descriptor, value);
return value;
}
function _defineProperties(target, props) {
@ -43,6 +57,7 @@ function _createClass(Constructor, protoProps, staticProps) {
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
var _value = new WeakMap();
var Box = // @target: esnext
// @lib: esnext
// @declaration: true
@ -75,5 +90,4 @@ var Box = // @target: esnext
]);
return Box;
}();
var _value = new WeakMap();
new Box(3).value = 3;

View File

@ -1,8 +1,16 @@
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to " + action + " private field on non-instance");
return privateMap.get(receiver);
}
function _classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to set private field on non-instance");
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
return descriptor.value = value, value;
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
return !function(receiver, descriptor, value) {
if (descriptor.set) descriptor.set.call(receiver, value);
else {
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
descriptor.value = value;
}
}(receiver, descriptor, value), value;
}
function _defineProperties(target, props) {
for(var i = 0; i < props.length; i++){
@ -10,7 +18,7 @@ function _defineProperties(target, props) {
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
}
var Box = function() {
var _value = new WeakMap(), Box = function() {
"use strict";
var Constructor, protoProps, staticProps;
function Box(initialValue) {
@ -28,15 +36,13 @@ var Box = function() {
{
key: "value",
get: function() {
return (function(receiver, privateMap) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
return privateMap.get(receiver).value;
})(this, _value);
var receiver, privateMap, descriptor, receiver, descriptor;
return receiver = this, (descriptor = descriptor = _classExtractFieldDescriptor(receiver, privateMap = _value, "get")).get ? descriptor.get.call(receiver) : descriptor.value;
},
set: function(value) {
_classPrivateFieldSet(this, _value, value);
}
}
], _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), Box;
}(), _value = new WeakMap();
}();
new Box(3).value = 3;

View File

@ -3,25 +3,39 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return privateMap.get(receiver).value;
return descriptor.value;
}
function _classApplyDescriptorSet(receiver, descriptor, value) {
if (descriptor.set) {
descriptor.set.call(receiver, value);
} else {
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
}
}
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
function _classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
_classApplyDescriptorSet(receiver, descriptor, value);
return value;
}
// @target: esnext
@ -35,6 +49,7 @@ var Generic;
}
var c = new C();
c.y = c.y;
var _value = new WeakMap();
class Box {
get value() {
return _classPrivateFieldGet(this, _value);
@ -49,6 +64,5 @@ var Generic;
});
}
}
var _value = new WeakMap();
new Box().value = 3;
})(Generic || (Generic = {}));

View File

@ -1,4 +1,8 @@
var Generic;
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to " + action + " private field on non-instance");
return privateMap.get(receiver);
}
!function(Generic) {
var c = new class {
get y() {
@ -10,27 +14,27 @@ var Generic;
var _value = new WeakMap();
new class {
get value() {
return (function(receiver, privateMap) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
return privateMap.get(receiver).value;
})(this, _value);
var receiver, privateMap, descriptor, receiver, descriptor;
return receiver = this, (descriptor = descriptor = _classExtractFieldDescriptor(receiver, privateMap = _value, "get")).get ? descriptor.get.call(receiver) : descriptor.value;
}
set value(value1) {
!function(receiver, privateMap, value) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to set private field on non-instance");
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
return descriptor.value = value, value;
}(this, _value, value1);
set value(value) {
var receiver, privateMap, value1, descriptor;
receiver = this, privateMap = _value, value1 = value, descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"), (function(receiver, descriptor, value1) {
if (descriptor.set) descriptor.set.call(receiver, value1);
else {
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
descriptor.value = value1;
}
})(receiver, descriptor, value1);
}
constructor(){
var obj, privateMap, value;
obj = this, value = {
var obj, privateMap, value1;
obj = this, value1 = {
writable: !0,
value: void 0
}, (function(obj, privateCollection) {
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
})(obj, privateMap = _value), privateMap.set(obj, value);
})(obj, privateMap = _value), privateMap.set(obj, value1);
}
}().value = 3;
}(Generic || (Generic = {}));

View File

@ -3,30 +3,44 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return descriptor.value;
}
function _classApplyDescriptorSet(receiver, descriptor, value) {
if (descriptor.set) {
descriptor.set.call(receiver, value);
} else {
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
}
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _classPrivateFieldGet(receiver, privateMap) {
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver).value;
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
function _classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
_classApplyDescriptorSet(receiver, descriptor, value);
return value;
}
function _defineProperties(target, props) {
@ -64,6 +78,7 @@ var Generic;
}();
var c = new C();
c.y = c.y;
var _value = new WeakMap();
var Box = /*#__PURE__*/ function() {
"use strict";
function Box() {
@ -86,6 +101,5 @@ var Generic;
]);
return Box;
}();
var _value = new WeakMap();
new Box().value = 3;
})(Generic || (Generic = {}));

View File

@ -2,6 +2,10 @@ var Generic;
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
}
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to " + action + " private field on non-instance");
return privateMap.get(receiver);
}
function _defineProperties(target, props) {
for(var i = 0; i < props.length; i++){
var descriptor = props[i];
@ -28,36 +32,36 @@ function _createClass(Constructor, protoProps, staticProps) {
]), C;
}(), c = new C();
c.y = c.y;
var Box = function() {
var _value = new WeakMap(), Box = function() {
"use strict";
function Box() {
var obj, privateMap, value;
_classCallCheck(this, Box), obj = this, value = {
var obj, privateMap, value1;
_classCallCheck(this, Box), obj = this, value1 = {
writable: !0,
value: void 0
}, (function(obj, privateCollection) {
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
})(obj, privateMap = _value), privateMap.set(obj, value);
})(obj, privateMap = _value), privateMap.set(obj, value1);
}
return _createClass(Box, [
{
key: "value",
get: function() {
return (function(receiver, privateMap) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
return privateMap.get(receiver).value;
})(this, _value);
var receiver, privateMap, descriptor, receiver, descriptor;
return receiver = this, (descriptor = descriptor = _classExtractFieldDescriptor(receiver, privateMap = _value, "get")).get ? descriptor.get.call(receiver) : descriptor.value;
},
set: function(value1) {
!function(receiver, privateMap, value) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to set private field on non-instance");
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
return descriptor.value = value, value;
}(this, _value, value1);
set: function(value) {
var receiver, privateMap, value1, descriptor;
receiver = this, privateMap = _value, value1 = value, descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"), (function(receiver, descriptor, value1) {
if (descriptor.set) descriptor.set.call(receiver, value1);
else {
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
descriptor.value = value1;
}
})(receiver, descriptor, value1);
}
}
]), Box;
}(), _value = new WeakMap();
}();
new Box().value = 3;
}(Generic || (Generic = {}));

View File

@ -3,11 +3,21 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return privateMap.get(receiver).value;
return descriptor.value;
}
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
@ -17,7 +27,7 @@ function _classPrivateMethodInit(obj, privateSet) {
_checkPrivateRedeclaration(obj, privateSet);
privateSet.add(obj);
}
var _calcHello = new WeakSet(), _screamingHello = new WeakSet(), _screamingHello = new WeakSet();
var _hello = new WeakMap(), _world = new WeakMap(), _calcHello = new WeakSet(), _screamingHello = new WeakMap();
// @target: esnext
// @allowJS: true
// @declaration: true
@ -37,18 +47,18 @@ export class C {
value: 100
});
_classPrivateMethodInit(this, _calcHello);
_classPrivateMethodInit(this, _screamingHello);
/** @param value {string} */ _classPrivateMethodInit(this, _screamingHello);
_classPrivateFieldInit(this, _screamingHello, {
get: get_screamingHello,
set: /** @param value {string} */ set_screamingHello
});
}
}
var _hello = new WeakMap();
var _world = new WeakMap();
function calcHello() {
return _classPrivateFieldGet(this, _hello);
}
function screamingHello() {
function get_screamingHello() {
return _classPrivateFieldGet(this, _hello).toUpperCase();
}
function screamingHello(value) {
function set_screamingHello(value) {
throw "NO";
}

View File

@ -1,19 +1,20 @@
function _checkPrivateRedeclaration(obj, privateCollection) {
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
}
function _classPrivateFieldGet(receiver, privateMap) {
var receiver, descriptor, descriptor = function(receiver, privateMap, action) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
return privateMap.get(receiver);
}(receiver, privateMap, "get");
return descriptor.get ? descriptor.get.call(receiver) : descriptor.value;
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap), privateMap.set(obj, value);
}
function _classPrivateMethodInit(obj, privateSet) {
_checkPrivateRedeclaration(obj, privateSet), privateSet.add(obj);
}
var _calcHello = new WeakSet(), _screamingHello = new WeakSet(), _screamingHello = new WeakSet();
var _hello = new WeakMap(), _world = new WeakMap(), _calcHello = new WeakSet(), _screamingHello = new WeakMap();
export class C {
getWorld() {
return (function(receiver, privateMap) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
return privateMap.get(receiver).value;
})(this, _world);
return _classPrivateFieldGet(this, _world);
}
constructor(){
_classPrivateFieldInit(this, _hello, {
@ -22,7 +23,15 @@ export class C {
}), _classPrivateFieldInit(this, _world, {
writable: !0,
value: 100
}), _classPrivateMethodInit(this, _calcHello), _classPrivateMethodInit(this, _screamingHello), _classPrivateMethodInit(this, _screamingHello);
}), (function(obj, privateSet) {
_checkPrivateRedeclaration(obj, privateSet), privateSet.add(obj);
})(this, _calcHello), _classPrivateFieldInit(this, _screamingHello, {
get: function() {
return _classPrivateFieldGet(this, _hello).toUpperCase();
},
set: function(value) {
throw "NO";
}
});
}
}
var _hello = new WeakMap(), _world = new WeakMap();

View File

@ -3,16 +3,26 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return descriptor.value;
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _classPrivateFieldGet(receiver, privateMap) {
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver).value;
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
@ -36,7 +46,7 @@ function _createClass(Constructor, protoProps, staticProps) {
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
var _calcHello = new WeakSet(), _screamingHello = new WeakSet(), _screamingHello = new WeakSet();
var _hello = new WeakMap(), _world = new WeakMap(), _calcHello = new WeakSet(), _screamingHello = new WeakMap();
// @target: esnext
// @allowJS: true
// @declaration: true
@ -55,8 +65,10 @@ export var C = /*#__PURE__*/ function() {
value: 100
});
_classPrivateMethodInit(this, _calcHello);
_classPrivateMethodInit(this, _screamingHello);
/** @param value {string} */ _classPrivateMethodInit(this, _screamingHello);
_classPrivateFieldInit(this, _screamingHello, {
get: get_screamingHello,
set: /** @param value {string} */ set_screamingHello
});
}
_createClass(C, [
{
@ -68,14 +80,12 @@ export var C = /*#__PURE__*/ function() {
]);
return C;
}();
var _hello = new WeakMap();
var _world = new WeakMap();
function calcHello() {
return _classPrivateFieldGet(this, _hello);
}
function screamingHello() {
function get_screamingHello() {
return _classPrivateFieldGet(this, _hello).toUpperCase();
}
function screamingHello(value) {
function set_screamingHello(value) {
throw "NO";
}

View File

@ -1,23 +1,28 @@
function _checkPrivateRedeclaration(obj, privateCollection) {
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
}
function _classPrivateFieldGet(receiver, privateMap) {
var receiver, descriptor, descriptor = function(receiver, privateMap, action) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
return privateMap.get(receiver);
}(receiver, privateMap, "get");
return descriptor.get ? descriptor.get.call(receiver) : descriptor.value;
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap), privateMap.set(obj, value);
}
function _classPrivateMethodInit(obj, privateSet) {
_checkPrivateRedeclaration(obj, privateSet), privateSet.add(obj);
}
function _defineProperties(target, props) {
for(var i = 0; i < props.length; i++){
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
}
var _calcHello = new WeakSet(), _screamingHello = new WeakSet(), _screamingHello = new WeakSet();
var _hello = new WeakMap(), _world = new WeakMap(), _calcHello = new WeakSet(), _screamingHello = new WeakMap();
export var C = function() {
"use strict";
var Constructor, protoProps, staticProps;
function C() {
var obj, privateSet;
!function(instance, Constructor) {
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
}(this, C), _classPrivateFieldInit(this, _hello, {
@ -26,18 +31,23 @@ export var C = function() {
}), _classPrivateFieldInit(this, _world, {
writable: !0,
value: 100
}), _classPrivateMethodInit(this, _calcHello), _classPrivateMethodInit(this, _screamingHello), _classPrivateMethodInit(this, _screamingHello);
}), obj = this, _checkPrivateRedeclaration(obj, privateSet = _calcHello), privateSet.add(obj), _classPrivateFieldInit(this, _screamingHello, {
get: get_screamingHello,
set: set_screamingHello
});
}
return Constructor = C, protoProps = [
{
key: "getWorld",
value: function() {
return (function(receiver, privateMap) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
return privateMap.get(receiver).value;
})(this, _world);
return _classPrivateFieldGet(this, _world);
}
}
], _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), C;
}();
var _hello = new WeakMap(), _world = new WeakMap();
function get_screamingHello() {
return _classPrivateFieldGet(this, _hello).toUpperCase();
}
function set_screamingHello(value) {
throw "NO";
}

View File

@ -3,17 +3,17 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
function _classPrivateMethodGet(receiver, privateSet, fn) {
if (!privateSet.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
}
return fn;
}
function _classPrivateMethodInit(obj, privateSet) {
_checkPrivateRedeclaration(obj, privateSet);
privateSet.add(obj);
}
var _fieldFunc = new WeakSet(), _fieldFunc2 = new WeakSet();
var _fieldFunc = new WeakMap(), _fieldFunc2 = new WeakMap();
// @target: es2015
class A {
test() {
@ -35,16 +35,22 @@ class A {
return new A();
}
constructor(){
_classPrivateMethodInit(this, _fieldFunc);
_classPrivateMethodInit(this, _fieldFunc2);
_classPrivateFieldInit(this, _fieldFunc, {
get: get_fieldFunc,
set: void 0
});
_classPrivateFieldInit(this, _fieldFunc2, {
get: get_fieldFunc2,
set: void 0
});
this.x = 1;
}
}
function fieldFunc() {
function get_fieldFunc() {
return function() {
this.x = 10;
};
}
function fieldFunc2() {
function get_fieldFunc2() {
return function(a, ...b) {};
}

View File

@ -1,13 +1,13 @@
function _classPrivateFieldInit(obj, privateMap, value) {
!function(obj, privateCollection) {
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
}(obj, privateMap), privateMap.set(obj, value);
}
function _classPrivateMethodGet(receiver, privateSet, fn) {
if (!privateSet.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
return fn;
}
function _classPrivateMethodInit(obj, privateSet) {
!function(obj, privateCollection) {
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
}(obj, privateSet), privateSet.add(obj);
}
var _fieldFunc = new WeakSet(), _fieldFunc2 = new WeakSet();
var _fieldFunc = new WeakMap(), _fieldFunc2 = new WeakMap();
class A {
test() {
var _ref;
@ -24,14 +24,18 @@ class A {
return new A();
}
constructor(){
_classPrivateMethodInit(this, _fieldFunc), _classPrivateMethodInit(this, _fieldFunc2), this.x = 1;
_classPrivateFieldInit(this, _fieldFunc, {
get: function() {
return function() {
this.x = 10;
};
},
set: void 0
}), _classPrivateFieldInit(this, _fieldFunc2, {
get: function() {
return function(a, ...b) {};
},
set: void 0
}), this.x = 1;
}
}
function fieldFunc() {
return function() {
this.x = 10;
};
}
function fieldFunc2() {
return function(a, ...b) {};
}

View File

@ -16,16 +16,16 @@ function _classCallCheck(instance, Constructor) {
throw new TypeError("Cannot call a class as a function");
}
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
function _classPrivateMethodGet(receiver, privateSet, fn) {
if (!privateSet.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
}
return fn;
}
function _classPrivateMethodInit(obj, privateSet) {
_checkPrivateRedeclaration(obj, privateSet);
privateSet.add(obj);
}
function isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
@ -124,14 +124,20 @@ function _templateObject1() {
};
return data;
}
var _fieldFunc = new WeakSet(), _fieldFunc2 = new WeakSet();
var _fieldFunc = new WeakMap(), _fieldFunc2 = new WeakMap();
var A = // @target: es2015
/*#__PURE__*/ function() {
"use strict";
function A() {
_classCallCheck(this, A);
_classPrivateMethodInit(this, _fieldFunc);
_classPrivateMethodInit(this, _fieldFunc2);
_classPrivateFieldInit(this, _fieldFunc, {
get: get_fieldFunc,
set: void 0
});
_classPrivateFieldInit(this, _fieldFunc2, {
get: get_fieldFunc2,
set: void 0
});
this.x = 1;
}
_createClass(A, [
@ -172,12 +178,12 @@ var A = // @target: es2015
]);
return A;
}();
function fieldFunc() {
function get_fieldFunc() {
return function() {
this.x = 10;
};
}
function fieldFunc2() {
function get_fieldFunc2() {
return function(a) {
for(var _len = arguments.length, b = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
b[_key - 1] = arguments[_key];

View File

@ -3,15 +3,15 @@ function _arrayLikeToArray(arr, len) {
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
return arr2;
}
function _classPrivateFieldInit(obj, privateMap, value) {
!function(obj, privateCollection) {
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
}(obj, privateMap), privateMap.set(obj, value);
}
function _classPrivateMethodGet(receiver, privateSet, fn) {
if (!privateSet.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
return fn;
}
function _classPrivateMethodInit(obj, privateSet) {
!function(obj, privateCollection) {
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
}(obj, privateSet), privateSet.add(obj);
}
function _construct(Parent, args, Class) {
return (_construct = !function() {
if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
@ -86,13 +86,19 @@ function _templateObject1() {
return data;
}, data;
}
var _fieldFunc = new WeakSet(), _fieldFunc2 = new WeakSet(), A = function() {
var _fieldFunc = new WeakMap(), _fieldFunc2 = new WeakMap(), A = function() {
"use strict";
var Constructor, protoProps, staticProps;
function A() {
!function(instance, Constructor) {
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
}(this, A), _classPrivateMethodInit(this, _fieldFunc), _classPrivateMethodInit(this, _fieldFunc2), this.x = 1;
}(this, A), _classPrivateFieldInit(this, _fieldFunc, {
get: get_fieldFunc,
set: void 0
}), _classPrivateFieldInit(this, _fieldFunc2, {
get: get_fieldFunc2,
set: void 0
}), this.x = 1;
}
return Constructor = A, protoProps = [
{
@ -123,12 +129,12 @@ var _fieldFunc = new WeakSet(), _fieldFunc2 = new WeakSet(), A = function() {
}
], _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), A;
}();
function fieldFunc() {
function get_fieldFunc() {
return function() {
this.x = 10;
};
}
function fieldFunc2() {
function get_fieldFunc2() {
return function(a) {
for(var _len = arguments.length, b = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++)b[_key - 1] = arguments[_key];
};

View File

@ -3,15 +3,29 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classPrivateFieldSet(receiver, privateMap, value) {
function _classApplyDescriptorSet(receiver, descriptor, value) {
if (descriptor.set) {
descriptor.set.call(receiver, value);
} else {
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
}
}
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
throw new TypeError("attempted to " + action + " private field on non-instance");
}
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
return privateMap.get(receiver);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
function _classPrivateFieldSet(receiver, privateMap, value) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
_classApplyDescriptorSet(receiver, descriptor, value);
return value;
}
function _classPrivateMethodGet(receiver, privateSet, fn) {
@ -20,28 +34,29 @@ function _classPrivateMethodGet(receiver, privateSet, fn) {
}
return fn;
}
function _classPrivateMethodInit(obj, privateSet) {
_checkPrivateRedeclaration(obj, privateSet);
privateSet.add(obj);
}
var _prop = new WeakSet(), _prop = new WeakSet(), _roProp = new WeakSet();
var _prop = new WeakMap(), _roProp = new WeakMap();
// @strict: true
// @target: es6
class A1 {
constructor(name){
_classPrivateMethodInit(this, _prop);
_classPrivateMethodInit(this, _prop);
_classPrivateMethodInit(this, _roProp);
_classPrivateFieldInit(this, _prop, {
get: get_prop,
set: set_prop
});
_classPrivateFieldInit(this, _roProp, {
get: get_roProp,
set: void 0
});
_classPrivateFieldSet(this, _prop, "");
_classPrivateFieldSet(this, _roProp, ""); // Error
console.log(_classPrivateMethodGet(this, _prop, prop));
console.log(_classPrivateMethodGet(this, _roProp, roProp));
}
}
function prop() {
function get_prop() {
return "";
}
function prop(param) {}
function roProp() {
function set_prop(param) {}
function get_roProp() {
return "";
}

View File

@ -1 +1 @@
new WeakSet(), new WeakSet(), new WeakSet();
new WeakMap(), new WeakMap();

View File

@ -3,20 +3,34 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classApplyDescriptorSet(receiver, descriptor, value) {
if (descriptor.set) {
descriptor.set.call(receiver, value);
} else {
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
}
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _classPrivateFieldSet(receiver, privateMap, value) {
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
throw new TypeError("attempted to " + action + " private field on non-instance");
}
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
return privateMap.get(receiver);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
function _classPrivateFieldSet(receiver, privateMap, value) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
_classApplyDescriptorSet(receiver, descriptor, value);
return value;
}
function _classPrivateMethodGet(receiver, privateSet, fn) {
@ -25,26 +39,27 @@ function _classPrivateMethodGet(receiver, privateSet, fn) {
}
return fn;
}
function _classPrivateMethodInit(obj, privateSet) {
_checkPrivateRedeclaration(obj, privateSet);
privateSet.add(obj);
}
var _prop = new WeakSet(), _prop = new WeakSet(), _roProp = new WeakSet();
var _prop = new WeakMap(), _roProp = new WeakMap();
var A1 = function A1(name) {
"use strict";
_classCallCheck(this, A1);
_classPrivateMethodInit(this, _prop);
_classPrivateMethodInit(this, _prop);
_classPrivateMethodInit(this, _roProp);
_classPrivateFieldInit(this, _prop, {
get: get_prop,
set: set_prop
});
_classPrivateFieldInit(this, _roProp, {
get: get_roProp,
set: void 0
});
_classPrivateFieldSet(this, _prop, "");
_classPrivateFieldSet(this, _roProp, ""); // Error
console.log(_classPrivateMethodGet(this, _prop, prop));
console.log(_classPrivateMethodGet(this, _roProp, roProp));
};
function prop() {
function get_prop() {
return "";
}
function prop(param) {}
function roProp() {
function set_prop(param) {}
function get_roProp() {
return "";
}

View File

@ -1,28 +1,41 @@
function _classPrivateFieldInit(obj, privateMap, value) {
!function(obj, privateCollection) {
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
}(obj, privateMap), privateMap.set(obj, value);
}
function _classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to set private field on non-instance");
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
return descriptor.value = value, value;
var descriptor = function(receiver, privateMap, action) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to set private field on non-instance");
return privateMap.get(receiver);
}(receiver, privateMap, "set");
return !function(receiver, descriptor, value) {
if (descriptor.set) descriptor.set.call(receiver, value);
else {
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
descriptor.value = value;
}
}(receiver, descriptor, value), value;
}
function _classPrivateMethodGet(receiver, privateSet, fn) {
if (!privateSet.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
return fn;
}
function _classPrivateMethodInit(obj, privateSet) {
!function(obj, privateCollection) {
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
}(obj, privateSet), privateSet.add(obj);
}
var _prop = new WeakSet(), _prop = new WeakSet(), _roProp = new WeakSet(), A1 = function(name) {
var _prop = new WeakMap(), _roProp = new WeakMap(), A1 = function(name) {
"use strict";
!function(instance, Constructor) {
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
}(this, A1), _classPrivateMethodInit(this, _prop), _classPrivateMethodInit(this, _prop), _classPrivateMethodInit(this, _roProp), _classPrivateFieldSet(this, _prop, ""), _classPrivateFieldSet(this, _roProp, ""), console.log(_classPrivateMethodGet(this, _prop, prop)), console.log(_classPrivateMethodGet(this, _roProp, roProp));
}(this, A1), _classPrivateFieldInit(this, _prop, {
get: get_prop,
set: set_prop
}), _classPrivateFieldInit(this, _roProp, {
get: get_roProp,
set: void 0
}), _classPrivateFieldSet(this, _prop, ""), _classPrivateFieldSet(this, _roProp, ""), console.log(_classPrivateMethodGet(this, _prop, prop)), console.log(_classPrivateMethodGet(this, _roProp, roProp));
};
function prop() {
function get_prop() {
return "";
}
function prop(param) {}
function roProp() {
function set_prop(param) {}
function get_roProp() {
return "";
}

View File

@ -7,6 +7,7 @@ function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
var _prop = new WeakMap();
class B {
constructor(){
_classPrivateFieldInit(this, _prop, {
@ -15,4 +16,3 @@ class B {
});
}
}
var _prop = new WeakMap();

View File

@ -12,6 +12,7 @@ function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
var _prop = new WeakMap();
var B = function B() {
"use strict";
_classCallCheck(this, B);
@ -20,4 +21,3 @@ var B = function B() {
value: void 0
});
};
var _prop = new WeakMap();

View File

@ -1,4 +1,4 @@
var B = function() {
var _prop = new WeakMap(), B = function() {
"use strict";
var obj, privateMap, value;
!function(instance, Constructor) {
@ -9,4 +9,4 @@ var B = function() {
}, (function(obj, privateCollection) {
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
})(obj, privateMap = _prop), privateMap.set(obj, value);
}, _prop = new WeakMap();
};

View File

@ -3,21 +3,35 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return privateMap.get(receiver).value;
return descriptor.value;
}
function _classCheckPrivateStaticFieldDescriptor(descriptor, action) {
if (descriptor === undefined) {
throw new TypeError("attempted to " + action + " private static field before its declaration");
}
}
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
function _classStaticPrivateFieldSpecGet(receiver, classConstructor, descriptor) {
if (receiver !== classConstructor) {
throw new TypeError("Private static access of wrong provenance");
}
return descriptor.value;
_classCheckPrivateStaticAccess(receiver, classConstructor);
_classCheckPrivateStaticFieldDescriptor(descriptor, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _defineProperty(obj, key, value) {
if (key in obj) {
@ -61,6 +75,12 @@ function _objectSpread(target) {
}
return target;
}
function _classCheckPrivateStaticAccess(receiver, classConstructor) {
if (receiver !== classConstructor) {
throw new TypeError("Private static access of wrong provenance");
}
}
var _prop = new WeakMap();
// @strict: true
// @target: es6
class C {
@ -81,7 +101,6 @@ class C {
});
}
}
var _prop = new WeakMap();
var _propStatic = {
writable: true,
value: 1

View File

@ -1,10 +1,17 @@
function _classApplyDescriptorGet(receiver, descriptor) {
return descriptor.get ? descriptor.get.call(receiver) : descriptor.value;
}
function _classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
return privateMap.get(receiver).value;
var descriptor = function(receiver, privateMap, action) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to " + action + " private field on non-instance");
return privateMap.get(receiver);
}(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classStaticPrivateFieldSpecGet(receiver, classConstructor, descriptor) {
if (receiver !== classConstructor) throw new TypeError("Private static access of wrong provenance");
return descriptor.value;
return _classCheckPrivateStaticAccess(receiver, classConstructor), !function(descriptor, action) {
if (void 0 === descriptor) throw new TypeError("attempted to " + action + " private static field before its declaration");
}(descriptor, "get"), _classApplyDescriptorGet(receiver, descriptor);
}
function _defineProperty(obj, key, value) {
return key in obj ? Object.defineProperty(obj, key, {
@ -34,6 +41,10 @@ function _objectSpread(target) {
}
return target;
}
function _classCheckPrivateStaticAccess(receiver, classConstructor) {
if (receiver !== classConstructor) throw new TypeError("Private static access of wrong provenance");
}
var _prop = new WeakMap();
class C {
method(other) {
const obj = _objectSpread({}, other);
@ -56,7 +67,7 @@ class C {
});
}
}
var _prop = new WeakMap(), _propStatic = {
var _propStatic = {
writable: !0,
value: 1
};

View File

@ -3,26 +3,40 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return descriptor.value;
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
function _classCheckPrivateStaticFieldDescriptor(descriptor, action) {
if (descriptor === undefined) {
throw new TypeError("attempted to " + action + " private static field before its declaration");
}
return privateMap.get(receiver).value;
}
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
function _classStaticPrivateFieldSpecGet(receiver, classConstructor, descriptor) {
if (receiver !== classConstructor) {
throw new TypeError("Private static access of wrong provenance");
}
return descriptor.value;
_classCheckPrivateStaticAccess(receiver, classConstructor);
_classCheckPrivateStaticFieldDescriptor(descriptor, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _defineProperties(target, props) {
for(var i = 0; i < props.length; i++){
@ -80,6 +94,12 @@ function _objectSpread(target) {
}
return target;
}
function _classCheckPrivateStaticAccess(receiver, classConstructor) {
if (receiver !== classConstructor) {
throw new TypeError("Private static access of wrong provenance");
}
}
var _prop = new WeakMap();
var C = // @strict: true
// @target: es6
/*#__PURE__*/ function() {
@ -108,7 +128,6 @@ var C = // @strict: true
]);
return C;
}();
var _prop = new WeakMap();
var _propStatic = {
writable: true,
value: 1

View File

@ -1,10 +1,17 @@
function _classApplyDescriptorGet(receiver, descriptor) {
return descriptor.get ? descriptor.get.call(receiver) : descriptor.value;
}
function _classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
return privateMap.get(receiver).value;
var descriptor = function(receiver, privateMap, action) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to " + action + " private field on non-instance");
return privateMap.get(receiver);
}(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classStaticPrivateFieldSpecGet(receiver, classConstructor, descriptor) {
if (receiver !== classConstructor) throw new TypeError("Private static access of wrong provenance");
return descriptor.value;
return _classCheckPrivateStaticAccess(receiver, classConstructor), !function(descriptor, action) {
if (void 0 === descriptor) throw new TypeError("attempted to " + action + " private static field before its declaration");
}(descriptor, "get"), _classApplyDescriptorGet(receiver, descriptor);
}
function _defineProperties(target, props) {
for(var i = 0; i < props.length; i++){
@ -40,7 +47,10 @@ function _objectSpread(target) {
}
return target;
}
var C = function() {
function _classCheckPrivateStaticAccess(receiver, classConstructor) {
if (receiver !== classConstructor) throw new TypeError("Private static access of wrong provenance");
}
var _prop = new WeakMap(), C = function() {
"use strict";
var Constructor, protoProps, staticProps;
function C() {
@ -62,7 +72,7 @@ var C = function() {
}
}
], _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), C;
}(), _prop = new WeakMap(), _propStatic = {
}(), _propStatic = {
writable: !0,
value: 1
};

View File

@ -7,6 +7,7 @@ function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
var _foo = new WeakMap(), _prop = new WeakMap();
// @target: esnext, es2022, es2015
class A {
constructor(){
@ -20,6 +21,4 @@ class A {
});
}
}
var _foo = new WeakMap();
var _prop = new WeakMap();
A.inst = new A();

View File

@ -3,6 +3,7 @@ function _classPrivateFieldInit(obj, privateMap, value) {
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
}(obj, privateMap), privateMap.set(obj, value);
}
var _foo = new WeakMap(), _prop = new WeakMap();
class A {
constructor(){
_classPrivateFieldInit(this, _foo, {
@ -14,5 +15,4 @@ class A {
});
}
}
var _foo = new WeakMap(), _prop = new WeakMap();
A.inst = new A();

View File

@ -12,6 +12,7 @@ function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
var _foo = new WeakMap(), _prop = new WeakMap();
var A = function A() {
"use strict";
_classCallCheck(this, A);
@ -24,6 +25,4 @@ var A = function A() {
value: 2
});
};
var _foo = new WeakMap();
var _prop = new WeakMap();
A.inst = new A();

View File

@ -3,7 +3,7 @@ function _classPrivateFieldInit(obj, privateMap, value) {
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
}(obj, privateMap), privateMap.set(obj, value);
}
var A = function() {
var _foo = new WeakMap(), _prop = new WeakMap(), A = function() {
"use strict";
!function(instance, Constructor) {
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
@ -14,5 +14,5 @@ var A = function() {
writable: !0,
value: 2
});
}, _foo = new WeakMap(), _prop = new WeakMap();
};
A.inst = new A();

View File

@ -3,17 +3,28 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return privateMap.get(receiver).value;
return descriptor.value;
}
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
var _key;
var _foo = new WeakMap(), _bar = new WeakMap();
// @strict: true
// @target: es6
class A {
@ -30,6 +41,4 @@ class A {
= this["#baz"];
}
}
var _foo = new WeakMap();
var _bar = new WeakMap();
_key = "#baz";

View File

@ -3,22 +3,33 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return descriptor.value;
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _classPrivateFieldGet(receiver, privateMap) {
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver).value;
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
var _key;
var _foo = new WeakMap(), _bar = new WeakMap();
var A = function A() {
"use strict";
_classCallCheck(this, A);
@ -35,6 +46,4 @@ var A = function A() {
this[_key] // Error (should *not* be private name error)
= this["#baz"];
};
var _foo = new WeakMap();
var _bar = new WeakMap();
_key = "#baz";

View File

@ -1,13 +1,16 @@
function _classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
return privateMap.get(receiver).value;
var receiver, descriptor, descriptor = function(receiver, privateMap, action) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
return privateMap.get(receiver);
}(receiver, privateMap, "get");
return descriptor.get ? descriptor.get.call(receiver) : descriptor.value;
}
function _classPrivateFieldInit(obj, privateMap, value) {
!function(obj, privateCollection) {
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
}(obj, privateMap), privateMap.set(obj, value);
}
var _key, A = function() {
var _key, _foo = new WeakMap(), _bar = new WeakMap(), A = function() {
"use strict";
!function(instance, Constructor) {
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
@ -18,5 +21,5 @@ var _key, A = function() {
writable: !0,
value: _classPrivateFieldGet(this, _foo)
}), this[_key] = this["#baz"];
}, _foo = new WeakMap(), _bar = new WeakMap();
};
_key = "#baz";

View File

@ -15,7 +15,7 @@ function _classPrivateMethodInit(obj, privateSet) {
const array = [];
for(let i = 0; i < 10; ++i){
array.push(function() {
var _method = new WeakSet(), _accessor = new WeakSet(), _accessor = new WeakSet();
var _myField = new WeakMap(), _method = new WeakSet(), _accessor = new WeakMap();
class C {
constructor(){
_classPrivateFieldInit(this, _myField, {
@ -23,16 +23,17 @@ for(let i = 0; i < 10; ++i){
value: "hello"
});
_classPrivateMethodInit(this, _method);
_classPrivateMethodInit(this, _accessor);
_classPrivateMethodInit(this, _accessor);
_classPrivateFieldInit(this, _accessor, {
get: get_accessor,
set: set_accessor
});
}
}
var _myField = new WeakMap();
function method() {}
function accessor() {
function get_accessor() {
return 42;
}
function accessor(val) {}
function set_accessor(val) {}
return C;
}());
}

View File

@ -9,15 +9,20 @@ function _classPrivateMethodInit(obj, privateSet) {
}
const array = [];
for(let i = 0; i < 10; ++i)array.push(function() {
var _method = new WeakSet(), _accessor = new WeakSet(), _accessor = new WeakSet();
var _myField = new WeakMap(), _method = new WeakSet(), _accessor = new WeakMap();
class C {
constructor(){
_classPrivateFieldInit(this, _myField, {
writable: !0,
value: "hello"
}), _classPrivateMethodInit(this, _method), _classPrivateMethodInit(this, _accessor), _classPrivateMethodInit(this, _accessor);
}), _classPrivateMethodInit(this, _method), _classPrivateFieldInit(this, _accessor, {
get: function() {
return 42;
},
set: set_accessor
});
}
}
var _myField = new WeakMap();
function set_accessor(val) {}
return C;
}());

View File

@ -21,11 +21,11 @@ var array = [];
for(var i = 0; i < 10; ++i){
array.push(function() {
var method = function method() {};
var accessor = function accessor() {
var get_accessor = function get_accessor() {
return 42;
};
var accessor = function accessor(val) {};
var _method = new WeakSet(), _accessor = new WeakSet(), _accessor = new WeakSet();
var set_accessor = function set_accessor(val) {};
var _myField = new WeakMap(), _method = new WeakSet(), _accessor = new WeakMap();
var C = function C() {
"use strict";
_classCallCheck(this, C);
@ -34,10 +34,11 @@ for(var i = 0; i < 10; ++i){
value: "hello"
});
_classPrivateMethodInit(this, _method);
_classPrivateMethodInit(this, _accessor);
_classPrivateMethodInit(this, _accessor);
_classPrivateFieldInit(this, _accessor, {
get: get_accessor,
set: set_accessor
});
};
var _myField = new WeakMap();
return C;
}());
}

View File

@ -11,12 +11,17 @@ function _classPrivateMethodInit(obj, privateSet) {
_checkPrivateRedeclaration(obj, privateSet), privateSet.add(obj);
}
for(var array = [], i = 0; i < 10; ++i)array.push(function() {
var _method = new WeakSet(), _accessor = new WeakSet(), _accessor = new WeakSet(), C = function() {
var get_accessor = function() {
return 42;
}, set_accessor = function(val) {}, _myField = new WeakMap(), _method = new WeakSet(), _accessor = new WeakMap(), C = function() {
"use strict";
_classCallCheck(this, C), _classPrivateFieldInit(this, _myField, {
writable: !0,
value: "hello"
}), _classPrivateMethodInit(this, _method), _classPrivateMethodInit(this, _accessor), _classPrivateMethodInit(this, _accessor);
}, _myField = new WeakMap();
}), _classPrivateMethodInit(this, _method), _classPrivateFieldInit(this, _accessor, {
get: get_accessor,
set: set_accessor
});
};
return C;
}());

View File

@ -3,27 +3,42 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return privateMap.get(receiver).value;
return descriptor.value;
}
function _classApplyDescriptorSet(receiver, descriptor, value) {
if (descriptor.set) {
descriptor.set.call(receiver, value);
} else {
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
}
}
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
function _classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
_classApplyDescriptorSet(receiver, descriptor, value);
return value;
}
var _a = new WeakMap(), _b = new WeakMap(), _c = new WeakMap(), _d = new WeakMap(), _e = new WeakMap();
// @target: esnext, es2022, es2015
class A {
test() {
@ -68,9 +83,4 @@ class A {
_classPrivateFieldSet(this, _d, 'd');
}
}
var _a = new WeakMap();
var _b = new WeakMap();
var _c = new WeakMap();
var _d = new WeakMap();
var _e = new WeakMap();
new A().test();

View File

@ -1,6 +1,10 @@
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to " + action + " private field on non-instance");
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
return privateMap.get(receiver).value;
var receiver, descriptor, descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return descriptor.get ? descriptor.get.call(receiver) : descriptor.value;
}
function _classPrivateFieldInit(obj, privateMap, value) {
!function(obj, privateCollection) {
@ -8,10 +12,14 @@ function _classPrivateFieldInit(obj, privateMap, value) {
}(obj, privateMap), privateMap.set(obj, value);
}
function _classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to set private field on non-instance");
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
return descriptor.value = value, value;
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
return !function(receiver, descriptor, value) {
if (descriptor.set) descriptor.set.call(receiver, value);
else {
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
descriptor.value = value;
}
}(receiver, descriptor, value), value;
}
var _a = new WeakMap(), _b = new WeakMap(), _c = new WeakMap(), _d = new WeakMap(), _e = new WeakMap();
new class {

View File

@ -3,30 +3,44 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return descriptor.value;
}
function _classApplyDescriptorSet(receiver, descriptor, value) {
if (descriptor.set) {
descriptor.set.call(receiver, value);
} else {
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
}
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _classPrivateFieldGet(receiver, privateMap) {
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver).value;
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
function _classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
_classApplyDescriptorSet(receiver, descriptor, value);
return value;
}
function _defineProperties(target, props) {
@ -56,6 +70,7 @@ function _defineProperty(obj, key, value) {
}
return obj;
}
var _a = new WeakMap(), _b = new WeakMap(), _c = new WeakMap(), _d = new WeakMap(), _e = new WeakMap();
var A = // @target: esnext, es2022, es2015
/*#__PURE__*/ function() {
"use strict";
@ -107,9 +122,4 @@ var A = // @target: esnext, es2022, es2015
]);
return A;
}();
var _a = new WeakMap();
var _b = new WeakMap();
var _c = new WeakMap();
var _d = new WeakMap();
var _e = new WeakMap();
new A().test();

View File

@ -1,6 +1,10 @@
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to " + action + " private field on non-instance");
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
return privateMap.get(receiver).value;
var receiver, descriptor, descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return descriptor.get ? descriptor.get.call(receiver) : descriptor.value;
}
function _classPrivateFieldInit(obj, privateMap, value) {
!function(obj, privateCollection) {
@ -8,10 +12,14 @@ function _classPrivateFieldInit(obj, privateMap, value) {
}(obj, privateMap), privateMap.set(obj, value);
}
function _classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to set private field on non-instance");
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
return descriptor.value = value, value;
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
return !function(receiver, descriptor, value) {
if (descriptor.set) descriptor.set.call(receiver, value);
else {
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
descriptor.value = value;
}
}(receiver, descriptor, value), value;
}
function _defineProperties(target, props) {
for(var i = 0; i < props.length; i++){
@ -19,7 +27,7 @@ function _defineProperties(target, props) {
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
}
var A = function() {
var _a = new WeakMap(), _b = new WeakMap(), _c = new WeakMap(), _d = new WeakMap(), _e = new WeakMap(), A = function() {
"use strict";
var Constructor, protoProps, staticProps;
function A() {
@ -65,5 +73,5 @@ var A = function() {
data[_classPrivateFieldGet(this, _e)], console.log(a1, b1, c1, d1);
})
], _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), A;
}(), _a = new WeakMap(), _b = new WeakMap(), _c = new WeakMap(), _d = new WeakMap(), _e = new WeakMap();
}();
new A().test();

View File

@ -3,11 +3,21 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return privateMap.get(receiver).value;
return descriptor.value;
}
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
@ -15,7 +25,7 @@ function _classPrivateFieldInit(obj, privateMap, value) {
}
// @target: esnext, es2022, es2015
let getX;
var tmp = (getX = (a)=>_classPrivateFieldGet(a, _x)
var _x = new WeakMap(), tmp = (getX = (a)=>_classPrivateFieldGet(a, _x)
, "_");
class A {
[tmp]() {}
@ -26,5 +36,4 @@ class A {
});
}
}
var _x = new WeakMap();
console.log(getX(new A));

View File

@ -1,9 +1,12 @@
let getX;
var tmp = (getX = (a)=>(function(receiver, privateMap) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
return privateMap.get(receiver).value;
var _x = new WeakMap(), tmp = (getX = (a)=>(function(receiver, privateMap) {
var receiver, descriptor, descriptor = function(receiver, privateMap, action) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
return privateMap.get(receiver);
}(receiver, privateMap, "get");
return (descriptor = descriptor).get ? descriptor.get.call(receiver) : descriptor.value;
})(a, _x)
, "_"), _x = new WeakMap();
, "_");
console.log(getX(new class {
[tmp]() {}
constructor(){

View File

@ -3,16 +3,26 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return descriptor.value;
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _classPrivateFieldGet(receiver, privateMap) {
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver).value;
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
@ -34,7 +44,7 @@ function _createClass(Constructor, protoProps, staticProps) {
}
// @target: esnext, es2022, es2015
var getX;
var tmp = (getX = function(a) {
var _x = new WeakMap(), tmp = (getX = function(a) {
return _classPrivateFieldGet(a, _x);
}, "_");
var A = /*#__PURE__*/ function() {
@ -54,5 +64,4 @@ var A = /*#__PURE__*/ function() {
]);
return A;
}();
var _x = new WeakMap();
console.log(getX(new A));

View File

@ -4,11 +4,12 @@ function _defineProperties(target, props) {
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
}
var getX, tmp = (getX = function(a) {
return (function(receiver, privateMap) {
var getX, _x = new WeakMap(), tmp = (getX = function(a) {
var receiver, privateMap, descriptor, receiver, descriptor;
return (descriptor = descriptor = (function(receiver, privateMap, action) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
return privateMap.get(receiver).value;
})(a, _x);
return privateMap.get(receiver);
})(receiver = a, privateMap = _x, "get")).get ? descriptor.get.call(receiver) : descriptor.value;
}, "_"), A = function() {
"use strict";
var Constructor, protoProps, staticProps;
@ -29,5 +30,5 @@ var getX, tmp = (getX = function(a) {
value: function() {}
}
], _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), A;
}(), _x = new WeakMap();
}();
console.log(getX(new A));

View File

@ -3,32 +3,47 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return privateMap.get(receiver).value;
return descriptor.value;
}
function _classApplyDescriptorSet(receiver, descriptor, value) {
if (descriptor.set) {
descriptor.set.call(receiver, value);
} else {
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
}
}
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
function _classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
_classApplyDescriptorSet(receiver, descriptor, value);
return value;
}
var _name = new WeakMap();
// @target: esnext, es2022, es2015
class Foo {
getValue(x) {
const obj = this;
var tmp = _classPrivateFieldGet(obj, _name);
var _y = new WeakMap(), tmp = _classPrivateFieldGet(obj, _name);
class Bar {
[tmp]() {
return x + _classPrivateFieldGet(this, _y);
@ -40,7 +55,6 @@ class Foo {
});
}
}
var _y = new WeakMap();
return new Bar()[_classPrivateFieldGet(obj, _name)]();
}
constructor(name){
@ -51,5 +65,4 @@ class Foo {
_classPrivateFieldSet(this, _name, name);
}
}
var _name = new WeakMap();
console.log(new Foo("NAME").getValue(100));

View File

@ -1,6 +1,10 @@
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to " + action + " private field on non-instance");
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
return privateMap.get(receiver).value;
var receiver, descriptor, descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return descriptor.get ? descriptor.get.call(receiver) : descriptor.value;
}
function _classPrivateFieldInit(obj, privateMap, value) {
!function(obj, privateCollection) {
@ -10,7 +14,7 @@ function _classPrivateFieldInit(obj, privateMap, value) {
var _name = new WeakMap();
console.log(new class {
getValue(x) {
var tmp = _classPrivateFieldGet(this, _name), _y = new WeakMap();
var _y = new WeakMap(), tmp = _classPrivateFieldGet(this, _name);
return new class {
[tmp]() {
return x + _classPrivateFieldGet(this, _y);
@ -28,10 +32,14 @@ console.log(new class {
writable: !0,
value: void 0
}), (function(receiver, privateMap, value) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to set private field on non-instance");
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
descriptor.value = value;
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
(function(receiver, descriptor, value) {
if (descriptor.set) descriptor.set.call(receiver, value);
else {
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
descriptor.value = value;
}
})(receiver, descriptor, value);
})(this, _name, name);
}
}("NAME").getValue(100));

View File

@ -3,30 +3,44 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return descriptor.value;
}
function _classApplyDescriptorSet(receiver, descriptor, value) {
if (descriptor.set) {
descriptor.set.call(receiver, value);
} else {
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
}
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _classPrivateFieldGet(receiver, privateMap) {
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver).value;
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
function _classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
_classApplyDescriptorSet(receiver, descriptor, value);
return value;
}
function _defineProperties(target, props) {
@ -43,6 +57,7 @@ function _createClass(Constructor, protoProps, staticProps) {
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
var _name = new WeakMap();
var Foo = // @target: esnext, es2022, es2015
/*#__PURE__*/ function() {
"use strict";
@ -59,7 +74,7 @@ var Foo = // @target: esnext, es2022, es2015
key: "getValue",
value: function getValue(x) {
var obj = this;
var tmp = _classPrivateFieldGet(obj, _name);
var _y = new WeakMap(), tmp = _classPrivateFieldGet(obj, _name);
var Bar = /*#__PURE__*/ function() {
function Bar() {
_classCallCheck(this, Bar);
@ -78,12 +93,10 @@ var Foo = // @target: esnext, es2022, es2015
]);
return Bar;
}();
var _y = new WeakMap();
return new Bar()[_classPrivateFieldGet(obj, _name)]();
}
}
]);
return Foo;
}();
var _name = new WeakMap();
console.log(new Foo("NAME").getValue(100));

View File

@ -1,9 +1,13 @@
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
}
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to " + action + " private field on non-instance");
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
return privateMap.get(receiver).value;
var receiver, descriptor, descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return descriptor.get ? descriptor.get.call(receiver) : descriptor.value;
}
function _classPrivateFieldInit(obj, privateMap, value) {
!function(obj, privateCollection) {
@ -19,24 +23,26 @@ function _defineProperties(target, props) {
function _createClass(Constructor, protoProps, staticProps) {
return protoProps && _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), Constructor;
}
var Foo = function() {
var _name = new WeakMap(), Foo = function() {
"use strict";
function Foo(name) {
var receiver, privateMap, value, descriptor;
_classCallCheck(this, Foo), _classPrivateFieldInit(this, _name, {
writable: !0,
value: void 0
}), (function(receiver, privateMap, value) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to set private field on non-instance");
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
descriptor.value = value;
})(this, _name, name);
}), receiver = this, privateMap = _name, value = name, descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"), (function(receiver, descriptor, value) {
if (descriptor.set) descriptor.set.call(receiver, value);
else {
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
descriptor.value = value;
}
})(receiver, descriptor, value);
}
return _createClass(Foo, [
{
key: "getValue",
value: function(x) {
var tmp = _classPrivateFieldGet(this, _name), Bar = function() {
var _y = new WeakMap(), tmp = _classPrivateFieldGet(this, _name), Bar = function() {
function Bar() {
_classCallCheck(this, Bar), _classPrivateFieldInit(this, _y, {
writable: !0,
@ -51,10 +57,10 @@ var Foo = function() {
}
}
]), Bar;
}(), _y = new WeakMap();
}();
return new Bar()[_classPrivateFieldGet(this, _name)]();
}
}
]), Foo;
}(), _name = new WeakMap();
}();
console.log(new Foo("NAME").getValue(100));

View File

@ -3,21 +3,32 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classApplyDescriptorSet(receiver, descriptor, value) {
if (descriptor.set) {
descriptor.set.call(receiver, value);
} else {
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
}
}
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
function _classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
_classApplyDescriptorSet(receiver, descriptor, value);
return value;
}
var _x = new WeakMap();
class C {
static test() {
_classPrivateFieldSet(new C(), _x, 10);
@ -32,4 +43,3 @@ class C {
});
}
}
var _x = new WeakMap();

View File

@ -1,11 +1,17 @@
var _x = new WeakMap();
class C {
static test() {
!function(receiver, privateMap, value) {
var receiver, privateMap, value, descriptor;
value = 10, descriptor = (function(receiver, privateMap, action) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to set private field on non-instance");
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
return descriptor.value = value, value;
}(new C(), _x, 10);
return privateMap.get(receiver);
})(receiver = new C(), privateMap = _x, "set"), (function(receiver, descriptor, value) {
if (descriptor.set) descriptor.set.call(receiver, value);
else {
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
descriptor.value = value;
}
})(receiver, descriptor, value);
const y = new C(), z = new y();
z.x = 123;
}
@ -20,4 +26,3 @@ class C {
});
}
}
var _x = new WeakMap();

View File

@ -3,24 +3,34 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classApplyDescriptorSet(receiver, descriptor, value) {
if (descriptor.set) {
descriptor.set.call(receiver, value);
} else {
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
}
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
function _classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
_classApplyDescriptorSet(receiver, descriptor, value);
return value;
}
function _defineProperties(target, props) {
@ -37,6 +47,7 @@ function _createClass(Constructor, protoProps, staticProps) {
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
var _x = new WeakMap();
var C = /*#__PURE__*/ function() {
"use strict";
function C() {
@ -59,4 +70,3 @@ var C = /*#__PURE__*/ function() {
]);
return C;
}();
var _x = new WeakMap();

View File

@ -4,7 +4,7 @@ function _defineProperties(target, props) {
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
}
var C = function() {
var _x = new WeakMap(), C = function() {
"use strict";
var Constructor, protoProps, staticProps;
function C() {
@ -22,13 +22,18 @@ var C = function() {
{
key: "test",
value: function() {
(function(receiver, privateMap, value) {
var receiver, privateMap, value, descriptor;
value = 10, descriptor = (function(receiver, privateMap, action) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to set private field on non-instance");
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
descriptor.value = value;
})(new C(), _x, 10), new new C()().x = 123;
return privateMap.get(receiver);
})(receiver = new C(), privateMap = _x, "set"), (function(receiver, descriptor, value) {
if (descriptor.set) descriptor.set.call(receiver, value);
else {
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
descriptor.value = value;
}
})(receiver, descriptor, value), new new C()().x = 123;
}
}
], protoProps && _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), C;
}(), _x = new WeakMap();
}();

View File

@ -3,11 +3,21 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return privateMap.get(receiver).value;
return descriptor.value;
}
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
@ -16,6 +26,7 @@ function _classPrivateFieldInit(obj, privateMap, value) {
// @target: es6
class D {
}
var _x = new WeakMap();
class C {
foo() {
const c = new C();
@ -30,4 +41,3 @@ class C {
});
}
}
var _x = new WeakMap();

View File

@ -1,7 +1,11 @@
function _classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
return privateMap.get(receiver).value;
var receiver, descriptor, descriptor = function(receiver, privateMap, action) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
return privateMap.get(receiver);
}(receiver, privateMap, "get");
return descriptor.get ? descriptor.get.call(receiver) : descriptor.value;
}
var _x = new WeakMap();
class C {
foo() {
const c = new C();
@ -20,4 +24,3 @@ class C {
});
}
}
var _x = new WeakMap();

View File

@ -3,16 +3,26 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return descriptor.value;
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _classPrivateFieldGet(receiver, privateMap) {
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver).value;
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
@ -36,6 +46,7 @@ var D = function D() {
"use strict";
_classCallCheck(this, D);
};
var _x = new WeakMap();
var C = /*#__PURE__*/ function() {
"use strict";
function C() {
@ -58,4 +69,3 @@ var C = /*#__PURE__*/ function() {
]);
return C;
}();
var _x = new WeakMap();

View File

@ -2,8 +2,11 @@ function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
}
function _classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
return privateMap.get(receiver).value;
var receiver, descriptor, descriptor = function(receiver, privateMap, action) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
return privateMap.get(receiver);
}(receiver, privateMap, "get");
return descriptor.get ? descriptor.get.call(receiver) : descriptor.value;
}
function _defineProperties(target, props) {
for(var i = 0; i < props.length; i++){
@ -14,7 +17,7 @@ function _defineProperties(target, props) {
var D = function() {
"use strict";
_classCallCheck(this, D);
}, C = function() {
}, _x = new WeakMap(), C = function() {
"use strict";
var Constructor, protoProps, staticProps;
function C() {
@ -34,4 +37,4 @@ var D = function() {
}
}
], _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), C;
}(), _x = new WeakMap();
}();

View File

@ -7,6 +7,7 @@ function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
var _foo = new WeakMap(), _bar = new WeakMap();
// @declaration: true
// @target: es2015
class A {
@ -23,5 +24,3 @@ class A {
this.qux = 6;
}
}
var _foo = new WeakMap();
var _bar = new WeakMap();

View File

@ -26,6 +26,7 @@ function _createClass(Constructor, protoProps, staticProps) {
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
var _foo = new WeakMap(), _bar = new WeakMap();
var A = // @declaration: true
// @target: es2015
/*#__PURE__*/ function() {
@ -50,5 +51,3 @@ var A = // @declaration: true
]);
return A;
}();
var _foo = new WeakMap();
var _bar = new WeakMap();

View File

@ -9,7 +9,7 @@ function _defineProperties(target, props) {
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
}
var A = function() {
var _foo = new WeakMap(), _bar = new WeakMap(), A = function() {
"use strict";
var Constructor, protoProps, staticProps;
function A() {
@ -29,4 +29,4 @@ var A = function() {
value: function() {}
}
], _defineProperties((Constructor = A).prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), A;
}(), _foo = new WeakMap(), _bar = new WeakMap();
}();

View File

@ -14,6 +14,7 @@ function _classPrivateMethodInit(obj, privateSet) {
// @strict: true
// @target: es6
function Field() {
var _foo = new WeakMap(), _foo = new WeakMap();
// Error
class A_Field_Field {
constructor(){
@ -27,9 +28,7 @@ function Field() {
});
}
}
var _foo = new WeakMap();
var _foo = new WeakMap();
var _foo1 = new WeakSet();
var _foo1 = new WeakMap(), _foo1 = new WeakSet();
// Error
class A_Field_Method {
constructor(){
@ -40,9 +39,8 @@ function Field() {
_classPrivateMethodInit(this, _foo1);
}
}
var _foo1 = new WeakMap();
function foo() {}
var _foo2 = new WeakSet();
var _foo2 = new WeakMap(), _foo2 = new WeakMap();
// Error
class A_Field_Getter {
constructor(){
@ -50,14 +48,16 @@ function Field() {
writable: true,
value: "foo"
});
_classPrivateMethodInit(this, _foo2);
_classPrivateFieldInit(this, _foo2, {
get: get_foo,
set: void 0
});
}
}
var _foo2 = new WeakMap();
function foo1() {
function get_foo() {
return "";
}
var _foo3 = new WeakSet();
var _foo3 = new WeakMap(), _foo3 = new WeakMap();
// Error
class A_Field_Setter {
constructor(){
@ -65,11 +65,14 @@ function Field() {
writable: true,
value: "foo"
});
_classPrivateMethodInit(this, _foo3);
_classPrivateFieldInit(this, _foo3, {
get: void 0,
set: set_foo
});
}
}
var _foo3 = new WeakMap();
function foo2(value) {}
function set_foo(value) {}
var _foo4 = new WeakMap();
// Error
class A_Field_StaticField {
constructor(){
@ -79,11 +82,11 @@ function Field() {
});
}
}
var _foo4 = new WeakMap();
var _foo4 = {
writable: true,
value: "foo"
};
var _foo5 = new WeakMap();
// Error
class A_Field_StaticMethod {
constructor(){
@ -93,8 +96,8 @@ function Field() {
});
}
}
var _foo5 = new WeakMap();
function foo3() {}
function foo1() {}
var _foo6 = new WeakMap();
// Error
class A_Field_StaticGetter {
constructor(){
@ -104,10 +107,14 @@ function Field() {
});
}
}
var _foo6 = new WeakMap();
function foo4() {
var _foo6 = {
get: get_foo1,
set: void 0
};
function get_foo1() {
return "";
}
var _foo7 = new WeakMap();
// Error
class A_Field_StaticSetter {
constructor(){
@ -117,11 +124,14 @@ function Field() {
});
}
}
var _foo7 = new WeakMap();
function foo5(value) {}
var _foo7 = {
get: void 0,
set: set_foo1
};
function set_foo1(value) {}
}
function Method() {
var _foo = new WeakSet();
var _foo = new WeakSet(), _foo = new WeakMap();
// Error
class A_Method_Field {
constructor(){
@ -132,7 +142,6 @@ function Method() {
});
}
}
var _foo = new WeakMap();
function foo() {}
var _foo8 = new WeakSet(), _foo8 = new WeakSet();
// Error
@ -142,30 +151,36 @@ function Method() {
_classPrivateMethodInit(this, _foo8);
}
}
function foo6() {}
function foo6() {}
var _foo9 = new WeakSet(), _foo9 = new WeakSet();
function foo2() {}
function foo2() {}
var _foo9 = new WeakSet(), _foo9 = new WeakMap();
// Error
class A_Method_Getter {
constructor(){
_classPrivateMethodInit(this, _foo9);
_classPrivateMethodInit(this, _foo9);
_classPrivateFieldInit(this, _foo9, {
get: get_foo,
set: void 0
});
}
}
function foo7() {}
function foo7() {
function foo3() {}
function get_foo() {
return "";
}
var _foo10 = new WeakSet(), _foo10 = new WeakSet();
var _foo10 = new WeakSet(), _foo10 = new WeakMap();
// Error
class A_Method_Setter {
constructor(){
_classPrivateMethodInit(this, _foo10);
_classPrivateMethodInit(this, _foo10);
_classPrivateFieldInit(this, _foo10, {
get: void 0,
set: set_foo
});
}
}
function foo8() {}
function foo8(value) {}
function foo4() {}
function set_foo(value) {}
var _foo11 = new WeakSet();
// Error
class A_Method_StaticField {
@ -177,7 +192,7 @@ function Method() {
writable: true,
value: "foo"
};
function foo9() {}
function foo5() {}
var _foo12 = new WeakSet();
// Error
class A_Method_StaticMethod {
@ -185,8 +200,8 @@ function Method() {
_classPrivateMethodInit(this, _foo12);
}
}
function foo10() {}
function foo10() {}
function foo6() {}
function foo6() {}
var _foo13 = new WeakSet();
// Error
class A_Method_StaticGetter {
@ -194,8 +209,12 @@ function Method() {
_classPrivateMethodInit(this, _foo13);
}
}
function foo11() {}
function foo11() {
var _foo13 = {
get: get_foo2,
set: void 0
};
function foo7() {}
function get_foo2() {
return "";
}
var _foo14 = new WeakSet();
@ -205,199 +224,262 @@ function Method() {
_classPrivateMethodInit(this, _foo14);
}
}
function foo12() {}
function foo12(value) {}
var _foo14 = {
get: void 0,
set: set_foo2
};
function foo8() {}
function set_foo2(value) {}
}
function Getter() {
var _foo = new WeakSet();
var _foo = new WeakMap(), _foo = new WeakMap();
// Error
class A_Getter_Field {
constructor(){
_classPrivateMethodInit(this, _foo);
_classPrivateFieldInit(this, _foo, {
get: get_foo,
set: void 0
});
_classPrivateFieldInit(this, _foo, {
writable: true,
value: "foo"
});
}
}
var _foo = new WeakMap();
function foo() {
function get_foo() {
return "";
}
var _foo15 = new WeakSet(), _foo15 = new WeakSet();
var _foo15 = new WeakMap(), _foo15 = new WeakSet();
// Error
class A_Getter_Method {
constructor(){
_classPrivateMethodInit(this, _foo15);
_classPrivateFieldInit(this, _foo15, {
get: get_foo3,
set: void 0
});
_classPrivateMethodInit(this, _foo15);
}
}
function foo13() {
function get_foo3() {
return "";
}
function foo13() {}
var _foo16 = new WeakSet(), _foo16 = new WeakSet();
function foo() {}
var _foo16 = new WeakMap();
// Error
class A_Getter_Getter {
constructor(){
_classPrivateMethodInit(this, _foo16);
_classPrivateMethodInit(this, _foo16);
_classPrivateFieldInit(this, _foo16, {
get: get_foo4,
set: void 0
});
}
}
function foo14() {
function get_foo4() {
return "";
}
function foo14() {
function get_foo4() {
return "";
}
var _foo17 = new WeakSet(), _foo17 = new WeakSet();
var _foo17 = new WeakMap();
//OK
class A_Getter_Setter {
constructor(){
_classPrivateMethodInit(this, _foo17);
_classPrivateMethodInit(this, _foo17);
_classPrivateFieldInit(this, _foo17, {
get: get_foo5,
set: set_foo
});
}
}
function foo15() {
function get_foo5() {
return "";
}
function foo15(value) {}
var _foo18 = new WeakSet();
function set_foo(value) {}
var _foo18 = new WeakMap();
// Error
class A_Getter_StaticField {
constructor(){
_classPrivateMethodInit(this, _foo18);
_classPrivateFieldInit(this, _foo18, {
get: get_foo6,
set: void 0
});
}
}
function foo16() {
function get_foo6() {
return "";
}
function foo16() {}
var _foo19 = new WeakSet();
function foo9() {}
var _foo19 = new WeakMap();
// Error
class A_Getter_StaticMethod {
constructor(){
_classPrivateMethodInit(this, _foo19);
_classPrivateFieldInit(this, _foo19, {
get: get_foo7,
set: void 0
});
}
}
function foo17() {
function get_foo7() {
return "";
}
function foo17() {}
var _foo20 = new WeakSet();
function foo10() {}
var _foo20 = new WeakMap();
// Error
class A_Getter_StaticGetter {
constructor(){
_classPrivateMethodInit(this, _foo20);
_classPrivateFieldInit(this, _foo20, {
get: get_foo8,
set: void 0
});
}
}
function foo18() {
var _foo20 = {
get: get_foo8,
set: void 0
};
function get_foo8() {
return "";
}
function foo18() {
function get_foo8() {
return "";
}
var _foo21 = new WeakSet();
var _foo21 = new WeakMap();
// Error
class A_Getter_StaticSetter {
constructor(){
_classPrivateMethodInit(this, _foo21);
_classPrivateFieldInit(this, _foo21, {
get: get_foo9,
set: void 0
});
}
}
function foo19() {
var _foo21 = {
get: void 0,
set: set_foo3
};
function get_foo9() {
return "";
}
function foo19(value) {}
function set_foo3(value) {}
}
function Setter() {
var _foo = new WeakSet();
var _foo = new WeakMap(), _foo = new WeakMap();
// Error
class A_Setter_Field {
constructor(){
_classPrivateMethodInit(this, _foo);
_classPrivateFieldInit(this, _foo, {
get: void 0,
set: set_foo
});
_classPrivateFieldInit(this, _foo, {
writable: true,
value: "foo"
});
}
}
var _foo = new WeakMap();
function foo(value) {}
var _foo22 = new WeakSet(), _foo22 = new WeakSet();
function set_foo(value) {}
var _foo22 = new WeakMap(), _foo22 = new WeakSet();
// Error
class A_Setter_Method {
constructor(){
_classPrivateMethodInit(this, _foo22);
_classPrivateFieldInit(this, _foo22, {
get: void 0,
set: set_foo4
});
_classPrivateMethodInit(this, _foo22);
}
}
function foo20(value) {}
function foo20() {}
var _foo23 = new WeakSet(), _foo23 = new WeakSet();
function set_foo4(value) {}
function foo() {}
var _foo23 = new WeakMap();
// OK
class A_Setter_Getter {
constructor(){
_classPrivateMethodInit(this, _foo23);
_classPrivateMethodInit(this, _foo23);
_classPrivateFieldInit(this, _foo23, {
get: get_foo,
set: set_foo5
});
}
}
function foo21(value) {}
function foo21() {
function set_foo5(value) {}
function get_foo() {
return "";
}
var _foo24 = new WeakSet(), _foo24 = new WeakSet();
var _foo24 = new WeakMap();
// Error
class A_Setter_Setter {
constructor(){
_classPrivateMethodInit(this, _foo24);
_classPrivateMethodInit(this, _foo24);
_classPrivateFieldInit(this, _foo24, {
get: void 0,
set: set_foo6
});
}
}
function foo22(value) {}
function foo22(value) {}
var _foo25 = new WeakSet();
function set_foo6(value) {}
function set_foo6(value) {}
var _foo25 = new WeakMap();
// Error
class A_Setter_StaticField {
constructor(){
_classPrivateMethodInit(this, _foo25);
_classPrivateFieldInit(this, _foo25, {
get: void 0,
set: set_foo7
});
}
}
var _foo25 = {
writable: true,
value: "foo"
};
function foo23(value) {}
var _foo26 = new WeakSet();
function set_foo7(value) {}
var _foo26 = new WeakMap();
// Error
class A_Setter_StaticMethod {
constructor(){
_classPrivateMethodInit(this, _foo26);
_classPrivateFieldInit(this, _foo26, {
get: void 0,
set: set_foo8
});
}
}
function foo24(value) {}
function foo24() {}
var _foo27 = new WeakSet();
function set_foo8(value) {}
function foo11() {}
var _foo27 = new WeakMap();
// Error
class A_Setter_StaticGetter {
constructor(){
_classPrivateMethodInit(this, _foo27);
_classPrivateFieldInit(this, _foo27, {
get: void 0,
set: set_foo9
});
}
}
function foo25(value) {}
function foo25() {
var _foo27 = {
get: get_foo10,
set: void 0
};
function set_foo9(value) {}
function get_foo10() {
return "";
}
var _foo28 = new WeakSet();
var _foo28 = new WeakMap();
// Error
class A_Setter_StaticSetter {
constructor(){
_classPrivateMethodInit(this, _foo28);
_classPrivateFieldInit(this, _foo28, {
get: void 0,
set: set_foo10
});
}
}
function foo26(value) {}
function foo26(value) {}
var _foo28 = {
get: void 0,
set: set_foo10
};
function set_foo10(value) {}
function set_foo10(value) {}
}
function StaticField() {
var _foo = new WeakMap();
// Error
class A_StaticField_Field {
constructor(){
@ -411,7 +493,6 @@ function StaticField() {
writable: true,
value: "foo"
};
var _foo = new WeakMap();
var _foo29 = new WeakSet();
// Error
class A_StaticField_Method {
@ -424,32 +505,38 @@ function StaticField() {
value: "foo"
};
function foo() {}
var _foo30 = new WeakSet();
var _foo30 = new WeakMap();
// Error
class A_StaticField_Getter {
constructor(){
_classPrivateMethodInit(this, _foo30);
_classPrivateFieldInit(this, _foo30, {
get: get_foo,
set: void 0
});
}
}
var _foo30 = {
writable: true,
value: "foo"
};
function foo27() {
function get_foo() {
return "";
}
var _foo31 = new WeakSet();
var _foo31 = new WeakMap();
// Error
class A_StaticField_Setter {
constructor(){
_classPrivateMethodInit(this, _foo31);
_classPrivateFieldInit(this, _foo31, {
get: void 0,
set: set_foo
});
}
}
var _foo31 = {
writable: true,
value: "foo"
};
function foo28(value) {}
function set_foo(value) {}
// Error
class A_StaticField_StaticField {
}
@ -468,7 +555,7 @@ function StaticField() {
writable: true,
value: "foo"
};
function foo29() {}
function foo12() {}
// Error
class A_StaticField_StaticGetter {
}
@ -476,7 +563,11 @@ function StaticField() {
writable: true,
value: "foo"
};
function foo30() {
var _foo34 = {
get: get_foo11,
set: void 0
};
function get_foo11() {
return "";
}
// Error
@ -486,9 +577,14 @@ function StaticField() {
writable: true,
value: "foo"
};
function foo31(value) {}
var _foo35 = {
get: void 0,
set: set_foo11
};
function set_foo11(value) {}
}
function StaticMethod() {
var _foo = new WeakMap();
// Error
class A_StaticMethod_Field {
constructor(){
@ -498,7 +594,6 @@ function StaticMethod() {
});
}
}
var _foo = new WeakMap();
function foo() {}
var _foo36 = new WeakSet();
// Error
@ -507,28 +602,34 @@ function StaticMethod() {
_classPrivateMethodInit(this, _foo36);
}
}
function foo32() {}
function foo32() {}
var _foo37 = new WeakSet();
function foo13() {}
function foo13() {}
var _foo37 = new WeakMap();
// Error
class A_StaticMethod_Getter {
constructor(){
_classPrivateMethodInit(this, _foo37);
_classPrivateFieldInit(this, _foo37, {
get: get_foo,
set: void 0
});
}
}
function foo33() {}
function foo33() {
function foo14() {}
function get_foo() {
return "";
}
var _foo38 = new WeakSet();
var _foo38 = new WeakMap();
// Error
class A_StaticMethod_Setter {
constructor(){
_classPrivateMethodInit(this, _foo38);
_classPrivateFieldInit(this, _foo38, {
get: void 0,
set: set_foo
});
}
}
function foo34() {}
function foo34(value) {}
function foo15() {}
function set_foo(value) {}
// Error
class A_StaticMethod_StaticField {
}
@ -536,26 +637,35 @@ function StaticMethod() {
writable: true,
value: "foo"
};
function foo35() {}
function foo16() {}
// Error
class A_StaticMethod_StaticMethod {
}
function foo36() {}
function foo36() {}
function foo17() {}
function foo17() {}
// Error
class A_StaticMethod_StaticGetter {
}
function foo37() {}
function foo37() {
var _foo40 = {
get: get_foo12,
set: void 0
};
function foo18() {}
function get_foo12() {
return "";
}
// Error
class A_StaticMethod_StaticSetter {
}
function foo38() {}
function foo38(value) {}
var _foo41 = {
get: void 0,
set: set_foo12
};
function foo19() {}
function set_foo12(value) {}
}
function StaticGetter() {
var _foo = new WeakMap();
// Error
class A_StaticGetter_Field {
constructor(){
@ -565,77 +675,115 @@ function StaticGetter() {
});
}
}
var _foo = new WeakMap();
function foo() {
return "";
}
var _foo40 = new WeakSet();
// Error
class A_StaticGetter_Method {
constructor(){
_classPrivateMethodInit(this, _foo40);
}
}
function foo39() {
return "";
}
function foo39() {}
var _foo41 = new WeakSet();
// Error
class A_StaticGetter_Getter {
constructor(){
_classPrivateMethodInit(this, _foo41);
}
}
function foo40() {
return "";
}
function foo40() {
var _foo = {
get: get_foo,
set: void 0
};
function get_foo() {
return "";
}
var _foo42 = new WeakSet();
// Error
class A_StaticGetter_Setter {
class A_StaticGetter_Method {
constructor(){
_classPrivateMethodInit(this, _foo42);
}
}
function foo41() {
var _foo42 = {
get: get_foo13,
set: void 0
};
function get_foo13() {
return "";
}
function foo41(value) {}
function foo() {}
var _foo43 = new WeakMap();
// Error
class A_StaticGetter_Getter {
constructor(){
_classPrivateFieldInit(this, _foo43, {
get: get_foo14,
set: void 0
});
}
}
var _foo43 = {
get: get_foo14,
set: void 0
};
function get_foo14() {
return "";
}
function get_foo14() {
return "";
}
var _foo44 = new WeakMap();
// Error
class A_StaticGetter_Setter {
constructor(){
_classPrivateFieldInit(this, _foo44, {
get: void 0,
set: set_foo
});
}
}
var _foo44 = {
get: get_foo15,
set: void 0
};
function get_foo15() {
return "";
}
function set_foo(value) {}
// Error
class A_StaticGetter_StaticField {
}
function foo42() {
var _foo45 = {
get: get_foo16,
set: void 0
};
function get_foo16() {
return "";
}
function foo42() {}
function foo20() {}
// Error
class A_StaticGetter_StaticMethod {
}
function foo43() {
var _foo46 = {
get: get_foo17,
set: void 0
};
function get_foo17() {
return "";
}
function foo43() {}
function foo21() {}
// Error
class A_StaticGetter_StaticGetter {
}
function foo44() {
var _foo47 = {
get: get_foo18,
set: void 0
};
function get_foo18() {
return "";
}
function foo44() {
function get_foo18() {
return "";
}
// OK
class A_StaticGetter_StaticSetter {
}
function foo45() {
var _foo48 = {
get: get_foo19,
set: set_foo13
};
function get_foo19() {
return "";
}
function foo45(value) {}
function set_foo13(value) {}
}
function StaticSetter() {
var _foo = new WeakMap();
// Error
class A_StaticSetter_Field {
constructor(){
@ -645,60 +793,97 @@ function StaticSetter() {
});
}
}
var _foo = new WeakMap();
function foo(value) {}
var _foo43 = new WeakSet();
var _foo = {
get: void 0,
set: set_foo
};
function set_foo(value) {}
var _foo49 = new WeakSet();
// Error
class A_StaticSetter_Method {
constructor(){
_classPrivateMethodInit(this, _foo43);
_classPrivateMethodInit(this, _foo49);
}
}
function foo46(value) {}
function foo46() {}
var _foo44 = new WeakSet();
var _foo49 = {
get: void 0,
set: set_foo14
};
function set_foo14(value) {}
function foo() {}
var _foo50 = new WeakMap();
// Error
class A_StaticSetter_Getter {
constructor(){
_classPrivateMethodInit(this, _foo44);
_classPrivateFieldInit(this, _foo50, {
get: get_foo,
set: void 0
});
}
}
function foo47(value) {}
function foo47() {
var _foo50 = {
get: void 0,
set: set_foo15
};
function set_foo15(value) {}
function get_foo() {
return "";
}
var _foo45 = new WeakSet();
var _foo51 = new WeakMap();
// Error
class A_StaticSetter_Setter {
constructor(){
_classPrivateMethodInit(this, _foo45);
_classPrivateFieldInit(this, _foo51, {
get: void 0,
set: set_foo16
});
}
}
function foo48(value) {}
function foo48(value) {}
var _foo51 = {
get: void 0,
set: set_foo16
};
function set_foo16(value) {}
function set_foo16(value) {}
// Error
class A_StaticSetter_StaticField {
}
var _foo46 = {
var _foo52 = {
get: void 0,
set: set_foo17
};
var _foo52 = {
writable: true,
value: "foo"
};
function foo49(value) {}
function set_foo17(value) {}
// Error
class A_StaticSetter_StaticMethod {
}
function foo50(value) {}
function foo50() {}
var _foo53 = {
get: void 0,
set: set_foo18
};
function set_foo18(value) {}
function foo22() {}
// OK
class A_StaticSetter_StaticGetter {
}
function foo51(value) {}
function foo51() {
var _foo54 = {
get: get_foo20,
set: set_foo19
};
function set_foo19(value) {}
function get_foo20() {
return "";
}
// Error
class A_StaticSetter_StaticSetter {
}
function foo52(value) {}
function foo52(value) {}
var _foo55 = {
get: void 0,
set: set_foo20
};
function set_foo20(value) {}
function set_foo20(value) {}
}

View File

@ -20,15 +20,16 @@ function _classPrivateMethodInit(obj, privateSet) {
// @target: es6
function Field() {
var foo = function foo() {};
var foo1 = function foo1() {
var get_foo = function get_foo() {
return "";
};
var foo2 = function foo2(value) {};
var foo3 = function foo3() {};
var foo4 = function foo4() {
var set_foo = function set_foo(value) {};
var foo1 = function foo1() {};
var get_foo1 = function get_foo1() {
return "";
};
var foo5 = function foo5(value) {};
var set_foo1 = function set_foo1(value) {};
var _foo = new WeakMap(), _foo = new WeakMap();
var A_Field_Field = function A_Field_Field() {
"use strict";
_classCallCheck(this, A_Field_Field);
@ -41,9 +42,7 @@ function Field() {
value: "foo"
});
};
var _foo = new WeakMap();
var _foo = new WeakMap();
var _foo1 = new WeakSet();
var _foo1 = new WeakMap(), _foo1 = new WeakSet();
var A_Field_Method = function A_Field_Method() {
"use strict";
_classCallCheck(this, A_Field_Method);
@ -53,8 +52,7 @@ function Field() {
});
_classPrivateMethodInit(this, _foo1);
};
var _foo1 = new WeakMap();
var _foo2 = new WeakSet();
var _foo2 = new WeakMap(), _foo2 = new WeakMap();
var A_Field_Getter = function A_Field_Getter() {
"use strict";
_classCallCheck(this, A_Field_Getter);
@ -62,10 +60,12 @@ function Field() {
writable: true,
value: "foo"
});
_classPrivateMethodInit(this, _foo2);
_classPrivateFieldInit(this, _foo2, {
get: get_foo,
set: void 0
});
};
var _foo2 = new WeakMap();
var _foo3 = new WeakSet();
var _foo3 = new WeakMap(), _foo3 = new WeakMap();
var A_Field_Setter = function A_Field_Setter() {
"use strict";
_classCallCheck(this, A_Field_Setter);
@ -73,9 +73,12 @@ function Field() {
writable: true,
value: "foo"
});
_classPrivateMethodInit(this, _foo3);
_classPrivateFieldInit(this, _foo3, {
get: void 0,
set: set_foo
});
};
var _foo3 = new WeakMap();
var _foo4 = new WeakMap();
var A_Field_StaticField = function A_Field_StaticField() {
"use strict";
_classCallCheck(this, A_Field_StaticField);
@ -84,11 +87,11 @@ function Field() {
value: "foo"
});
};
var _foo4 = new WeakMap();
var _foo4 = {
writable: true,
value: "foo"
};
var _foo5 = new WeakMap();
var A_Field_StaticMethod = function A_Field_StaticMethod() {
"use strict";
_classCallCheck(this, A_Field_StaticMethod);
@ -97,7 +100,7 @@ function Field() {
value: "foo"
});
};
var _foo5 = new WeakMap();
var _foo6 = new WeakMap();
var A_Field_StaticGetter = function A_Field_StaticGetter() {
"use strict";
_classCallCheck(this, A_Field_StaticGetter);
@ -106,7 +109,11 @@ function Field() {
value: "foo"
});
};
var _foo6 = new WeakMap();
var _foo6 = {
get: get_foo1,
set: void 0
};
var _foo7 = new WeakMap();
var A_Field_StaticSetter = function A_Field_StaticSetter() {
"use strict";
_classCallCheck(this, A_Field_StaticSetter);
@ -115,28 +122,31 @@ function Field() {
value: "foo"
});
};
var _foo7 = new WeakMap();
var _foo7 = {
get: void 0,
set: set_foo1
};
}
function Method() {
var foo = function foo() {};
var foo2 = function foo2() {};
var foo2 = function foo2() {};
var foo3 = function foo3() {};
var get_foo = function get_foo() {
return "";
};
var foo4 = function foo4() {};
var set_foo = function set_foo(value) {};
var foo5 = function foo5() {};
var foo6 = function foo6() {};
var foo6 = function foo6() {};
var foo7 = function foo7() {};
var foo7 = function foo7() {
var get_foo2 = function get_foo2() {
return "";
};
var foo8 = function foo8() {};
var foo8 = function foo8(value) {};
var foo9 = function foo9() {};
var foo10 = function foo10() {};
var foo10 = function foo10() {};
var foo11 = function foo11() {};
var foo11 = function foo11() {
return "";
};
var foo12 = function foo12() {};
var foo12 = function foo12(value) {};
var _foo = new WeakSet();
var set_foo2 = function set_foo2(value) {};
var _foo = new WeakSet(), _foo = new WeakMap();
var A_Method_Field = function A_Method_Field() {
"use strict";
_classCallCheck(this, A_Method_Field);
@ -146,7 +156,6 @@ function Method() {
value: "foo"
});
};
var _foo = new WeakMap();
var _foo8 = new WeakSet(), _foo8 = new WeakSet();
var A_Method_Method = function A_Method_Method() {
"use strict";
@ -154,19 +163,25 @@ function Method() {
_classPrivateMethodInit(this, _foo8);
_classPrivateMethodInit(this, _foo8);
};
var _foo9 = new WeakSet(), _foo9 = new WeakSet();
var _foo9 = new WeakSet(), _foo9 = new WeakMap();
var A_Method_Getter = function A_Method_Getter() {
"use strict";
_classCallCheck(this, A_Method_Getter);
_classPrivateMethodInit(this, _foo9);
_classPrivateMethodInit(this, _foo9);
_classPrivateFieldInit(this, _foo9, {
get: get_foo,
set: void 0
});
};
var _foo10 = new WeakSet(), _foo10 = new WeakSet();
var _foo10 = new WeakSet(), _foo10 = new WeakMap();
var A_Method_Setter = function A_Method_Setter() {
"use strict";
_classCallCheck(this, A_Method_Setter);
_classPrivateMethodInit(this, _foo10);
_classPrivateMethodInit(this, _foo10);
_classPrivateFieldInit(this, _foo10, {
get: void 0,
set: set_foo
});
};
var _foo11 = new WeakSet();
var A_Method_StaticField = function A_Method_StaticField() {
@ -190,197 +205,264 @@ function Method() {
_classCallCheck(this, A_Method_StaticGetter);
_classPrivateMethodInit(this, _foo13);
};
var _foo13 = {
get: get_foo2,
set: void 0
};
var _foo14 = new WeakSet();
var A_Method_StaticSetter = function A_Method_StaticSetter() {
"use strict";
_classCallCheck(this, A_Method_StaticSetter);
_classPrivateMethodInit(this, _foo14);
};
var _foo14 = {
get: void 0,
set: set_foo2
};
}
function Getter() {
var foo = function foo() {
var get_foo = function get_foo() {
return "";
};
var foo13 = function foo13() {
var get_foo3 = function get_foo3() {
return "";
};
var foo13 = function foo13() {};
var foo14 = function foo14() {
var foo = function foo() {};
var get_foo4 = function get_foo4() {
return "";
};
var foo14 = function foo14() {
var get_foo4 = function get_foo4() {
return "";
};
var foo15 = function foo15() {
var get_foo5 = function get_foo5() {
return "";
};
var foo15 = function foo15(value) {};
var foo16 = function foo16() {
var set_foo = function set_foo(value) {};
var get_foo6 = function get_foo6() {
return "";
};
var foo16 = function foo16() {};
var foo17 = function foo17() {
var foo9 = function foo9() {};
var get_foo7 = function get_foo7() {
return "";
};
var foo17 = function foo17() {};
var foo18 = function foo18() {
var foo10 = function foo10() {};
var get_foo8 = function get_foo8() {
return "";
};
var foo18 = function foo18() {
var get_foo8 = function get_foo8() {
return "";
};
var foo19 = function foo19() {
var get_foo9 = function get_foo9() {
return "";
};
var foo19 = function foo19(value) {};
var _foo = new WeakSet();
var set_foo3 = function set_foo3(value) {};
var _foo = new WeakMap(), _foo = new WeakMap();
var A_Getter_Field = function A_Getter_Field() {
"use strict";
_classCallCheck(this, A_Getter_Field);
_classPrivateMethodInit(this, _foo);
_classPrivateFieldInit(this, _foo, {
get: get_foo,
set: void 0
});
_classPrivateFieldInit(this, _foo, {
writable: true,
value: "foo"
});
};
var _foo = new WeakMap();
var _foo15 = new WeakSet(), _foo15 = new WeakSet();
var _foo15 = new WeakMap(), _foo15 = new WeakSet();
var A_Getter_Method = function A_Getter_Method() {
"use strict";
_classCallCheck(this, A_Getter_Method);
_classPrivateMethodInit(this, _foo15);
_classPrivateFieldInit(this, _foo15, {
get: get_foo3,
set: void 0
});
_classPrivateMethodInit(this, _foo15);
};
var _foo16 = new WeakSet(), _foo16 = new WeakSet();
var _foo16 = new WeakMap();
var A_Getter_Getter = function A_Getter_Getter() {
"use strict";
_classCallCheck(this, A_Getter_Getter);
_classPrivateMethodInit(this, _foo16);
_classPrivateMethodInit(this, _foo16);
_classPrivateFieldInit(this, _foo16, {
get: get_foo4,
set: void 0
});
};
var _foo17 = new WeakSet(), _foo17 = new WeakSet();
var _foo17 = new WeakMap();
var A_Getter_Setter = function A_Getter_Setter() {
"use strict";
_classCallCheck(this, A_Getter_Setter);
_classPrivateMethodInit(this, _foo17);
_classPrivateMethodInit(this, _foo17);
_classPrivateFieldInit(this, _foo17, {
get: get_foo5,
set: set_foo
});
};
var _foo18 = new WeakSet();
var _foo18 = new WeakMap();
var A_Getter_StaticField = function A_Getter_StaticField() {
"use strict";
_classCallCheck(this, A_Getter_StaticField);
_classPrivateMethodInit(this, _foo18);
_classPrivateFieldInit(this, _foo18, {
get: get_foo6,
set: void 0
});
};
var _foo19 = new WeakSet();
var _foo19 = new WeakMap();
var A_Getter_StaticMethod = function A_Getter_StaticMethod() {
"use strict";
_classCallCheck(this, A_Getter_StaticMethod);
_classPrivateMethodInit(this, _foo19);
_classPrivateFieldInit(this, _foo19, {
get: get_foo7,
set: void 0
});
};
var _foo20 = new WeakSet();
var _foo20 = new WeakMap();
var A_Getter_StaticGetter = function A_Getter_StaticGetter() {
"use strict";
_classCallCheck(this, A_Getter_StaticGetter);
_classPrivateMethodInit(this, _foo20);
_classPrivateFieldInit(this, _foo20, {
get: get_foo8,
set: void 0
});
};
var _foo21 = new WeakSet();
var _foo20 = {
get: get_foo8,
set: void 0
};
var _foo21 = new WeakMap();
var A_Getter_StaticSetter = function A_Getter_StaticSetter() {
"use strict";
_classCallCheck(this, A_Getter_StaticSetter);
_classPrivateMethodInit(this, _foo21);
_classPrivateFieldInit(this, _foo21, {
get: get_foo9,
set: void 0
});
};
var _foo21 = {
get: void 0,
set: set_foo3
};
}
function Setter() {
var foo = function foo(value) {};
var foo20 = function foo20(value) {};
var foo20 = function foo20() {};
var foo21 = function foo21(value) {};
var foo21 = function foo21() {
var set_foo = function set_foo(value) {};
var set_foo4 = function set_foo4(value) {};
var foo = function foo() {};
var set_foo5 = function set_foo5(value) {};
var get_foo = function get_foo() {
return "";
};
var foo22 = function foo22(value) {};
var foo22 = function foo22(value) {};
var foo23 = function foo23(value) {};
var foo24 = function foo24(value) {};
var foo24 = function foo24() {};
var foo25 = function foo25(value) {};
var foo25 = function foo25() {
var set_foo6 = function set_foo6(value) {};
var set_foo6 = function set_foo6(value) {};
var set_foo7 = function set_foo7(value) {};
var set_foo8 = function set_foo8(value) {};
var foo11 = function foo11() {};
var set_foo9 = function set_foo9(value) {};
var get_foo10 = function get_foo10() {
return "";
};
var foo26 = function foo26(value) {};
var foo26 = function foo26(value) {};
var _foo = new WeakSet();
var set_foo10 = function set_foo10(value) {};
var set_foo10 = function set_foo10(value) {};
var _foo = new WeakMap(), _foo = new WeakMap();
var A_Setter_Field = function A_Setter_Field() {
"use strict";
_classCallCheck(this, A_Setter_Field);
_classPrivateMethodInit(this, _foo);
_classPrivateFieldInit(this, _foo, {
get: void 0,
set: set_foo
});
_classPrivateFieldInit(this, _foo, {
writable: true,
value: "foo"
});
};
var _foo = new WeakMap();
var _foo22 = new WeakSet(), _foo22 = new WeakSet();
var _foo22 = new WeakMap(), _foo22 = new WeakSet();
var A_Setter_Method = function A_Setter_Method() {
"use strict";
_classCallCheck(this, A_Setter_Method);
_classPrivateMethodInit(this, _foo22);
_classPrivateFieldInit(this, _foo22, {
get: void 0,
set: set_foo4
});
_classPrivateMethodInit(this, _foo22);
};
var _foo23 = new WeakSet(), _foo23 = new WeakSet();
var _foo23 = new WeakMap();
var A_Setter_Getter = function A_Setter_Getter() {
"use strict";
_classCallCheck(this, A_Setter_Getter);
_classPrivateMethodInit(this, _foo23);
_classPrivateMethodInit(this, _foo23);
_classPrivateFieldInit(this, _foo23, {
get: get_foo,
set: set_foo5
});
};
var _foo24 = new WeakSet(), _foo24 = new WeakSet();
var _foo24 = new WeakMap();
var A_Setter_Setter = function A_Setter_Setter() {
"use strict";
_classCallCheck(this, A_Setter_Setter);
_classPrivateMethodInit(this, _foo24);
_classPrivateMethodInit(this, _foo24);
_classPrivateFieldInit(this, _foo24, {
get: void 0,
set: set_foo6
});
};
var _foo25 = new WeakSet();
var _foo25 = new WeakMap();
var A_Setter_StaticField = function A_Setter_StaticField() {
"use strict";
_classCallCheck(this, A_Setter_StaticField);
_classPrivateMethodInit(this, _foo25);
_classPrivateFieldInit(this, _foo25, {
get: void 0,
set: set_foo7
});
};
var _foo25 = {
writable: true,
value: "foo"
};
var _foo26 = new WeakSet();
var _foo26 = new WeakMap();
var A_Setter_StaticMethod = function A_Setter_StaticMethod() {
"use strict";
_classCallCheck(this, A_Setter_StaticMethod);
_classPrivateMethodInit(this, _foo26);
_classPrivateFieldInit(this, _foo26, {
get: void 0,
set: set_foo8
});
};
var _foo27 = new WeakSet();
var _foo27 = new WeakMap();
var A_Setter_StaticGetter = function A_Setter_StaticGetter() {
"use strict";
_classCallCheck(this, A_Setter_StaticGetter);
_classPrivateMethodInit(this, _foo27);
_classPrivateFieldInit(this, _foo27, {
get: void 0,
set: set_foo9
});
};
var _foo28 = new WeakSet();
var _foo27 = {
get: get_foo10,
set: void 0
};
var _foo28 = new WeakMap();
var A_Setter_StaticSetter = function A_Setter_StaticSetter() {
"use strict";
_classCallCheck(this, A_Setter_StaticSetter);
_classPrivateMethodInit(this, _foo28);
_classPrivateFieldInit(this, _foo28, {
get: void 0,
set: set_foo10
});
};
var _foo28 = {
get: void 0,
set: set_foo10
};
}
function StaticField() {
var foo = function foo() {};
var foo27 = function foo27() {
var get_foo = function get_foo() {
return "";
};
var foo28 = function foo28(value) {};
var foo29 = function foo29() {};
var foo30 = function foo30() {
var set_foo = function set_foo(value) {};
var foo12 = function foo12() {};
var get_foo11 = function get_foo11() {
return "";
};
var foo31 = function foo31(value) {};
var set_foo11 = function set_foo11(value) {};
var _foo = new WeakMap();
var A_StaticField_Field = function A_StaticField_Field() {
"use strict";
_classCallCheck(this, A_StaticField_Field);
@ -393,7 +475,6 @@ function StaticField() {
writable: true,
value: "foo"
};
var _foo = new WeakMap();
var _foo29 = new WeakSet();
var A_StaticField_Method = function A_StaticField_Method() {
"use strict";
@ -404,21 +485,27 @@ function StaticField() {
writable: true,
value: "foo"
};
var _foo30 = new WeakSet();
var _foo30 = new WeakMap();
var A_StaticField_Getter = function A_StaticField_Getter() {
"use strict";
_classCallCheck(this, A_StaticField_Getter);
_classPrivateMethodInit(this, _foo30);
_classPrivateFieldInit(this, _foo30, {
get: get_foo,
set: void 0
});
};
var _foo30 = {
writable: true,
value: "foo"
};
var _foo31 = new WeakSet();
var _foo31 = new WeakMap();
var A_StaticField_Setter = function A_StaticField_Setter() {
"use strict";
_classCallCheck(this, A_StaticField_Setter);
_classPrivateMethodInit(this, _foo31);
_classPrivateFieldInit(this, _foo31, {
get: void 0,
set: set_foo
});
};
var _foo31 = {
writable: true,
@ -452,6 +539,10 @@ function StaticField() {
writable: true,
value: "foo"
};
var _foo34 = {
get: get_foo11,
set: void 0
};
var A_StaticField_StaticSetter = function A_StaticField_StaticSetter() {
"use strict";
_classCallCheck(this, A_StaticField_StaticSetter);
@ -460,26 +551,31 @@ function StaticField() {
writable: true,
value: "foo"
};
var _foo35 = {
get: void 0,
set: set_foo11
};
}
function StaticMethod() {
var foo = function foo() {};
var foo32 = function foo32() {};
var foo32 = function foo32() {};
var foo33 = function foo33() {};
var foo33 = function foo33() {
var foo13 = function foo13() {};
var foo13 = function foo13() {};
var foo14 = function foo14() {};
var get_foo = function get_foo() {
return "";
};
var foo34 = function foo34() {};
var foo34 = function foo34(value) {};
var foo35 = function foo35() {};
var foo36 = function foo36() {};
var foo36 = function foo36() {};
var foo37 = function foo37() {};
var foo37 = function foo37() {
var foo15 = function foo15() {};
var set_foo = function set_foo(value) {};
var foo16 = function foo16() {};
var foo17 = function foo17() {};
var foo17 = function foo17() {};
var foo18 = function foo18() {};
var get_foo12 = function get_foo12() {
return "";
};
var foo38 = function foo38() {};
var foo38 = function foo38(value) {};
var foo19 = function foo19() {};
var set_foo12 = function set_foo12(value) {};
var _foo = new WeakMap();
var A_StaticMethod_Field = function A_StaticMethod_Field() {
"use strict";
_classCallCheck(this, A_StaticMethod_Field);
@ -488,24 +584,29 @@ function StaticMethod() {
value: "foo"
});
};
var _foo = new WeakMap();
var _foo36 = new WeakSet();
var A_StaticMethod_Method = function A_StaticMethod_Method() {
"use strict";
_classCallCheck(this, A_StaticMethod_Method);
_classPrivateMethodInit(this, _foo36);
};
var _foo37 = new WeakSet();
var _foo37 = new WeakMap();
var A_StaticMethod_Getter = function A_StaticMethod_Getter() {
"use strict";
_classCallCheck(this, A_StaticMethod_Getter);
_classPrivateMethodInit(this, _foo37);
_classPrivateFieldInit(this, _foo37, {
get: get_foo,
set: void 0
});
};
var _foo38 = new WeakSet();
var _foo38 = new WeakMap();
var A_StaticMethod_Setter = function A_StaticMethod_Setter() {
"use strict";
_classCallCheck(this, A_StaticMethod_Setter);
_classPrivateMethodInit(this, _foo38);
_classPrivateFieldInit(this, _foo38, {
get: void 0,
set: set_foo
});
};
var A_StaticMethod_StaticField = function A_StaticMethod_StaticField() {
"use strict";
@ -523,47 +624,56 @@ function StaticMethod() {
"use strict";
_classCallCheck(this, A_StaticMethod_StaticGetter);
};
var _foo40 = {
get: get_foo12,
set: void 0
};
var A_StaticMethod_StaticSetter = function A_StaticMethod_StaticSetter() {
"use strict";
_classCallCheck(this, A_StaticMethod_StaticSetter);
};
var _foo41 = {
get: void 0,
set: set_foo12
};
}
function StaticGetter() {
var foo = function foo() {
var get_foo = function get_foo() {
return "";
};
var foo39 = function foo39() {
var get_foo13 = function get_foo13() {
return "";
};
var foo39 = function foo39() {};
var foo40 = function foo40() {
var foo = function foo() {};
var get_foo14 = function get_foo14() {
return "";
};
var foo40 = function foo40() {
var get_foo14 = function get_foo14() {
return "";
};
var foo41 = function foo41() {
var get_foo15 = function get_foo15() {
return "";
};
var foo41 = function foo41(value) {};
var foo42 = function foo42() {
var set_foo = function set_foo(value) {};
var get_foo16 = function get_foo16() {
return "";
};
var foo42 = function foo42() {};
var foo43 = function foo43() {
var foo20 = function foo20() {};
var get_foo17 = function get_foo17() {
return "";
};
var foo43 = function foo43() {};
var foo44 = function foo44() {
var foo21 = function foo21() {};
var get_foo18 = function get_foo18() {
return "";
};
var foo44 = function foo44() {
var get_foo18 = function get_foo18() {
return "";
};
var foo45 = function foo45() {
var get_foo19 = function get_foo19() {
return "";
};
var foo45 = function foo45(value) {};
var set_foo13 = function set_foo13(value) {};
var _foo = new WeakMap();
var A_StaticGetter_Field = function A_StaticGetter_Field() {
"use strict";
_classCallCheck(this, A_StaticGetter_Field);
@ -572,61 +682,99 @@ function StaticGetter() {
value: "foo"
});
};
var _foo = new WeakMap();
var _foo40 = new WeakSet();
var _foo = {
get: get_foo,
set: void 0
};
var _foo42 = new WeakSet();
var A_StaticGetter_Method = function A_StaticGetter_Method() {
"use strict";
_classCallCheck(this, A_StaticGetter_Method);
_classPrivateMethodInit(this, _foo40);
_classPrivateMethodInit(this, _foo42);
};
var _foo41 = new WeakSet();
var _foo42 = {
get: get_foo13,
set: void 0
};
var _foo43 = new WeakMap();
var A_StaticGetter_Getter = function A_StaticGetter_Getter() {
"use strict";
_classCallCheck(this, A_StaticGetter_Getter);
_classPrivateMethodInit(this, _foo41);
_classPrivateFieldInit(this, _foo43, {
get: get_foo14,
set: void 0
});
};
var _foo42 = new WeakSet();
var _foo43 = {
get: get_foo14,
set: void 0
};
var _foo44 = new WeakMap();
var A_StaticGetter_Setter = function A_StaticGetter_Setter() {
"use strict";
_classCallCheck(this, A_StaticGetter_Setter);
_classPrivateMethodInit(this, _foo42);
_classPrivateFieldInit(this, _foo44, {
get: void 0,
set: set_foo
});
};
var _foo44 = {
get: get_foo15,
set: void 0
};
var A_StaticGetter_StaticField = function A_StaticGetter_StaticField() {
"use strict";
_classCallCheck(this, A_StaticGetter_StaticField);
};
var _foo45 = {
get: get_foo16,
set: void 0
};
var A_StaticGetter_StaticMethod = function A_StaticGetter_StaticMethod() {
"use strict";
_classCallCheck(this, A_StaticGetter_StaticMethod);
};
var _foo46 = {
get: get_foo17,
set: void 0
};
var A_StaticGetter_StaticGetter = function A_StaticGetter_StaticGetter() {
"use strict";
_classCallCheck(this, A_StaticGetter_StaticGetter);
};
var _foo47 = {
get: get_foo18,
set: void 0
};
var A_StaticGetter_StaticSetter = function A_StaticGetter_StaticSetter() {
"use strict";
_classCallCheck(this, A_StaticGetter_StaticSetter);
};
var _foo48 = {
get: get_foo19,
set: set_foo13
};
}
function StaticSetter() {
var foo = function foo(value) {};
var foo46 = function foo46(value) {};
var foo46 = function foo46() {};
var foo47 = function foo47(value) {};
var foo47 = function foo47() {
var set_foo = function set_foo(value) {};
var set_foo14 = function set_foo14(value) {};
var foo = function foo() {};
var set_foo15 = function set_foo15(value) {};
var get_foo = function get_foo() {
return "";
};
var foo48 = function foo48(value) {};
var foo48 = function foo48(value) {};
var foo49 = function foo49(value) {};
var foo50 = function foo50(value) {};
var foo50 = function foo50() {};
var foo51 = function foo51(value) {};
var foo51 = function foo51() {
var set_foo16 = function set_foo16(value) {};
var set_foo16 = function set_foo16(value) {};
var set_foo17 = function set_foo17(value) {};
var set_foo18 = function set_foo18(value) {};
var foo22 = function foo22() {};
var set_foo19 = function set_foo19(value) {};
var get_foo20 = function get_foo20() {
return "";
};
var foo52 = function foo52(value) {};
var foo52 = function foo52(value) {};
var set_foo20 = function set_foo20(value) {};
var set_foo20 = function set_foo20(value) {};
var _foo = new WeakMap();
var A_StaticSetter_Field = function A_StaticSetter_Field() {
"use strict";
_classCallCheck(this, A_StaticSetter_Field);
@ -635,30 +783,55 @@ function StaticSetter() {
value: "foo"
});
};
var _foo = new WeakMap();
var _foo43 = new WeakSet();
var _foo = {
get: void 0,
set: set_foo
};
var _foo49 = new WeakSet();
var A_StaticSetter_Method = function A_StaticSetter_Method() {
"use strict";
_classCallCheck(this, A_StaticSetter_Method);
_classPrivateMethodInit(this, _foo43);
_classPrivateMethodInit(this, _foo49);
};
var _foo44 = new WeakSet();
var _foo49 = {
get: void 0,
set: set_foo14
};
var _foo50 = new WeakMap();
var A_StaticSetter_Getter = function A_StaticSetter_Getter() {
"use strict";
_classCallCheck(this, A_StaticSetter_Getter);
_classPrivateMethodInit(this, _foo44);
_classPrivateFieldInit(this, _foo50, {
get: get_foo,
set: void 0
});
};
var _foo45 = new WeakSet();
var _foo50 = {
get: void 0,
set: set_foo15
};
var _foo51 = new WeakMap();
var A_StaticSetter_Setter = function A_StaticSetter_Setter() {
"use strict";
_classCallCheck(this, A_StaticSetter_Setter);
_classPrivateMethodInit(this, _foo45);
_classPrivateFieldInit(this, _foo51, {
get: void 0,
set: set_foo16
});
};
var _foo51 = {
get: void 0,
set: set_foo16
};
var A_StaticSetter_StaticField = function A_StaticSetter_StaticField() {
"use strict";
_classCallCheck(this, A_StaticSetter_StaticField);
};
var _foo46 = {
var _foo52 = {
get: void 0,
set: set_foo17
};
var _foo52 = {
writable: true,
value: "foo"
};
@ -666,12 +839,24 @@ function StaticSetter() {
"use strict";
_classCallCheck(this, A_StaticSetter_StaticMethod);
};
var _foo53 = {
get: void 0,
set: set_foo18
};
var A_StaticSetter_StaticGetter = function A_StaticSetter_StaticGetter() {
"use strict";
_classCallCheck(this, A_StaticSetter_StaticGetter);
};
var _foo54 = {
get: get_foo20,
set: set_foo19
};
var A_StaticSetter_StaticSetter = function A_StaticSetter_StaticSetter() {
"use strict";
_classCallCheck(this, A_StaticSetter_StaticSetter);
};
var _foo55 = {
get: void 0,
set: set_foo20
};
}

View File

@ -11,7 +11,7 @@ function _classPrivateMethodInit(obj, privateSet) {
_checkPrivateRedeclaration(obj, privateSet);
privateSet.add(obj);
}
var _method = new WeakSet(), _acc = new WeakSet(), _acc = new WeakSet();
var _field = new WeakMap(), _method = new WeakSet(), _acc = new WeakMap();
// @target: es5, es3
class A {
constructor(){
@ -20,22 +20,27 @@ class A {
value: 123
});
_classPrivateMethodInit(this, _method);
_classPrivateMethodInit(this, _acc);
_classPrivateMethodInit(this, _acc);
_classPrivateFieldInit(this, _acc, {
get: get_acc,
set: set_acc
});
}
}
var _field = new WeakMap();
var _sField = {
writable: true,
value: "hello world"
};
var _sAcc = {
get: get_sAcc,
set: set_sAcc
};
function method() {}
function sMethod() {}
function acc() {
function get_acc() {
return "";
}
function acc(x) {}
function sAcc() {
function set_acc(x) {}
function get_sAcc() {
return 0;
}
function sAcc(x) {}
function set_sAcc(x) {}

View File

@ -1 +1 @@
new WeakSet(), new WeakSet(), new WeakSet(), new WeakMap();
new WeakMap(), new WeakSet(), new WeakMap();

View File

@ -16,7 +16,7 @@ function _classPrivateMethodInit(obj, privateSet) {
_checkPrivateRedeclaration(obj, privateSet);
privateSet.add(obj);
}
var _method = new WeakSet(), _acc = new WeakSet(), _acc = new WeakSet();
var _field = new WeakMap(), _method = new WeakSet(), _acc = new WeakMap();
var A = function A() {
"use strict";
_classCallCheck(this, A);
@ -25,21 +25,26 @@ var A = function A() {
value: 123
});
_classPrivateMethodInit(this, _method);
_classPrivateMethodInit(this, _acc);
_classPrivateMethodInit(this, _acc);
_classPrivateFieldInit(this, _acc, {
get: get_acc,
set: set_acc
});
};
var _field = new WeakMap();
var _sField = {
writable: true,
value: "hello world"
};
var _sAcc = {
get: get_sAcc,
set: set_sAcc
};
function method() {}
function sMethod() {}
function acc() {
function get_acc() {
return "";
}
function acc(x) {}
function sAcc() {
function set_acc(x) {}
function get_sAcc() {
return 0;
}
function sAcc(x) {}
function set_sAcc(x) {}

View File

@ -1,16 +1,23 @@
function _checkPrivateRedeclaration(obj, privateCollection) {
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
}
function _classPrivateMethodInit(obj, privateSet) {
_checkPrivateRedeclaration(obj, privateSet), privateSet.add(obj);
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap), privateMap.set(obj, value);
}
var _method = new WeakSet(), _acc = new WeakSet(), _acc = new WeakSet(), A = function() {
var _field = new WeakMap(), _method = new WeakSet(), _acc = new WeakMap(), A = function() {
"use strict";
var obj, privateMap, value;
var obj, privateSet;
!function(instance, Constructor) {
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
}(this, A), obj = this, value = {
}(this, A), _classPrivateFieldInit(this, _field, {
writable: !0,
value: 123
}, _checkPrivateRedeclaration(obj, privateMap = _field), privateMap.set(obj, value), _classPrivateMethodInit(this, _method), _classPrivateMethodInit(this, _acc), _classPrivateMethodInit(this, _acc);
}, _field = new WeakMap();
}), obj = this, _checkPrivateRedeclaration(obj, privateSet = _method), privateSet.add(obj), _classPrivateFieldInit(this, _acc, {
get: get_acc,
set: set_acc
});
};
function get_acc() {
return "";
}
function set_acc(x) {}

View File

@ -3,32 +3,46 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return privateMap.get(receiver).value;
return descriptor.value;
}
function _classApplyDescriptorSet(receiver, descriptor, value) {
if (descriptor.set) {
descriptor.set.call(receiver, value);
} else {
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
}
}
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
function _classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
_classApplyDescriptorSet(receiver, descriptor, value);
return value;
}
function _classPrivateMethodInit(obj, privateSet) {
_checkPrivateRedeclaration(obj, privateSet);
privateSet.add(obj);
}
var _b = new WeakSet(), _c = new WeakSet();
var _a = new WeakMap(), _b = new WeakSet(), _c = new WeakMap();
// @target: es2015
// @importHelpers: true
// @isolatedModules: true
@ -40,13 +54,15 @@ export class C {
value: 1
});
_classPrivateMethodInit(this, _b);
_classPrivateMethodInit(this, _c);
_classPrivateFieldInit(this, _c, {
get: void 0,
set: set_c
});
}
}
var _a = new WeakMap();
function b() {
_classPrivateFieldSet(this, _c, 42);
}
function c(v) {
function set_c(v) {
_classPrivateFieldSet(this, _a, _classPrivateFieldGet(this, _a) + v);
}

View File

@ -1,18 +1,33 @@
function _checkPrivateRedeclaration(obj, privateCollection) {
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
}
function _classPrivateMethodInit(obj, privateSet) {
_checkPrivateRedeclaration(obj, privateSet), privateSet.add(obj);
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to " + action + " private field on non-instance");
return privateMap.get(receiver);
}
var _b = new WeakSet(), _c = new WeakSet();
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap), privateMap.set(obj, value);
}
var _a = new WeakMap(), _b = new WeakSet(), _c = new WeakMap();
export class C {
constructor(){
!function(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap), privateMap.set(obj, value);
}(this, _a, {
_classPrivateFieldInit(this, _a, {
writable: !0,
value: 1
}), _classPrivateMethodInit(this, _b), _classPrivateMethodInit(this, _c);
}), (function(obj, privateSet) {
_checkPrivateRedeclaration(obj, privateSet), privateSet.add(obj);
})(this, _b), _classPrivateFieldInit(this, _c, {
get: void 0,
set: function(v) {
var receiver, privateMap, descriptor, receiver, descriptor, receiver, privateMap, value, descriptor;
receiver = this, privateMap = _a, receiver = this, value = ((descriptor = descriptor = _classExtractFieldDescriptor(receiver, privateMap = _a, "get")).get ? descriptor.get.call(receiver) : descriptor.value) + v, descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"), (function(receiver, descriptor, value) {
if (descriptor.set) descriptor.set.call(receiver, value);
else {
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
descriptor.value = value;
}
})(receiver, descriptor, value);
}
});
}
}
var _a = new WeakMap();

View File

@ -3,37 +3,51 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return descriptor.value;
}
function _classApplyDescriptorSet(receiver, descriptor, value) {
if (descriptor.set) {
descriptor.set.call(receiver, value);
} else {
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
}
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _classPrivateFieldGet(receiver, privateMap) {
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver).value;
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
function _classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
_classApplyDescriptorSet(receiver, descriptor, value);
return value;
}
function _classPrivateMethodInit(obj, privateSet) {
_checkPrivateRedeclaration(obj, privateSet);
privateSet.add(obj);
}
var _b = new WeakSet(), _c = new WeakSet();
var _a = new WeakMap(), _b = new WeakSet(), _c = new WeakMap();
// @target: es2015
// @importHelpers: true
// @isolatedModules: true
@ -46,12 +60,14 @@ export var C = function C() {
value: 1
});
_classPrivateMethodInit(this, _b);
_classPrivateMethodInit(this, _c);
_classPrivateFieldInit(this, _c, {
get: void 0,
set: set_c
});
};
var _a = new WeakMap();
function b() {
_classPrivateFieldSet(this, _c, 42);
}
function c(v) {
function set_c(v) {
_classPrivateFieldSet(this, _a, _classPrivateFieldGet(this, _a) + v);
}

View File

@ -1,18 +1,34 @@
function _checkPrivateRedeclaration(obj, privateCollection) {
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
}
function _classPrivateMethodInit(obj, privateSet) {
_checkPrivateRedeclaration(obj, privateSet), privateSet.add(obj);
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to " + action + " private field on non-instance");
return privateMap.get(receiver);
}
var _b = new WeakSet(), _c = new WeakSet();
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap), privateMap.set(obj, value);
}
var _a = new WeakMap(), _b = new WeakSet(), _c = new WeakMap();
export var C = function() {
"use strict";
var obj, privateMap, value;
var obj, privateSet;
!function(instance, Constructor) {
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
}(this, C), obj = this, value = {
}(this, C), _classPrivateFieldInit(this, _a, {
writable: !0,
value: 1
}, _checkPrivateRedeclaration(obj, privateMap = _a), privateMap.set(obj, value), _classPrivateMethodInit(this, _b), _classPrivateMethodInit(this, _c);
}), obj = this, _checkPrivateRedeclaration(obj, privateSet = _b), privateSet.add(obj), _classPrivateFieldInit(this, _c, {
get: void 0,
set: set_c
});
};
var _a = new WeakMap();
function set_c(v) {
var receiver, privateMap, descriptor, receiver, descriptor, receiver, privateMap, value, descriptor;
receiver = this, privateMap = _a, receiver = this, value = ((descriptor = descriptor = _classExtractFieldDescriptor(receiver, privateMap = _a, "get")).get ? descriptor.get.call(receiver) : descriptor.value) + v, descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"), (function(receiver, descriptor, value) {
if (descriptor.set) descriptor.set.call(receiver, value);
else {
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
descriptor.value = value;
}
})(receiver, descriptor, value);
}

View File

@ -3,16 +3,27 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return privateMap.get(receiver).value;
return descriptor.value;
}
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
var _myField = new WeakMap();
// @target: es2015
class A {
constructor(){
@ -23,4 +34,3 @@ class A {
console.log(_classPrivateFieldGet(this, _myField));
}
}
var _myField = new WeakMap();

View File

@ -3,21 +3,32 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return descriptor.value;
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _classPrivateFieldGet(receiver, privateMap) {
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver).value;
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
var _myField = new WeakMap();
var A = function A() {
"use strict";
_classCallCheck(this, A);
@ -27,4 +38,3 @@ var A = function A() {
});
console.log(_classPrivateFieldGet(this, _myField));
};
var _myField = new WeakMap();

View File

@ -1,6 +1,6 @@
var A = function() {
var _myField = new WeakMap(), A = function() {
"use strict";
var obj, privateMap, value;
var obj, privateMap, value, receiver, privateMap, descriptor, receiver, descriptor;
!function(instance, Constructor) {
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
}(this, A), obj = this, value = {
@ -8,8 +8,8 @@ var A = function() {
value: "hello world"
}, (function(obj, privateCollection) {
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
})(obj, privateMap = _myField), privateMap.set(obj, value), console.log(function(receiver, privateMap) {
})(obj, privateMap = _myField), privateMap.set(obj, value), console.log((receiver = this, (descriptor = descriptor = function(receiver, privateMap, action) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
return privateMap.get(receiver).value;
}(this, _myField));
}, _myField = new WeakMap();
return privateMap.get(receiver);
}(receiver, privateMap = _myField, "get")).get ? descriptor.get.call(receiver) : descriptor.value));
};

View File

@ -3,27 +3,42 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return privateMap.get(receiver).value;
return descriptor.value;
}
function _classApplyDescriptorSet(receiver, descriptor, value) {
if (descriptor.set) {
descriptor.set.call(receiver, value);
} else {
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
}
}
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
function _classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
_classApplyDescriptorSet(receiver, descriptor, value);
return value;
}
var _field = new WeakMap();
// @target: es2015
class A {
static getInstance() {
@ -63,4 +78,3 @@ class A {
_classPrivateFieldSet(_ref11 = A.getInstance(), _field, _classPrivateFieldGet(_ref11, _field) ^ 13);
}
}
var _field = new WeakMap();

View File

@ -1,13 +1,22 @@
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to " + action + " private field on non-instance");
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
return privateMap.get(receiver).value;
var receiver, descriptor, descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return descriptor.get ? descriptor.get.call(receiver) : descriptor.value;
}
function _classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to set private field on non-instance");
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
return descriptor.value = value, value;
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
return !function(receiver, descriptor, value) {
if (descriptor.set) descriptor.set.call(receiver, value);
else {
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
descriptor.value = value;
}
}(receiver, descriptor, value), value;
}
var _field = new WeakMap();
class A {
static getInstance() {
return new A();
@ -24,4 +33,3 @@ class A {
}), _classPrivateFieldSet(this, _field, 1), _classPrivateFieldSet(this, _field, _classPrivateFieldGet(this, _field) + 2), _classPrivateFieldSet(this, _field, _classPrivateFieldGet(this, _field) - 3), _classPrivateFieldSet(this, _field, _classPrivateFieldGet(this, _field) / 4), _classPrivateFieldSet(this, _field, 5 * _classPrivateFieldGet(this, _field)), _classPrivateFieldSet(this, _field, Math.pow(_classPrivateFieldGet(this, _field), 6)), _classPrivateFieldSet(this, _field, _classPrivateFieldGet(this, _field) % 7), _classPrivateFieldSet(this, _field, _classPrivateFieldGet(this, _field) << 8), _classPrivateFieldSet(this, _field, _classPrivateFieldGet(this, _field) >> 9), _classPrivateFieldSet(this, _field, _classPrivateFieldGet(this, _field) >>> 10), _classPrivateFieldSet(this, _field, 11 & _classPrivateFieldGet(this, _field)), _classPrivateFieldSet(this, _field, 12 | _classPrivateFieldGet(this, _field)), _classPrivateFieldSet(this, _field, 13 ^ _classPrivateFieldGet(this, _field)), _classPrivateFieldSet(A.getInstance(), _field, 1), _classPrivateFieldSet(_ref = A.getInstance(), _field, _classPrivateFieldGet(_ref, _field) + 2), _classPrivateFieldSet(_ref1 = A.getInstance(), _field, _classPrivateFieldGet(_ref1, _field) - 3), _classPrivateFieldSet(_ref2 = A.getInstance(), _field, _classPrivateFieldGet(_ref2, _field) / 4), _classPrivateFieldSet(_ref3 = A.getInstance(), _field, 5 * _classPrivateFieldGet(_ref3, _field)), _classPrivateFieldSet(_ref4 = A.getInstance(), _field, Math.pow(_classPrivateFieldGet(_ref4, _field), 6)), _classPrivateFieldSet(_ref5 = A.getInstance(), _field, _classPrivateFieldGet(_ref5, _field) % 7), _classPrivateFieldSet(_ref6 = A.getInstance(), _field, _classPrivateFieldGet(_ref6, _field) << 8), _classPrivateFieldSet(_ref7 = A.getInstance(), _field, _classPrivateFieldGet(_ref7, _field) >> 9), _classPrivateFieldSet(_ref8 = A.getInstance(), _field, _classPrivateFieldGet(_ref8, _field) >>> 10), _classPrivateFieldSet(_ref9 = A.getInstance(), _field, 11 & _classPrivateFieldGet(_ref9, _field)), _classPrivateFieldSet(_ref10 = A.getInstance(), _field, 12 | _classPrivateFieldGet(_ref10, _field)), _classPrivateFieldSet(_ref11 = A.getInstance(), _field, 13 ^ _classPrivateFieldGet(_ref11, _field));
}
}
var _field = new WeakMap();

View File

@ -3,30 +3,44 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return descriptor.value;
}
function _classApplyDescriptorSet(receiver, descriptor, value) {
if (descriptor.set) {
descriptor.set.call(receiver, value);
} else {
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
}
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _classPrivateFieldGet(receiver, privateMap) {
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver).value;
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
function _classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) {
throw new TypeError("attempted to set read only private field");
}
descriptor.value = value;
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
_classApplyDescriptorSet(receiver, descriptor, value);
return value;
}
function _defineProperties(target, props) {
@ -43,6 +57,7 @@ function _createClass(Constructor, protoProps, staticProps) {
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
var _field = new WeakMap();
var A = // @target: es2015
/*#__PURE__*/ function() {
"use strict";
@ -90,4 +105,3 @@ var A = // @target: es2015
]);
return A;
}();
var _field = new WeakMap();

View File

@ -1,12 +1,20 @@
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to " + action + " private field on non-instance");
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
return privateMap.get(receiver).value;
var receiver, descriptor, descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return descriptor.get ? descriptor.get.call(receiver) : descriptor.value;
}
function _classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) throw new TypeError("attempted to set private field on non-instance");
var descriptor = privateMap.get(receiver);
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
return descriptor.value = value, value;
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
return !function(receiver, descriptor, value) {
if (descriptor.set) descriptor.set.call(receiver, value);
else {
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
descriptor.value = value;
}
}(receiver, descriptor, value), value;
}
function _defineProperties(target, props) {
for(var i = 0; i < props.length; i++){
@ -14,7 +22,7 @@ function _defineProperties(target, props) {
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
}
var A = function() {
var _field = new WeakMap(), A = function() {
"use strict";
var Constructor, protoProps, staticProps;
function A() {
@ -36,4 +44,4 @@ var A = function() {
}
}
], protoProps && _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), A;
}(), _field = new WeakMap();
}();

View File

@ -3,16 +3,27 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
function _classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
function _classApplyDescriptorGet(receiver, descriptor) {
if (descriptor.get) {
return descriptor.get.call(receiver);
}
return privateMap.get(receiver).value;
return descriptor.value;
}
function _classExtractFieldDescriptor(receiver, privateMap, action) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to " + action + " private field on non-instance");
}
return privateMap.get(receiver);
}
function _classPrivateFieldGet(receiver, privateMap) {
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
return _classApplyDescriptorGet(receiver, descriptor);
}
function _classPrivateFieldInit(obj, privateMap, value) {
_checkPrivateRedeclaration(obj, privateMap);
privateMap.set(obj, value);
}
var _fieldFunc = new WeakMap(), _fieldFunc2 = new WeakMap();
// @target: es2015
class A {
test() {
@ -49,5 +60,3 @@ class A {
this.x = 1;
}
}
var _fieldFunc = new WeakMap();
var _fieldFunc2 = new WeakMap();

Some files were not shown because too many files have changed in this diff Show More