Skip to content

parser: fix block position's last line#22913

Merged
spytheman merged 3 commits intovlang:masterfrom
yuyi98:fix_block_last_line
Nov 19, 2024
Merged

parser: fix block position's last line#22913
spytheman merged 3 commits intovlang:masterfrom
yuyi98:fix_block_last_line

Conversation

@yuyi98
Copy link
Copy Markdown
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
Copy Markdown
Contributor

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

@yuyi98
Copy link
Copy Markdown
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
Copy Markdown
Contributor

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
Copy Markdown
Member Author

yuyi98 commented Nov 19, 2024

I see, I'll add one.

@yuyi98
Copy link
Copy Markdown
Member Author

yuyi98 commented Nov 19, 2024

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

	println('hello')
}

@spytheman
Copy link
Copy Markdown
Contributor

Thank you.

@spytheman spytheman merged commit 67d53aa into vlang:master Nov 19, 2024
@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