Skip to content

Commit

Permalink
Merge pull request #1475 from DanielXMoore/auto-private-field
Browse files Browse the repository at this point in the history
Fix automatic private fields from constructor `@args`
  • Loading branch information
edemaine authored Oct 18, 2024
2 parents 6dadd82 + 85ed4ea commit 1e351b5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 0 additions & 1 deletion source/parser/function.civet
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,6 @@ function processParams(f): void
continue if fields.has id
classExpressions.splice index++, 0, [fStatement[0], {
type: "FieldDefinition"
ts: true
id
typeSuffix
children: [id, typeSuffix]
Expand Down
11 changes: 11 additions & 0 deletions test/types/class.civet
Original file line number Diff line number Diff line change
Expand Up @@ -512,3 +512,14 @@ describe "[TS] class", ->
#name: string;#id: number;constructor(name: string, id: number){this.#name = name;this.#id = id;}
}
"""

testCase.js """
private JS
---
class UserAccount
@(#name: string, #id: number)
---
class UserAccount {
#name;#id;constructor(name, id){this.#name = name;this.#id = id;}
}
"""

0 comments on commit 1e351b5

Please sign in to comment.