Skip to content

Commit dc0d53e

Browse files
fubhyAndarist
andauthored
Add support for pure annotations in class nodes' children (#14)
* add support for pure annotations class expressions * Update src/index.js Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com> * tweak tests --------- Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
1 parent dd186e2 commit dc0d53e

File tree

5 files changed

+30
-1
lines changed

5 files changed

+30
-1
lines changed

src/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ const isInAssignmentContext = path => {
6363

6464
if (
6565
parentPath.isVariableDeclaration() ||
66-
parentPath.isAssignmentExpression()
66+
parentPath.isAssignmentExpression() ||
67+
parentPath.isClass()
6768
) {
6869
return true
6970
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const base = bar =>
2+
class {
3+
foo() {
4+
return bar
5+
}
6+
}
7+
8+
class MyClass extends base() {}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const base = bar => class {
2+
foo() {
3+
return bar;
4+
}
5+
};
6+
class MyClass extends /*#__PURE__*/base() {}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const base = bar =>
2+
class {
3+
foo() {
4+
return bar
5+
}
6+
}
7+
8+
const MyClass = class extends base() {}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const base = bar => class {
2+
foo() {
3+
return bar;
4+
}
5+
};
6+
const MyClass = class extends /*#__PURE__*/base() {};

0 commit comments

Comments
 (0)