proper feature call isLoose function #9424
This commit is contained in:
parent
ff04d3535c
commit
3aaafae053
@ -54,9 +54,7 @@ export function createClassFeaturePlugin({
|
|||||||
|
|
||||||
verifyUsedFeatures(path, this.file);
|
verifyUsedFeatures(path, this.file);
|
||||||
|
|
||||||
// Only fields are currently supported, this needs to be moved somewhere
|
const loose = isLoose(this.file, feature);
|
||||||
// else when other features are added.
|
|
||||||
const loose = isLoose(this.file, FEATURES.fields);
|
|
||||||
|
|
||||||
let constructor;
|
let constructor;
|
||||||
let isDecorated = hasOwnDecorators(path.node);
|
let isDecorated = hasOwnDecorators(path.node);
|
||||||
|
|||||||
@ -0,0 +1,5 @@
|
|||||||
|
class X {
|
||||||
|
#privateMethod() {
|
||||||
|
return 42;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"plugins": [
|
||||||
|
["proposal-private-methods", { "loose": false }]
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
class X {
|
||||||
|
constructor() {
|
||||||
|
_privateMethod.add(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
var _privateMethod = new WeakSet();
|
||||||
|
|
||||||
|
var _privateMethod2 = function _privateMethod2() {
|
||||||
|
return 42;
|
||||||
|
};
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
class X {
|
||||||
|
#privateMethod() {
|
||||||
|
return 42;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"plugins": [
|
||||||
|
["proposal-private-methods", { "loose": true }]
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
var id = 0;
|
||||||
|
|
||||||
|
function _classPrivateFieldLooseKey(name) { return "__private_" + id++ + "_" + name; }
|
||||||
|
|
||||||
|
class X {
|
||||||
|
constructor() {
|
||||||
|
Object.defineProperty(this, _privateMethod, {
|
||||||
|
value: _privateMethod2
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
var _privateMethod = _classPrivateFieldLooseKey("privateMethod");
|
||||||
|
|
||||||
|
var _privateMethod2 = function _privateMethod2() {
|
||||||
|
return 42;
|
||||||
|
};
|
||||||
Loading…
x
Reference in New Issue
Block a user