Skip to content

refactor(parser): split Context from u32 to u8#170

Merged
ohah merged 2 commits intofeature/context-move-unused-flagsfrom
feature/context-u8-split
Mar 20, 2026
Merged

refactor(parser): split Context from u32 to u8#170
ohah merged 2 commits intofeature/context-move-unused-flagsfrom
feature/context-u8-split

Conversation

@ohah
Copy link
Copy Markdown
Owner

@ohah ohah commented Mar 20, 2026

Summary

  • Context를 packed struct(u32)packed struct(u8)로 축소 (문법 파라미터 8개만)
  • 11개 상태 플래그를 Parser struct 개별 필드로 이동
  • SavedState struct + enterFunctionContext/restoreFunctionContext 패턴 도입
  • 50+ 개소 self.ctx.Xself.X 참조 수정

Test plan

  • zig build test 통과
  • zig build 빌드 통과
  • zig build test262-run 98.0% (470건) — regression 없음

🤖 Generated with Claude Code

Context를 packed struct(u32) → packed struct(u8)로 축소.
ECMAScript 문법 파라미터 8개만 Context에 유지:
  allow_in, in_generator, in_async, in_function,
  is_top_level, in_decorator, in_ambient, disallow_conditional_types

나머지 11개 플래그를 Parser struct 개별 필드로 이동:
  is_strict_mode, in_loop, in_switch, has_simple_params,
  for_loop_init, in_class, in_class_field, in_static_block,
  has_super_class, allow_super_call, allow_super_property

SavedState struct 추가: 함수 진입 시 Context + Parser 필드를 함께
save/restore. enterFunctionContext/restoreFunctionContext 패턴.

Test262 98.0% (470건 실패) — regression 없음.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ohah ohah added the enhancement New feature or request label Mar 20, 2026
@ohah ohah self-assigned this Mar 20, 2026
@ohah ohah added the enhancement New feature or request label Mar 20, 2026
- SavedState에 for_loop_init 추가 + 함수 경계에서 리셋
  (중첩 함수가 외부 for_loop_init을 상속하는 버그 방지)
- enterFunctionContext에서 has_simple_params를 true로 리셋
  (다른 필드와 일관성 유지, 기본값 보장)
- 미사용 in_static_block 필드 제거
- parseSwitchStatement에서 restoreContext 헬퍼 사용으로 일관성 확보

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ohah ohah merged commit 999c6ac into feature/context-move-unused-flags Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant