Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
brockelmore committed Dec 10, 2023
1 parent 81dcbf8 commit 631deae
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions crates/solc-expressions/src/func_call/intrinsic_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ pub trait IntrinsicFuncCaller:
else {
return Err(ExprErr::NoLhs(
loc,
"array[].push(..) was not an array to push to".to_string(),
"array[].push(..) was not an array to push to"
.to_string(),
));
};

Expand Down Expand Up @@ -234,7 +235,8 @@ pub trait IntrinsicFuncCaller:
else {
return Err(ExprErr::NoLhs(
loc,
"array[].push(..) was not an array to push to".to_string(),
"array[].push(..) was not an array to push to"
.to_string(),
));
};
if matches!(array, ExprRet::CtxKilled(_)) {
Expand All @@ -243,8 +245,9 @@ pub trait IntrinsicFuncCaller:
}
analyzer.parse_ctx_expr(&input_exprs[1], ctx)?;
analyzer.apply_to_edges(ctx, loc, &|analyzer, ctx, loc| {
let Some(new_elem) =
ctx.pop_expr_latest(loc, analyzer).into_expr_err(loc)?
let Some(new_elem) = ctx
.pop_expr_latest(loc, analyzer)
.into_expr_err(loc)?
else {
return Err(ExprErr::NoRhs(
loc,
Expand All @@ -259,7 +262,8 @@ pub trait IntrinsicFuncCaller:
}

let arr = array.expect_single().into_expr_err(loc)?;
let arr = ContextVarNode::from(arr).latest_version(analyzer);
let arr =
ContextVarNode::from(arr).latest_version(analyzer);
// get length
let len = analyzer.tmp_length(arr, ctx, loc);

Expand All @@ -270,7 +274,9 @@ pub trait IntrinsicFuncCaller:
ctx,
loc,
ExprRet::Single(arr.latest_version(analyzer).into()),
ExprRet::Single(len_as_idx.latest_version(analyzer).into()),
ExprRet::Single(
len_as_idx.latest_version(analyzer).into(),
),
)?;
let index = ctx
.pop_expr_latest(loc, analyzer)
Expand All @@ -287,18 +293,22 @@ pub trait IntrinsicFuncCaller:
} else {
return Err(ExprErr::InvalidFunctionInput(
*loc,
format!("array[].push(..) expected 0 or 1 inputs, got: {}", input_exprs.len()),
))
format!(
"array[].push(..) expected 0 or 1 inputs, got: {}",
input_exprs.len()
),
));
}


}
"pop" => {
if input_exprs.len() != 1 {
return Err(ExprErr::InvalidFunctionInput(
*loc,
format!("array[].pop() expected 0 inputs, got: {}", input_exprs.len()),
))
format!(
"array[].pop() expected 0 inputs, got: {}",
input_exprs.len()
),
));
}
self.parse_ctx_expr(&input_exprs[0], ctx)?;
self.apply_to_edges(ctx, *loc, &|analyzer, ctx, loc| {
Expand Down

0 comments on commit 631deae

Please sign in to comment.