Skip to content

Commit 7b2c86e

Browse files
committed
chore: ugprade oxc to 0.75
1 parent b174a9b commit 7b2c86e

File tree

5 files changed

+79
-55
lines changed

5 files changed

+79
-55
lines changed

Cargo.lock

Lines changed: 40 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/ts-to-clar/Cargo.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ license = "GPL-3.0"
88
[dependencies]
99
anyhow = "1.0.98"
1010

11-
oxc_allocator = "0.73"
12-
oxc_ast = { version = "0.73", features = ["serialize"] }
13-
oxc_ast_visit = "0.73"
14-
oxc_parser = "0.73"
15-
oxc_span = "0.73"
16-
oxc_syntax = "0.73"
17-
oxc_traverse = "0.73"
18-
oxc_semantic = "0.73"
11+
oxc_allocator = "0.75"
12+
oxc_ast = { version = "0.75", features = ["serialize"] }
13+
oxc_ast_visit = "0.75"
14+
oxc_parser = "0.75"
15+
oxc_span = "0.75"
16+
oxc_syntax = "0.75"
17+
oxc_traverse = "0.75"
18+
oxc_semantic = "0.75"
1919

2020
clarity = { workspace = true }
2121

components/ts-to-clar/src/clarity_std.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use std::sync::OnceLock;
33

44
pub static STD_PKG_NAME: &str = "@hirosystems/clarity-std";
55

6+
#[allow(dead_code)]
67
pub fn get_std() -> Vec<String> {
78
use NativeFunctions::*;
89

@@ -47,8 +48,9 @@ pub fn get_std() -> Vec<String> {
4748

4849
static STD_FUNCTIONS: OnceLock<Vec<String>> = OnceLock::new();
4950

51+
#[allow(dead_code)]
5052
pub fn get_std_functions() -> &'static Vec<String> {
51-
STD_FUNCTIONS.get_or_init(|| get_std())
53+
STD_FUNCTIONS.get_or_init(get_std)
5254
}
5355

5456
#[cfg(test)]

components/ts-to-clar/src/expression_converter.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::cell::Cell;
1+
use std::{cell::Cell, marker::PhantomData};
22

33
use clarity::vm::{
44
representations::{PreSymbolicExpression, PreSymbolicExpressionType},
@@ -9,7 +9,7 @@ use oxc_allocator::{Allocator, CloneIn};
99
use oxc_ast::ast::{self, Expression};
1010
use oxc_semantic::SemanticBuilder;
1111
use oxc_span::SourceType;
12-
use oxc_traverse::{traverse_mut, Ancestor, Traverse, TraverseCtx};
12+
use oxc_traverse::{traverse_mut, Ancestor, Traverse};
1313

1414
use crate::{
1515
parser::{IRFunction, IR},
@@ -200,7 +200,15 @@ impl<'a> StatementConverter<'a> {
200200
}
201201
}
202202

203-
impl<'a> Traverse<'a> for StatementConverter<'a> {
203+
// introduced in oxc 0.75, not used yet
204+
// could be used to store additional state during traversal
205+
#[derive(Default)]
206+
pub struct ConverterState<'a> {
207+
data: PhantomData<&'a ()>,
208+
}
209+
pub type TraverseCtx<'a> = oxc_traverse::TraverseCtx<'a, ConverterState<'a>>;
210+
211+
impl<'a> Traverse<'a, ConverterState<'a>> for StatementConverter<'a> {
204212
fn enter_program(&mut self, _node: &mut ast::Program<'a>, _ctx: &mut TraverseCtx<'a>) {
205213
// println!("enter_program: {:#?}", _node);
206214
}
@@ -580,7 +588,8 @@ pub fn convert_function_body<'a>(
580588
.into_scoping();
581589

582590
let mut converter = StatementConverter::new(ir, function);
583-
traverse_mut(&mut converter, allocator, &mut program, scoping);
591+
let state = ConverterState::default();
592+
traverse_mut(&mut converter, allocator, &mut program, scoping, state);
584593

585594
if converter.expressions.is_empty() {
586595
return Err(anyhow::anyhow!("No expressions found"));

components/ts-to-clar/src/parser.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
// - define-public
88
// - define-private
99

10+
use std::marker::PhantomData;
11+
1012
use anyhow::{anyhow, Result};
1113
use oxc_allocator::{Allocator, CloneIn};
1214
use oxc_ast::ast::{
@@ -16,7 +18,7 @@ use oxc_ast::ast::{
1618
use oxc_parser::Parser;
1719
use oxc_semantic::SemanticBuilder;
1820
use oxc_span::SourceType;
19-
use oxc_traverse::{traverse_mut, Traverse, TraverseCtx};
21+
use oxc_traverse::{traverse_mut, Traverse};
2022

2123
use clarity::vm::types::TypeSignature;
2224

@@ -115,7 +117,15 @@ fn parse_function_params(
115117
.collect()
116118
}
117119

118-
impl<'a> Traverse<'a> for IR<'a> {
120+
// introduced in oxc 0.75, not used yet
121+
// could be used to store additional state during traversal
122+
#[derive(Default)]
123+
pub struct ConverterState<'a> {
124+
data: PhantomData<&'a ()>,
125+
}
126+
pub type TraverseCtx<'a> = oxc_traverse::TraverseCtx<'a, ConverterState<'a>>;
127+
128+
impl<'a> Traverse<'a, ConverterState<'a>> for IR<'a> {
119129
fn enter_import_declaration(
120130
&mut self,
121131
node: &mut ast::ImportDeclaration<'a>,
@@ -324,7 +334,9 @@ pub fn get_ir<'a>(allocator: &'a Allocator, file_name: &str, source: &'a str) ->
324334
.build(&module)
325335
.semantic
326336
.into_scoping();
327-
traverse_mut(&mut ir, allocator, &mut module, scoping);
337+
338+
let state = ConverterState::default();
339+
traverse_mut(&mut ir, allocator, &mut module, scoping, state);
328340

329341
ir
330342
}

0 commit comments

Comments
 (0)