don't reassign decorated classes - fixes #1167
This commit is contained in:
parent
96506f4249
commit
0ab1362893
@ -181,10 +181,13 @@ class ClassTransformer {
|
||||
if (decorators) {
|
||||
for (var i = 0; i < decorators.length; i++) {
|
||||
var decorator = decorators[i];
|
||||
body.push(util.template("class-decorator", {
|
||||
|
||||
var decoratorNode = util.template("class-decorator", {
|
||||
DECORATOR: decorator.expression,
|
||||
CLASS_REF: classRef
|
||||
}, true));
|
||||
}, true);
|
||||
decoratorNode.expression._ignoreModulesRemap = true;
|
||||
body.push(decoratorNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -11,8 +11,8 @@
|
||||
"CallExpression": ["callee", "arguments"],
|
||||
"CatchClause": ["param", "body"],
|
||||
"ClassBody": ["body"],
|
||||
"ClassDeclaration": ["id", "body", "superClass", "typeParameters", "superTypeParameters", "implements"],
|
||||
"ClassExpression": ["id", "body", "superClass", "typeParameters", "superTypeParameters", "implements"],
|
||||
"ClassDeclaration": ["id", "body", "superClass", "typeParameters", "superTypeParameters", "implements", "decorators"],
|
||||
"ClassExpression": ["id", "body", "superClass", "typeParameters", "superTypeParameters", "implements", "decorators"],
|
||||
"ComprehensionBlock": ["left", "right", "body"],
|
||||
"ComprehensionExpression": ["filter", "blocks", "body"],
|
||||
"ConditionalExpression": ["test", "consequent", "alternate"],
|
||||
@ -40,12 +40,12 @@
|
||||
"LogicalExpression": ["left", "right"],
|
||||
"MemberExpression": ["object", "property"],
|
||||
"MetaProperty": ["meta", "property"],
|
||||
"MethodDefinition": ["key", "value"],
|
||||
"MethodDefinition": ["key", "value", "decorators"],
|
||||
"NewExpression": ["callee", "arguments"],
|
||||
"ObjectExpression": ["properties"],
|
||||
"ObjectPattern": ["properties", "typeAnnotation"],
|
||||
"Program": ["body"],
|
||||
"Property": ["key", "value"],
|
||||
"Property": ["key", "value", "decorators"],
|
||||
"RestElement": ["argument", "typeAnnotation"],
|
||||
"ReturnStatement": ["argument"],
|
||||
"SequenceExpression": ["expressions"],
|
||||
|
||||
@ -0,0 +1,6 @@
|
||||
import foo from "foo";
|
||||
|
||||
@foo
|
||||
export default class Foo {
|
||||
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _foo = require("foo");
|
||||
|
||||
var _foo2 = babelHelpers.interopRequireWildcard(_foo);
|
||||
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
}
|
||||
|
||||
Foo = _foo2["default"](Foo) || Foo;
|
||||
return Foo;
|
||||
})();
|
||||
|
||||
exports["default"] = Foo;
|
||||
module.exports = exports["default"];
|
||||
Loading…
x
Reference in New Issue
Block a user