Skip to content

Commit

Permalink
Made a clearer python print for param assignment. (#6636)
Browse files Browse the repository at this point in the history
  • Loading branch information
orizi authored Nov 12, 2024
1 parent 0fcdfdf commit 3874879
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
9 changes: 7 additions & 2 deletions crates/cairo-lang-casm/src/hints/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,9 @@ impl PythonicHint for StarknetHint {
ResOperandAsAddressFormatter(system)
)
}
StarknetHint::Cheatcode { .. } => "raise NotImplementedError".to_string(),
StarknetHint::Cheatcode { .. } => {
r#"raise NotImplementedError("Cheatcode")"#.to_string()
}
}
}
}
Expand All @@ -844,7 +846,10 @@ impl PythonicHint for ExternalHint {
let [src, dst] = [src, dst].map(ResOperandAsAddressFormatter);
format!("memory.add_relocation_rule(src_ptr={src}, dest_ptr={dst})")
}
Self::WriteRunParam { .. } => "raise NotImplementedError".to_string(),
Self::WriteRunParam { index, dst } => {
let index = ResOperandAsIntegerFormatter(index);
format!(r#"raise NotImplementedError("memory{dst}.. = params[{index}])")"#)
}
}
}
}
10 changes: 5 additions & 5 deletions crates/cairo-lang-runnable/src/compile_test_data/basic
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ fn main(a: felt252, b: felt252) -> felt252 {
# builtins:
# header #
ap += 0;
%{ raise NotImplementedError %}
%{ raise NotImplementedError %}
%{ raise NotImplementedError("memory[ap + 0].. = params[0])") %}
%{ raise NotImplementedError("memory[ap + 1].. = params[1])") %}
ap += 2;
call rel 3;
ret;
Expand Down Expand Up @@ -72,9 +72,9 @@ fn fib(a: u128, b: u128, n: u128) -> u128 {
# header #
ap += 0;
[ap + 0] = [fp + -3], ap++;
%{ raise NotImplementedError %}
%{ raise NotImplementedError %}
%{ raise NotImplementedError %}
%{ raise NotImplementedError("memory[ap + 0].. = params[0])") %}
%{ raise NotImplementedError("memory[ap + 1].. = params[1])") %}
%{ raise NotImplementedError("memory[ap + 2].. = params[2])") %}
ap += 3;
call rel 3;
ret;
Expand Down

0 comments on commit 3874879

Please sign in to comment.