Private class methods stage 3 (#8654)
* Add private method syntax support * Add private method spec support * Add private method loose support * Throw error if static private method is used * Add more isStatic & isMethod checks * Remove `writable:false` from private method inits `writable` is false by default. * Add private method func obj equality check * Throw if private accessor is used * Add check for fields === private method loose mode * Throw buildCodeFrameErrors instead of Errors * Move obj destructuring inside for loop * Remove "computed" from ClassPrivateMethod type def
This commit is contained in:
committed by
Justin Ridgewell
parent
6e39b58f8a
commit
0859535b62
25
packages/babel-plugin-proposal-private-methods/src/index.js
Normal file
25
packages/babel-plugin-proposal-private-methods/src/index.js
Normal file
@@ -0,0 +1,25 @@
|
||||
import { declare } from "@babel/helper-plugin-utils";
|
||||
import pluginClassFeatures, {
|
||||
enableFeature,
|
||||
FEATURES,
|
||||
} from "@babel/plugin-class-features";
|
||||
|
||||
export default declare((api, options) => {
|
||||
api.assertVersion(7);
|
||||
|
||||
const { loose } = options;
|
||||
|
||||
return {
|
||||
name: "proposal-private-methods",
|
||||
|
||||
inherits: pluginClassFeatures,
|
||||
|
||||
manipulateOptions(opts, parserOpts) {
|
||||
parserOpts.plugins.push("classPrivateMethods");
|
||||
},
|
||||
|
||||
pre() {
|
||||
enableFeature(this.file, FEATURES.privateMethods, loose);
|
||||
},
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user