move helper templates to a separate namespace
This commit is contained in:
parent
972c621f59
commit
1376f2f18f
@ -58,7 +58,6 @@ export default class File {
|
||||
"defaults",
|
||||
"create-class",
|
||||
"create-decorated-class",
|
||||
"apply-constructor",
|
||||
"tagged-template-literal",
|
||||
"tagged-template-literal-loose",
|
||||
"interop-require",
|
||||
@ -324,7 +323,7 @@ export default class File {
|
||||
var id = t.identifier(t.toIdentifier(name));
|
||||
return t.memberExpression(runtime, id);
|
||||
} else {
|
||||
var ref = util.template(name);
|
||||
var ref = util.template("helper-" + name);
|
||||
ref._compact = true;
|
||||
var uid = this.scope.generateUidIdentifier(name);
|
||||
this.scope.push({
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
(function (Constructor, args) {
|
||||
var instance = Object.create(Constructor.prototype);
|
||||
var result = Constructor.apply(instance, args);
|
||||
return result != null && (typeof result == "object" || typeof result == "function") ? result : instance;
|
||||
});
|
||||
@ -1,30 +0,0 @@
|
||||
(function() {
|
||||
function defineProperties(target, props) {
|
||||
for (var i = 0; i < props.length; i ++) {
|
||||
var descriptor = props[i];
|
||||
|
||||
descriptor.enumerable = false;
|
||||
descriptor.configurable = true;
|
||||
if (descriptor.value) descriptor.writable = true;
|
||||
|
||||
if (descriptor.decorators) {
|
||||
for (var i = 0; i < descriptor.decorators.length; i++) {
|
||||
var decorator = descriptor.decorators[i];
|
||||
if (typeof decorator === "function") {
|
||||
descriptor = decorator(target, descriptor.key, descriptor) || descriptor;
|
||||
} else {
|
||||
throw new TypeError("The decorator for method " + descriptor.key + " is of the invalid type " + typeof decorator);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Object.defineProperty(target, descriptor.key, descriptor);
|
||||
}
|
||||
}
|
||||
|
||||
return function (Constructor, protoProps, staticProps) {
|
||||
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
||||
if (staticProps) defineProperties(Constructor, staticProps);
|
||||
return Constructor;
|
||||
};
|
||||
})()
|
||||
@ -1,10 +1,11 @@
|
||||
(function() {
|
||||
function defineProperties(target, props) {
|
||||
for (var i = 0; i < props.length; i ++) {
|
||||
var prop = props[i];
|
||||
prop.configurable = true;
|
||||
if (prop.value) prop.writable = true;
|
||||
Object.defineProperty(target, prop.key, prop);
|
||||
var descriptor = props[i];
|
||||
descriptor.enumerable = descriptor.enumerable || false;
|
||||
descriptor.configurable = true;
|
||||
if (descriptor.value) descriptor.writable = true;
|
||||
Object.defineProperty(target, descriptor.key, descriptor);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,37 @@
|
||||
(function() {
|
||||
function defineProperties(target, descriptors) {
|
||||
for (var i = 0; i < descriptors.length; i ++) {
|
||||
var descriptor = descriptors[i];
|
||||
var decorators = descriptor.decorators;
|
||||
var key = descriptor.key;
|
||||
|
||||
// don't want to expose these to userland since i know people will rely on them
|
||||
// and think it's spec behaviour
|
||||
delete descriptor.key;
|
||||
delete descriptor.decorators;
|
||||
|
||||
descriptor.enumerable = descriptor.enumerable || false;
|
||||
descriptor.configurable = true;
|
||||
if ("value" in descriptor || descriptor.initializer) descriptor.writable = true;
|
||||
|
||||
if (decorators) {
|
||||
for (var f = 0; f < decorators.length; f++) {
|
||||
var decorator = decorators[f];
|
||||
if (typeof decorator === "function") {
|
||||
descriptor = decorator(target, key, descriptor) || descriptor;
|
||||
} else {
|
||||
throw new TypeError("The decorator for method " + descriptor.key + " is of the invalid type " + typeof decorator);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Object.defineProperty(target, key, descriptor);
|
||||
}
|
||||
}
|
||||
|
||||
return function (Constructor, protoProps, staticProps) {
|
||||
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
||||
if (staticProps) defineProperties(Constructor, staticProps);
|
||||
return Constructor;
|
||||
};
|
||||
})()
|
||||
Loading…
x
Reference in New Issue
Block a user