flow-control: Support lowering of EqualsLiteral node.#8131
Conversation
|
Suggestion: /// Lowers a semantic expression that is a literal, possibly including a negation.
fn lower_expr_literal<'db>(
ctx: &mut LoweringContext<'db, '_>,
expr: &semantic::ExprLiteral<'db>,
builder: &mut BlockBuilder<'db>,
) -> LoweringResult<'db, LoweredExpr<'db>> {
log::trace!("Lowering a literal: {:?}", expr.debug(&ctx.expr_formatter));
Ok(LoweredExpr::AtVariable(lower_expr_literal_helper(
ctx,
expr.stable_ptr.untyped(),
expr.ty,
&expr.value,
builder,
)))
}
fn lower_expr_literal_to_var_usage<'db>( |
|
What is Suggestion: a literal |
|
Why can't the literal be u32? Code quote: felt252_ty, |
53db34c to
c8098e7
Compare
5c2ee32 to
dd9f730
Compare
c8098e7 to
76e2a8d
Compare
dd9f730 to
0222f09
Compare
76e2a8d to
ee5c1b2
Compare
0222f09 to
1792553
Compare
liorgold2
left a comment
There was a problem hiding this comment.
Reviewable status: 0 of 5 files reviewed, 3 unresolved discussions (waiting on @ilyalesokhin-starkware)
crates/cairo-lang-lowering/src/lower/flow_control/graph.rs line 118 at r1 (raw file):
Previously, ilyalesokhin-starkware wrote…
What is
the literal?
It's the literal, as this struct is about comparing to a specific literal (this is the pub literal: usize member).
BTW (same for "the input value")
crates/cairo-lang-lowering/src/lower/flow_control/lower_graph/lower_node.rs line 188 at r1 (raw file):
Previously, ilyalesokhin-starkware wrote…
Why can't the literal be u32?
For now, I've copied the current implementation, which always converts to felt252 before the comparisons. (Also, I'm only supporting felt252, since I'm not actually doing the conversion).
There's the following TODO:
// TODO(TomerStarkware): Use the same type of literal as the input, without the cast to
// felt252.
which we should consider doing (I don't know what are the implications of doing it)
crates/cairo-lang-lowering/src/lower/mod.rs line 950 at r1 (raw file):
/// Lowers a semantic expression that is a literal, possibly including a negation. fn lower_expr_literal_helper<'db>(
Done.
ee5c1b2 to
cfbc537
Compare
ilyalesokhin-starkware
left a comment
There was a problem hiding this comment.
Reviewed 2 of 5 files at r1, 3 of 3 files at r2, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @liorgold2)
ilyalesokhin-starkware
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! all files reviewed, all discussions resolved (waiting on @liorgold2)
commit-id:08269923
cfbc537 to
9c6d653
Compare
Stack: