Skip to content

Commit

Permalink
Rename variables for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
evahop committed Jul 11, 2023
1 parent 5a0c47e commit d457e99
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/front/spv/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,6 @@ impl<I: Iterator<Item = u32>> super::Frontend<I> {
) -> Result<(), Error> {
let start = self.data_offset;
let result_type_id = self.next()?;
let result_type = self.lookup_type.lookup(result_type_id)?.handle;
let result_id = self.next()?;
let image_id = self.next()?;
let level = if at_level {
Expand All @@ -686,9 +685,11 @@ impl<I: Iterator<Item = u32>> super::Frontend<I> {
image: image_lexp.handle,
query: crate::ImageQuery::Size { level },
};
let expr = if let Some(crate::ScalarKind::Sint) =
ctx.type_arena[result_type].inner.scalar_kind()
{

let result_type_handle = self.lookup_type.lookup(result_type_id)?.handle;
let maybe_scalar_kind = ctx.type_arena[result_type_handle].inner.scalar_kind();

let expr = if let Some(crate::ScalarKind::Sint) = maybe_scalar_kind {
crate::Expression::As {
expr: ctx.expressions.append(expr, self.span_from_with_op(start)),
kind: crate::ScalarKind::Sint,
Expand All @@ -697,6 +698,7 @@ impl<I: Iterator<Item = u32>> super::Frontend<I> {
} else {
expr
};

self.lookup_expression.insert(
result_id,
LookupExpression {
Expand All @@ -705,6 +707,7 @@ impl<I: Iterator<Item = u32>> super::Frontend<I> {
block_id,
},
);

Ok(())
}

Expand All @@ -716,7 +719,6 @@ impl<I: Iterator<Item = u32>> super::Frontend<I> {
) -> Result<(), Error> {
let start = self.data_offset;
let result_type_id = self.next()?;
let result_type = self.lookup_type.lookup(result_type_id)?.handle;
let result_id = self.next()?;
let image_id = self.next()?;

Expand All @@ -728,9 +730,11 @@ impl<I: Iterator<Item = u32>> super::Frontend<I> {
image: image_lexp.handle,
query,
};
let expr = if let Some(crate::ScalarKind::Sint) =
ctx.type_arena[result_type].inner.scalar_kind()
{

let result_type_handle = self.lookup_type.lookup(result_type_id)?.handle;
let maybe_scalar_kind = ctx.type_arena[result_type_handle].inner.scalar_kind();

let expr = if let Some(crate::ScalarKind::Sint) = maybe_scalar_kind {
crate::Expression::As {
expr: ctx.expressions.append(expr, self.span_from_with_op(start)),
kind: crate::ScalarKind::Sint,
Expand All @@ -739,6 +743,7 @@ impl<I: Iterator<Item = u32>> super::Frontend<I> {
} else {
expr
};

self.lookup_expression.insert(
result_id,
LookupExpression {
Expand All @@ -747,6 +752,7 @@ impl<I: Iterator<Item = u32>> super::Frontend<I> {
block_id,
},
);

Ok(())
}
}

0 comments on commit d457e99

Please sign in to comment.