add proxies
This commit is contained in:
@@ -85,6 +85,8 @@ export default class File {
|
||||
"default-props"
|
||||
];
|
||||
|
||||
"proxy-create",
|
||||
"proxy-directory"
|
||||
static options = require("./options");
|
||||
|
||||
normalizeOptions(opts: Object) {
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
(function (proxy, directory) {
|
||||
directory.push(proxy);
|
||||
return proxy;
|
||||
})
|
||||
@@ -0,0 +1 @@
|
||||
[];
|
||||
43
src/babel/transformation/transformers/es6/proxies.js
Normal file
43
src/babel/transformation/transformers/es6/proxies.js
Normal file
@@ -0,0 +1,43 @@
|
||||
import * as t from "../../../types";
|
||||
|
||||
export var metadata = {
|
||||
optional: true
|
||||
};
|
||||
|
||||
// foo.bar
|
||||
export function MemberExpression(node) {
|
||||
|
||||
}
|
||||
|
||||
// Object.setPrototypeOf
|
||||
// Object.preventExtensions
|
||||
// Object.keys
|
||||
// Object.isExtensible
|
||||
// Object.getOwnPropertyDescriptor
|
||||
// Object.defineProperty
|
||||
export function CallExpression(node) {
|
||||
|
||||
}
|
||||
|
||||
// delete foo.bar
|
||||
export function UnaryExpression(node) {
|
||||
|
||||
}
|
||||
|
||||
// foo in bar
|
||||
export function BinaryExpression(node) {
|
||||
|
||||
}
|
||||
|
||||
export function AssignmentExpression(node) {
|
||||
|
||||
}
|
||||
|
||||
// new Proxy
|
||||
export function NewExpression(node, parent, scope, file) {
|
||||
if (this.get("callee").isIdentifier({ name: "Proxy" })) {
|
||||
return t.callExpression(file.addHelper("proxy-create"), [node.arguments[0], file.addHelper("proxy-directory")]);
|
||||
} else {
|
||||
// possible proxy constructor
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ export default {
|
||||
"es7.classProperties": require("./es7/class-properties"),
|
||||
"es7.asyncFunctions": require("./es7/async-functions"),
|
||||
"es7.decorators": require("./es7/decorators"),
|
||||
"es6.proxies": require("./es6/proxies"),
|
||||
|
||||
strict: require("./other/strict"),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user