-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
revert: past two commits #136
Conversation
WalkthroughThe recent update focuses on refining the codebase by enhancing enum usage, streamlining Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
I see, I can indeed reproduce it locally too now. Was it the eager lists after all? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Status
Configuration used: CodeRabbit UI
Files selected for processing (11)
- crates/core/src/binding.rs (9 hunks)
- crates/core/src/pattern/after.rs (2 hunks)
- crates/core/src/pattern/ast_node.rs (3 hunks)
- crates/core/src/pattern/before.rs (2 hunks)
- crates/core/src/pattern/built_in_functions.rs (4 hunks)
- crates/core/src/pattern/contains.rs (2 hunks)
- crates/core/src/pattern/list_index.rs (3 hunks)
- crates/core/src/pattern/or.rs (1 hunks)
- crates/core/src/pattern/regex.rs (2 hunks)
- crates/core/src/pattern/resolved_pattern.rs (8 hunks)
- crates/core/src/text_unparser.rs (2 hunks)
Files skipped from review due to trivial changes (1)
- crates/core/src/pattern/contains.rs
Additional comments not posted (36)
crates/core/src/text_unparser.rs (2)
1-1
: The removal ofBinding
from the import statement is appropriate given the refactoring within theapply_effects
function to useeffect.binding.as_filename()
instead of directly matching againstBinding::FileName
. This change simplifies the code and reduces unnecessary imports.
49-50
: Refactoring to useeffect.binding.as_filename()
instead of directly matching againstBinding::FileName
improves code readability and extensibility. This encapsulation allows for easier modifications in how filenames are represented within bindings in the future.crates/core/src/pattern/after.rs (1)
63-63
: Simplifying the creation ofResolvedPattern
instances by directly usingResolvedPattern::from_node(next)
enhances code readability and maintainability. This change effectively streamlines the logic for creatingResolvedPattern
instances based on node analysis.crates/core/src/pattern/before.rs (1)
63-63
: Simplifying the creation ofResolvedPattern
instances by directly usingResolvedPattern::from_node(prev)
enhances code readability and maintainability. This change effectively streamlines the logic for creatingResolvedPattern
instances based on node analysis.crates/core/src/pattern/or.rs (1)
77-80
: The changes made to handle node type matching within theexecute
method of theOr
module'sMatcher
implementation introduce a more explicit way of accessing and comparing the node types of binding nodes with pattern nodes. This adjustment likely improves the clarity and correctness of the node type matching logic.crates/core/src/pattern/ast_node.rs (2)
166-166
: The changes made to the handling of list bindings within theASTNode
matcher implementation streamline the execution flow by simplifying the handling of list bindings. This likely improves the efficiency and readability of the code.
181-181
: The changes made to the handling of comment content resolution within theASTNode
matcher implementation streamline the execution flow by simplifying the handling of comment content resolution. This likely improves the efficiency and readability of the code.crates/core/src/pattern/regex.rs (2)
9-9
: The removal of imports forbinding::Binding
andcontext::Context
, and the elimination of the use ofim::vector
are appropriate given the refactoring within the file. These changes contribute to reducing unnecessary imports and dependencies.
203-203
: ReplacingResolvedPattern::Binding
construction withResolvedPattern::from_range
improves clarity and efficiency. This simplification enhances code readability and likely improves performance by avoiding unnecessary wrapping of data structures.crates/core/src/pattern/list_index.rs (2)
131-140
: The modifications to how list items are accessed and processed in theListIndex
implementation improve the efficiency and clarity of the code. These changes simplify the access and processing of list items, making the code more readable and maintainable.
164-173
: The modifications to how list items are accessed and processed in theListIndex
implementation, specifically for mutable access, maintain the improvements in efficiency and clarity. These changes ensure that the code remains readable and maintainable while handling mutable access to list items.crates/core/src/pattern/built_in_functions.rs (3)
1-1
: The simplification ofuse
statements by removing unnecessary imports contributes to making the code more efficient and maintainable. This change aligns with the overall goal of cleaner and more readable code.
369-372
: The revision of logic within thejoin_fn
function to handle bindings and list operations more efficiently improves the performance and readability of the code. This change simplifies the handling of bindings and list operations, making the code more maintainable.
482-486
: The revision of logic within thelength_fn
function to handle bindings and list operations more efficiently improves the performance and readability of the code. This change simplifies the handling of bindings and list operations, making the code more maintainable.crates/core/src/binding.rs (8)
310-312
: The addition of thefrom_constant
method is a good practice for creating instances ofBinding
from aConstant
. It enhances readability and encapsulation.
318-320
: Thefrom_path
method simplifies the creation ofFileName
bindings. This is a positive change for maintainability and readability.
322-324
: Introducing thefrom_range
method for creatingString
bindings from a range and source is a good encapsulation practice, improving code readability.
354-355
: Theget_sexp
method's handling ofNode
andList
bindings to generate S-expressions is correctly implemented. It's a good practice for debugging or serialization purposes.
375-378
: Theposition
method's implementation forNode
bindings correctly returns the range of the node. This is crucial for operations that depend on the position of bindings within the source code.
435-436
: Thefrom_path
method correctly creates aFileName
binding from aPath
. This encapsulation simplifies the creation of file name bindings.
432-439
: > 📝 NOTEThis review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [439-440]
The
from_range
method for creatingString
bindings from a range and source is correctly implemented, enhancing code readability and maintainability.
80-95
: > 📝 NOTEThis review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [881-884]
The
matches_undefined
method correctly identifies if aBinding
orConstant
isUndefined
. This is important for handling cases where the absence of a value needs to be explicitly checked.crates/core/src/pattern/resolved_pattern.rs (14)
60-60
: Thename
method in theFile
enum correctly uses the newfrom_path
method for creating aResolvedPattern
from a file path. This is a good example of utilizing new utility methods to simplify code.
71-73
: Theabsolute_path
method's use offrom_path
for creating aResolvedPattern
from an absolute path is correctly implemented, enhancing code readability.
83-83
: Thebody
method's implementation for creating aResolvedPattern
from a range and source using thefrom_range
method is a good practice, improving code readability.
94-94
: Thebinding
method's use offrom_node
for creating aResolvedPattern
from aNodeWithSource
is correctly implemented, enhancing encapsulation and readability.
108-108
: TheJoinFn
struct'sfrom_resolved
method correctly initializes the struct with a list ofResolvedPattern
and a separator. This simplifies the creation ofJoinFn
instances.
111-115
: Thefrom_list_binding
method in theJoinFn
struct correctly creates aJoinFn
instance from a list binding, enhancing the flexibility of handling list bindings.
127-142
: Thelinearized_text
method in theJoinFn
struct correctly linearizes each pattern in the list and joins them with the specified separator. This is a key functionality for handling join operations on patterns.
420-420
: Thefrom_constant
method inResolvedPattern
correctly utilizes theBinding::from_constant
method for creating aResolvedPattern
from aConstant
. This is a good example of reusing existing functionality to simplify code.
424-424
: Thefrom_node
method inResolvedPattern
correctly utilizes theBinding::from_node
method for creating aResolvedPattern
from aNodeWithSource
. This enhances code readability and maintainability.
428-428
: Thefrom_list
method inResolvedPattern
correctly utilizes theBinding::List
constructor for creating aResolvedPattern
from a list binding. This is a good practice for handling list bindings.
432-433
: Theempty_field
method inResolvedPattern
correctly utilizes theBinding::Empty
constructor for creating aResolvedPattern
from an empty field binding. This is important for handling cases where a field is expected but not present.
435-437
: Thefrom_path
method inResolvedPattern
correctly utilizes theBinding::from_path
method for creating aResolvedPattern
from aPath
. This simplifies the creation of file path bindings.
439-440
: Thefrom_range
method inResolvedPattern
correctly utilizes theBinding::from_range
method for creating aResolvedPattern
from a range and source. This is a good practice for handling string bindings.
881-884
: Thematches_undefined
method correctly identifies if aResolvedPattern
matches an undefined constant. This is crucial for handling cases where the absence of a value needs to be explicitly checked.
|
last two commits:
#132
#133
broke:
Summary by CodeRabbit
Binding
instances across various modules.ResolvedPattern
creation inAfter
andBefore
implementations for improved logic flow.Matcher
implementations.apply_effects
function for better readability and potential extensibility.