@@ -205,25 +205,6 @@ fn make_ast(
205205 Ok ( ast)
206206}
207207
208- /// somewhat of a passthrough since we don't have to build the whole context we
209- /// can jsut return the cost of the single expression
210- fn static_cost_native (
211- source : & str ,
212- cost_map : & HashMap < String , Option < StaticCost > > ,
213- clarity_version : & ClarityVersion ,
214- ) -> Result < StaticCost , String > {
215- let epoch = StacksEpochId :: latest ( ) ; // XXX this should be matched with the clarity version
216- let ast = make_ast ( source, epoch, clarity_version) ?;
217- let exprs = & ast. expressions ;
218- let user_args = UserArgumentsContext :: new ( ) ;
219- let expr = & exprs[ 0 ] ;
220- let ( _, cost_analysis_tree) =
221- build_cost_analysis_tree ( & expr, & user_args, cost_map, clarity_version) ?;
222-
223- let summing_cost = calculate_total_cost_with_branching ( & cost_analysis_tree) ;
224- Ok ( summing_cost. into ( ) )
225- }
226-
227208/// STatic execution cost for functions within Environment
228209/// returns the top level cost for specific functions
229210/// {function_name: cost}
@@ -604,7 +585,17 @@ mod tests {
604585 clarity_version : & ClarityVersion ,
605586 ) -> Result < StaticCost , String > {
606587 let cost_map: HashMap < String , Option < StaticCost > > = HashMap :: new ( ) ;
607- static_cost_native ( source, & cost_map, clarity_version)
588+
589+ let epoch = StacksEpochId :: latest ( ) ; // XXX this should be matched with the clarity version
590+ let ast = make_ast ( source, epoch, clarity_version) ?;
591+ let exprs = & ast. expressions ;
592+ let user_args = UserArgumentsContext :: new ( ) ;
593+ let expr = & exprs[ 0 ] ;
594+ let ( _, cost_analysis_tree) =
595+ build_cost_analysis_tree ( & expr, & user_args, & cost_map, clarity_version) ?;
596+
597+ let summing_cost = calculate_total_cost_with_branching ( & cost_analysis_tree) ;
598+ Ok ( summing_cost. into ( ) )
608599 }
609600
610601 fn static_cost_test (
0 commit comments