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

parser: fix block position's last line #22913

Merged
merged 3 commits into from
Nov 19, 2024

Conversation

yuyi98
Copy link
Member

@yuyi98 yuyi98 commented Nov 19, 2024

This PR fix block position's last line and modify the related call.

Huly®: V_0.6-21356

@spytheman
Copy link
Member

Is there a specific example, that is formatted wrongly because of it?

@yuyi98
Copy link
Member Author

yuyi98 commented Nov 19, 2024

			ast.Block {
				if node is ast.Block && !node.is_unsafe && node.pos.line_nr - prev_line_nr > 1 {
					return true
				} else {
					return false
				}
			}

node.pos.line_nr - prev_line_nr > 1 Indicate blank line, originally it was node.pos.line_nr - prev_line_nr > 0.

@spytheman
Copy link
Member

Yes, I can read the diff, and I did so.

My question is about an example of code, that would have been formatted differently before, but is now correct on this PR.

@yuyi98
Copy link
Member Author

yuyi98 commented Nov 19, 2024

I see, I'll add one.

@yuyi98
Copy link
Member Author

yuyi98 commented Nov 19, 2024

fn main() {
	{
		println('(1/3) My first small scope')
		//
	}

	println('hello')
}

@spytheman
Copy link
Member

Thank you.

@spytheman spytheman merged commit 67d53aa into vlang:master Nov 19, 2024
70 of 72 checks passed
@yuyi98 yuyi98 deleted the fix_block_last_line branch November 20, 2024 01:13
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