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

Add array! macro. #3501

Merged
merged 1 commit into from
Jun 28, 2023
Merged

Add array! macro. #3501

merged 1 commit into from
Jun 28, 2023

Conversation

gilbens-starkware
Copy link
Contributor

@gilbens-starkware gilbens-starkware commented Jun 25, 2023

This change is Reviewable

Copy link
Contributor Author

@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.

Reviewable status: 0 of 4 files reviewed, 1 unresolved discussion (waiting on @orizi and @spapinistarkware)

a discussion (no related file):
Change target branch.


Copy link
Contributor Author

@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.

Reviewable status: 0 of 4 files reviewed, 1 unresolved discussion (waiting on @orizi and @spapinistarkware)


crates/cairo-lang-plugins/src/test_data/inline_macros line 206 at r1 (raw file):

                           _temp_array.append(2);
                           _temp_array.append(3);
                        

Trying to remove these whitespaces.

Copy link
Collaborator

@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: 0 of 4 files reviewed, 2 unresolved discussions (waiting on @gilbens-starkware and @spapinistarkware)


crates/cairo-lang-plugins/src/plugins/inline_macros/array.rs line 17 at r1 (raw file):

        let mut expanded_code = 
            "{
                let mut _temp_array = ArrayTrait::new();

make this name worse.
?

Suggestion:

 __array_builder_macro_result___

Copy link
Contributor

@spapinistarkware spapinistarkware left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 4 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: 3 of 4 files reviewed, 3 unresolved discussions (waiting on @gilbens-starkware and @orizi)

a discussion (no related file):
Do we want square brackets? array![a,b,c]?


Copy link
Contributor

@spapinistarkware spapinistarkware left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 4 files at r1.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @gilbens-starkware and @orizi)

@gilbens-starkware gilbens-starkware force-pushed the gil/array_macro branch 2 times, most recently from 748a0f4 to 53dad6d Compare June 25, 2023 17:28
Copy link
Contributor Author

@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.

Reviewable status: 1 of 4 files reviewed, 3 unresolved discussions (waiting on @orizi and @spapinistarkware)

a discussion (no related file):

Previously, spapinistarkware (Shahar Papini) wrote…

Do we want square brackets? array![a,b,c]?

Yes, I am adding it.



crates/cairo-lang-plugins/src/plugins/inline_macros/array.rs line 17 at r1 (raw file):

Previously, orizi wrote…

make this name worse.
?

Done.

Copy link
Collaborator

@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.

Reviewed 2 of 3 files at r3.
Reviewable status: 3 of 4 files reviewed, 2 unresolved discussions (waiting on @spapinistarkware)

Copy link
Collaborator

@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.

Reviewed 3 of 3 files at r4, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @gilbens-starkware and @spapinistarkware)

a discussion (no related file):

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

Yes, I am adding it.

adding a block for this :)


Copy link
Contributor Author

@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.

Reviewable status: 1 of 4 files reviewed, 2 unresolved discussions (waiting on @orizi and @spapinistarkware)

a discussion (no related file):

Previously, orizi wrote…

adding a block for this :)

Done.


Copy link
Collaborator

@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.

Reviewed 1 of 3 files at r5, all commit messages.
Reviewable status: 2 of 4 files reviewed, 5 unresolved discussions (waiting on @gilbens-starkware and @spapinistarkware)


crates/cairo-lang-plugins/src/plugins/inline_macros/array.rs line 24 at r6 (raw file):

                arg.as_syntax_node().get_text(db)
            ));
        }

Suggestion:

        let mut expanded_code = "{
                let mut __array_builder_macro_result__ = ArrayTrait::new();"
        .to_string();
        for arg in args {
            expanded_code.push_str(&format!(
                "\n                __array_builder_macro_result__.append({});",
                arg.as_syntax_node().get_text(db)
            ));
        }

crates/cairo-lang-plugins/src/plugins/inline_macros/array.rs line 29 at r6 (raw file):

                __array_builder_macro_result__
            }",
        );

Suggestion:

        expanded_code.push_str(
            "\n                __array_builder_macro_result__
            }",
        );

crates/cairo-lang-plugins/src/plugins/inline_macros/array.rs line 34 at r6 (raw file):

    }

    fn is_bracket_type_allowed(

doc

Code quote:

is_bracket_type_allowed(

@gilbens-starkware gilbens-starkware force-pushed the gil/array_macro_3 branch 2 times, most recently from e1eb7b9 to 68d990e Compare June 28, 2023 06:22
Copy link
Contributor Author

@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.

Reviewable status: 2 of 26 files reviewed, 5 unresolved discussions (waiting on @orizi and @spapinistarkware)


crates/cairo-lang-plugins/src/plugins/inline_macros/array.rs line 24 at r6 (raw file):

                arg.as_syntax_node().get_text(db)
            ));
        }

Done.


crates/cairo-lang-plugins/src/plugins/inline_macros/array.rs line 29 at r6 (raw file):

                __array_builder_macro_result__
            }",
        );

Done.


crates/cairo-lang-plugins/src/plugins/inline_macros/array.rs line 34 at r6 (raw file):

Previously, orizi wrote…

doc

It is docd in the trait.

Copy link
Collaborator

@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.

Reviewed 1 of 23 files at r7, 23 of 23 files at r8, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @gilbens-starkware and @spapinistarkware)


crates/cairo-lang-plugins/src/plugins/inline_macros/array.rs line 19 at r8 (raw file):

        for arg in args {
            expanded_code.push_str(&format!(
                "\n                __array_builder_macro_result__.append({});",

Suggestion:

            expanded_code.push_str(&format!(
                "\n            __array_builder_macro_result__.append({});",

crates/cairo-lang-plugins/src/plugins/inline_macros/array.rs line 25 at r8 (raw file):

        expanded_code.push_str(
            "\n                __array_builder_macro_result__
        }",

Suggestion:

        expanded_code.push_str(
            "\n            __array_builder_macro_result__

        }",

Copy link
Contributor Author

@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.

Reviewable status: 25 of 26 files reviewed, 3 unresolved discussions (waiting on @orizi and @spapinistarkware)


crates/cairo-lang-plugins/src/plugins/inline_macros/array.rs line 19 at r8 (raw file):

        for arg in args {
            expanded_code.push_str(&format!(
                "\n                __array_builder_macro_result__.append({});",

Done.


crates/cairo-lang-plugins/src/plugins/inline_macros/array.rs line 25 at r8 (raw file):

        expanded_code.push_str(
            "\n                __array_builder_macro_result__
        }",

Done.

Copy link
Collaborator

@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.

:lgtm:

Reviewed 2 of 2 files at r9, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @spapinistarkware)

@gilbens-starkware gilbens-starkware force-pushed the gil/array_macro branch 2 times, most recently from 264f95e to c21438d Compare June 28, 2023 09:02
@gilbens-starkware gilbens-starkware changed the base branch from gil/array_macro to main June 28, 2023 10:08
@gilbens-starkware gilbens-starkware added this pull request to the merge queue Jun 28, 2023
Merged via the queue into main with commit 4b949d7 Jun 28, 2023
@orizi orizi deleted the gil/array_macro_3 branch June 29, 2023 06:51
@gilbens-starkware
Copy link
Contributor Author

Resolves #3220.

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.

3 participants