Skip empty decorator lists

This commit is contained in:
proteriax 2021-07-22 10:51:22 -04:00
parent 904229a885
commit a2bbbd99ad

View File

@ -62,7 +62,7 @@ export default ({ types: t }: typeof babel): babel.PluginObj<State> => ({
for (const child of path.node.body.body) {
switch (child.type) {
case "ClassProperty":
if (!child.decorators) continue
if (!child.decorators) break
modifiers.push(
t.callExpression(state.__decorate(), [
t.arrayExpression(child.decorators.map(d => d.expression)),
@ -112,6 +112,8 @@ export default ({ types: t }: typeof babel): babel.PluginObj<State> => ({
key = child.key
}
if (!list.length) break
modifiers.push(
t.callExpression(state.__decorate(), [
t.arrayExpression(list),