Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Added empty visit_For function in the SymbolTableVisitor class #1509

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

Merged
merged 3 commits into from
Feb 11, 2023

Conversation

anutosh491
Copy link
Collaborator

Addresses the first part of #1287 (comment)

j: i32
i: i32
for i in range(5):
    j = i
    print("j: ", j)

Something like this doesn't give us the expected output on main . It appears that the code is calling the visit_stmt function of the SymbolTableVisitor, but the visit_For function is only defined in the BodyVisitor. Hence an empty visit_For function in the SymbolTableVisitor class should do the job. Once this is done , we have the correct output

j:  0
j:  1
j:  2
j:  3
j:  4

Copy link
Collaborator

@czgdp1807 czgdp1807 left a comment

Choose a reason for hiding this comment

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

Its okay to have it. I personally don't see any downsides. @certik Thoughts?

@certik
Copy link
Contributor

certik commented Feb 6, 2023

I think that's fine. Should we add a test for this?

Copy link
Collaborator

@czgdp1807 czgdp1807 left a comment

Choose a reason for hiding this comment

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

Please add a test for this. See the existing pattern of integration_tests and add your own. Thanks.

@czgdp1807 czgdp1807 marked this pull request as draft February 7, 2023 16:20
@anutosh491
Copy link
Collaborator Author

Please add a test for this. See the existing pattern of integration_tests and add your own. Thanks.

Sure , I'll do the needful soon !

@anutosh491 anutosh491 marked this pull request as ready for review February 9, 2023 02:27
@czgdp1807 czgdp1807 marked this pull request as draft February 9, 2023 04:16
@Thirumalai-Shaktivel Thirumalai-Shaktivel marked this pull request as ready for review February 11, 2023 05:02
@czgdp1807 czgdp1807 enabled auto-merge (squash) February 11, 2023 05:29
@czgdp1807 czgdp1807 merged commit 9c00b60 into lcompilers:main Feb 11, 2023
@anutosh491 anutosh491 deleted the branch02 branch February 11, 2023 05:54
@anutosh491
Copy link
Collaborator Author

Thanks for the reviews on this !

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.

4 participants