Skip to content

Commit

Permalink
chore: formatter caching (#1700)
Browse files Browse the repository at this point in the history
* use from_ref and caching for exprs

* fix slice ref and cache display_pse calls

* small fixes to define-map

* cleanup some unused junk

* cache on Aggregator. tweak bench

---------

Co-authored-by: brady.ouren <[email protected]>
  • Loading branch information
tippenein and brady.ouren authored Mar 3, 2025
1 parent 67f4b8f commit 329174e
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 82 deletions.
12 changes: 0 additions & 12 deletions components/clarinet-format/src/formatter/helpers.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use clarity::vm::representations::PreSymbolicExpression;

/// trim but leaves newlines preserved
pub fn t(input: &str) -> &str {
let start = input
Expand All @@ -13,13 +11,3 @@ pub fn t(input: &str) -> &str {

&input[start..end]
}
/// REMOVE: just grabs the 1st and rest from a PSE
pub fn name_and_args(
exprs: &[PreSymbolicExpression],
) -> Option<(&PreSymbolicExpression, &[PreSymbolicExpression])> {
if exprs.len() >= 2 {
Some((&exprs[1], &exprs[2..]))
} else {
None // Return None if there aren't enough items
}
}
Loading

0 comments on commit 329174e

Please sign in to comment.