Skip to content

Conversation

@0xGeorgii
Copy link
Contributor

@0xGeorgii 0xGeorgii commented Jan 13, 2026

Closes #69

@0xGeorgii 0xGeorgii self-assigned this Jan 13, 2026
@Inferara Inferara deleted a comment from codecov bot Jan 13, 2026
- Updated CONTRIBUTING.md for clarity and consistency in test writing guidelines.
- Enhanced error messages in Arena's add_node method for better debugging.
- Added comprehensive tests for the Arena structure, including edge cases and type definitions.
- Expanded tests for the Builder functionality, ensuring proper AST construction from source code.
- Improved coverage for various node types, including structs, functions, and external function definitions.
@codecov
Copy link

codecov bot commented Jan 13, 2026

Codecov Report

❌ Patch coverage is 28.38710% with 111 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
core/ast/src/arena.rs 11.94% 59 Missing ⚠️
core/type-checker/src/type_checker.rs 32.85% 47 Missing ⚠️
core/ast/src/nodes.rs 28.57% 5 Missing ⚠️

📢 Thoughts on this report? Let us know!

@0xGeorgii 0xGeorgii requested a review from Copilot January 13, 2026 07:41
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the source_code field from the Location struct to optimize memory usage and improve performance. The source text is now stored once in SourceFile.source instead of being duplicated in every node's location.

Changes:

  • Removed source: String field from Location struct and made it Copy
  • Added source: String field to SourceFile to store the complete source text
  • Replaced Vec<NodeRoute> with FxHashMap for O(1) parent/child lookups in the Arena
  • Added convenience methods get_node_source() and find_source_file_for_node() to the Arena API

Reviewed changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated no comments.

Show a summary per file
File Description
core/ast/src/nodes.rs Removed source field from Location, added Copy derive, and added source field to SourceFile
core/ast/src/builder.rs Updated to store source in SourceFile instead of each Location
core/ast/src/arena.rs Replaced linear parent lookup with hash map, added source text retrieval methods
core/ast/src/nodes_impl.rs Updated SourceFile::new() to accept source parameter
core/type-checker/src/type_checker.rs Removed .clone() calls on Location (now uses Copy)
core/type-checker/src/errors.rs Removed source field from test location construction
tests/src/ast/nodes.rs Updated tests to remove source parameter, added comprehensive Copy tests
tests/src/ast/builder.rs Added extensive tests for source retrieval and location offsets
tests/src/ast/arena.rs New file with comprehensive tests for Arena parent/child lookup and source retrieval
tests/src/type_checker/type_info_tests.rs Updated dummy_location() to remove source parameter
CONTRIBUTING.md Minor grammar and formatting corrections
CHANGELOG.md New file documenting all changes in the project
core/ast/README.md New comprehensive documentation for the AST crate

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@0xGeorgii 0xGeorgii merged commit 4868d05 into main Jan 13, 2026
4 of 5 checks passed
@0xGeorgii 0xGeorgii deleted the 69-remove-source-code-from-node-location branch January 13, 2026 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove source_code from node Location

2 participants