Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made all generated code have a mapped originating code. #5497

Merged
merged 1 commit into from
May 1, 2024

Conversation

orizi
Copy link
Collaborator

@orizi orizi commented May 1, 2024

This change is Reviewable

@orizi orizi requested a review from gilbens-starkware May 1, 2024 11:28
Copy link
Contributor

@gilbens-starkware gilbens-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 23 of 24 files at r1, all commit messages.
Reviewable status: 23 of 24 files reviewed, 1 unresolved discussion (waiting on @orizi)


crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/diagnostics line 6257 at r1 (raw file):

    fn get_contract_mut(ref self: ComponentState<TContractState>) -> TContractState;
    fn emit<S, impl IntoImp: core::traits::Into<S, Event>>(ref self: ComponentState<TContractState>, event: S);
}

Why is it generating more code now?

Code quote:

component:

#[event]
#[derive(Drop, starknet::Event)]
pub enum Event {}


    pub struct ComponentState<TContractState> {
    }
    impl ComponentStateDrop<TContractState> of Drop<ComponentState<TContractState>> {}
    #[inline(always)]
    pub fn unsafe_new_component_state<TContractState>() -> ComponentState<TContractState> {
        ComponentState::<TContractState> {
        }
    }
    #[cfg(test)]
    #[inline(always)]
    pub fn component_state_for_testing<TContractState>() -> ComponentState<TContractState> {
        unsafe_new_component_state::<TContractState>()
    }


use starknet::storage::{
    StorageMapMemberAddressTrait, StorageMemberAddressTrait,
    StorageMapMemberAccessTrait, StorageMemberAccessTrait,
};
pub trait HasComponent<TContractState> {
    fn get_component(self: @TContractState) -> @ComponentState<TContractState>;
    fn get_component_mut(ref self: TContractState) -> ComponentState<TContractState>;
    fn get_contract(self: @ComponentState<TContractState>) -> @TContractState;
    fn get_contract_mut(ref self: ComponentState<TContractState>) -> TContractState;
    fn emit<S, impl IntoImp: core::traits::Into<S, Event>>(ref self: ComponentState<TContractState>, event: S);
}

Copy link
Collaborator Author

@orizi orizi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 23 of 24 files reviewed, 1 unresolved discussion (waiting on @gilbens-starkware)


crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/diagnostics line 6257 at r1 (raw file):

Previously, gilbens-starkware (Gil Ben-Shachar) wrote…

Why is it generating more code now?

since this file-id changed - as now the code mapping is different - it is simply duplicated. (two components generated the same thing)

@orizi orizi added this pull request to the merge queue May 1, 2024
Merged via the queue into main with commit 8fa9d8c May 1, 2024
42 of 43 checks passed
@orizi orizi deleted the pr/orizi/stable-ptr-refactor/61535961 branch May 6, 2024 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants