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

fix: addDebugInfo before convertExpression #2835

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

XMadrid
Copy link
Contributor

@XMadrid XMadrid commented Apr 3, 2024

Fixes #2833 .

add debugLocation before convertExpression.
For code snippet:

function add(a: i32, b: i32): i32 {
  return a + b;
}

add(1, 2);

Before this PR, we emit:

addDebugLocation(drop, line = 5, column = 2);       // In there, we should emit `call` instruction
addDebugLocation(drop, line = 5, column = 2); 

With this PR, we emit:

addDebugLocation(call, line = 5, column = 2);      
addDebugLocation(drop, line = 5, column = 2); 
  • I've read the contributing guidelines
  • I've added my name and email to the NOTICE file

Copy link
Member

@HerrCai0907 HerrCai0907 left a comment

Choose a reason for hiding this comment

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

I don't find any reason to move this debug location from outside expr to inside expr.

@XMadrid
Copy link
Contributor Author

XMadrid commented Apr 7, 2024

I think we can emit debug location for both outside expr and inside expr.

@XMadrid XMadrid force-pushed the emit-correct-debug-locations branch from 586e7a2 to 42f559f Compare April 8, 2024 06:43
@XMadrid XMadrid requested a review from HerrCai0907 April 8, 2024 07:54
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.

Emit incorrect debugLocation while convertExpression()
2 participants