Skip to content

Commit

Permalink
fix: include method definitions in class private fields (#14365)
Browse files Browse the repository at this point in the history
* fix: include method definitions in class private fields

* Update packages/svelte/tests/runtime-runes/samples/class-disabinguate-private-method-definition/_config.js

---------

Co-authored-by: Rich Harris <[email protected]>
  • Loading branch information
paoloricciuti and Rich-Harris authored Nov 19, 2024
1 parent ce47131 commit 32a1453
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/unlucky-icons-sit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

fix: include method definitions in class private fields
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function ClassBody(node, context) {

for (const definition of node.body) {
if (
definition.type === 'PropertyDefinition' &&
(definition.type === 'PropertyDefinition' || definition.type === 'MethodDefinition') &&
(definition.key.type === 'Identifier' ||
definition.key.type === 'PrivateIdentifier' ||
definition.key.type === 'Literal')
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { test } from '../../test';

export default test({});
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<script>
class Repo {
tree = $state();
async #tree() {
}
}
const repo = new Repo();
</script>

0 comments on commit 32a1453

Please sign in to comment.