refactor: unify Diagnostic type + reserved word validation#196
Merged
Conversation
…ord validation - Create src/diagnostic.zig with unified Diagnostic type (span, message, found, related_span, related_label, hint, kind) - Replace ParseError in parser with Diagnostic (kind=.parse) - Replace SemanticError in semantic analyzer/checker with Diagnostic (kind=.semantic) - Add semantic error display in CLI with code frames (error[semantic] label) - Strengthen escaped keyword validation: checkStrictBinding handles escaped eval/arguments, checkIdentifierEscapedKeyword validates strict reserved in strict mode, checkKeywordBinding handles escaped_keyword/escaped_strict_reserved tokens - Add unit tests for Diagnostic kind and reserved word edge cases Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove duplicate doc comment on errors field - Merge identical error branches in checkIdentifierEscapedKeyword - Prevent double error in checkKeywordBinding escaped_strict_reserved branch - Pass is_strict_mode/is_module to SemanticAnalyzer in CLI - Stop transformation when parser or semantic errors exist Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…antic tests - Fix transformer jsx_element/jsx_opening_element routing: .extra format, not .list - Add visitJSXElement (handles self-closing 3-field and with-children 5-field) - Add visitJSXOpeningElement - Enable 3 previously disabled JSX codegen E2E tests - Capitalize all parser error messages consistently (oxc/TypeScript style) - ~70 messages across 8 parser files standardized to sentence case - Extract dupeJsonString/mergeOptionalString helpers in config.zig - 7 repeated string option patterns → helper function calls - Fix extends inheritance bug (JSON keys override merged base values) - Add 4 semantic analyzer unit tests (Diagnostic kind, message content, valid code) - Update CLAUDE.md: Test262 100%, Phase 2 items ✅ Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Detect @license/@preserve in single-line comments (was only multi-line) - Add 5 legal comment unit tests (multi-line @license//*!, single-line @license/@preserve, normal) - Replace silent catch {} on sourcemap init with error message output - Document @Panic("OOM") cleanup plan in CLAUDE.md (44 instances, resolve with Arena) - Mark legal comments ✅ in CLAUDE.md Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- JSX parser: always store 5 extra fields (children_len=0 for self-closing) - Eliminates fragile heuristic in transformer and codegen - Codegen reads children_start/children_len directly - Extract isLegalComment() helper in scanner (removes duplication) - visitJSXOpeningElement delegates to shared visitJSXExtraNode helper - checkYieldAwaitUse returns bool instead of void (removes err_count trick) - Fix 'Import.meta' error messages to use lowercase 'import.meta' Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Extract checkRestParameterLast() in parser — replaces 5 identical spread_element + comma check patterns across declaration.zig/object.zig - Fix "Delete of an identifier" → "Deleting an identifier" (natural English) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ParseError와SemanticError를 공통Diagnostic타입으로 통합 (src/diagnostic.zig)error[semantic]:라벨).list로 읽던 문제 →.extra전용 visit 함수 + 항상 5-field encodingdupeJsonString/mergeOptionalString헬퍼// @license/// @preserve감지 추가 +isLegalComment헬퍼 추출checkRestParameterLast()헬퍼void→bool반환으로 err_count 트릭 제거Test plan
zig build test전체 통과zig build test262전체 통과 (100% 유지)/simplify리뷰 2회 완료🤖 Generated with Claude Code