Commit 1710f56
committed
fix(codegen): remove double indentation for enum inside namespace (oxc-project#19775)
## Summary
- `TSEnumDeclaration::gen()` called `p.print_indent()`, but the `Statement` handler already calls `print_indent()` before dispatching — causing enums inside namespaces to get double indentation (e.g. 4 spaces instead of 2).
- No other declaration type (`Class`, `TSModuleDeclaration`, `TSInterfaceDeclaration`, `TSTypeAliasDeclaration`) has this issue.
**Before:**
```ts
declare namespace ns {
class Foo {}
enum Bar {}
type Baz = undefined;
}
```
**After:**
```ts
declare namespace ns {
class Foo {}
enum Bar {}
type Baz = undefined;
}
```
## Test plan
- [x] Added `test_same` case for `declare namespace` with class, enum, and type alias
- [x] Verified test fails without the fix, passes with it
- [x] All 92 `oxc_codegen` tests pass
🤖 Generated with [Claude Code](https://claude.com/claude-code)1 parent 805ee60 commit 1710f56
2 files changed
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3825 | 3825 | | |
3826 | 3826 | | |
3827 | 3827 | | |
3828 | | - | |
3829 | 3828 | | |
3830 | 3829 | | |
3831 | 3830 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
36 | 39 | | |
37 | 40 | | |
38 | 41 | | |
| |||
0 commit comments