Override mapping from generated function name to attribute#8958
Override mapping from generated function name to attribute#8958
Conversation
orizi
left a comment
There was a problem hiding this comment.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @Arcticae)
crates/cairo-lang-starknet/src/plugin/entry_point.rs line 210 at r1 (raw file):
.mapped(db, &trigger_attribute), ); }
Suggestion:
let function_name = RewriteNode::from_ast_trimmed(&name_node);
let wrapper_function_name = format!("{WRAPPER_PREFIX}{wrapper_identifier}");
match generate_entry_point_wrapper(
db,
item_function,
wrapped_function_path,
RewriteNode::text(&wrapper_function_name),
generic_params,
unsafe_new_contract_state_prefix,
) {
Ok(generated_function) => {
data.generated_wrapper_functions
.push(generated_function.mapped(db, &trigger_attribute));
data.generated_wrapper_functions.push(RewriteNode::text("\n"));
let generated = match entry_point_kind {
EntryPointKind::Constructor => &mut data.constructor_functions,
EntryPointKind::L1Handler => {
validate_l1_handler_second_parameter(db, ¶ms, diagnostics);
&mut data.l1_handler_functions
}
EntryPointKind::External => &mut data.external_functions,
};
generated.push(
RewriteNode::Text(format!(
"\n pub use super::{wrapper_function_name} as {function_name};"
))
.mapped(db, &trigger_attribute),
);
}16f86f9 to
09e4efe
Compare
orizi
left a comment
There was a problem hiding this comment.
@orizi reviewed all commit messages.
Reviewable status: 0 of 1 files reviewed, 3 unresolved discussions (waiting on @Arcticae)
crates/cairo-lang-starknet/src/plugin/entry_point.rs line 175 at r2 (raw file):
} let wrapper_function_name = &format!("{WRAPPER_PREFIX}{}", wrapper_identifier);
Suggestion:
let wrapper_function_name = &format!("{WRAPPER_PREFIX}{wrapper_identifier}");crates/cairo-lang-starknet/src/plugin/entry_point.rs line 196 at r2 (raw file):
EntryPointKind::External => &mut data.external_functions, }; let function_name = name_node.as_syntax_node().get_text_without_trivia(db).to_string(db);
Suggestion:
let function_name = name_node.text(db).long(db);09e4efe to
865d23e
Compare
orizi
left a comment
There was a problem hiding this comment.
@orizi reviewed 1 of 1 files at r3, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @Arcticae)
865d23e to
91ec4ec
Compare
orizi
left a comment
There was a problem hiding this comment.
@orizi reviewed 1 of 1 files at r4, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @Arcticae)
91ec4ec to
ffe1b3d
Compare
ffe1b3d to
7e6ef4b
Compare
orizi
left a comment
There was a problem hiding this comment.
@orizi reviewed 1 of 1 files at r5, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @Arcticae)
Semantically it's not the same function, therefore it should not be mapped back to the original function's name