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, checker: check $veb.html('index.html') (fix #21929) #21961

Merged
merged 1 commit into from
Jul 30, 2024

Conversation

yuyi98
Copy link
Member

@yuyi98 yuyi98 commented Jul 30, 2024

This PR check $veb.html('index.html') (fix #21929).

  • Check $veb.html('index.html').
  • Add test.
import veb
import vweb

fn main() {
	$veb.html('index.html')
	$vweb.html('index.html')
}

PS D:\Test\v\tt1> v run .
tt1.v:5:2: error: `$veb.html()` must be called inside a web method, e.g. `fn (mut app App) foo(mut ctx Context) veb.Result { return $veb.html('index.html') }`
    3 | 
    4 | fn main() {
    5 |     $veb.html('index.html')
      |     ~~~~~~~~~~~~~~~~~~~~~~~
    6 |     $vweb.html('index.html')
    7 | }
tt1.v:6:2: error: `$vweb.html()` must be called inside a web method, e.g. `fn (mut app App) foo(mut ctx Context) vweb.Result { return $vweb.html('index.html') }`
    4 | fn main() {
    5 |     $veb.html('index.html')
    6 |     $vweb.html('index.html')
      |     ~~~~~~~~~~~~~~~~~~~~~~~~
    7 | }

Copy link
Member

@spytheman spytheman left a comment

Choose a reason for hiding this comment

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

Excellent work.

@spytheman spytheman merged commit ff04683 into vlang:master Jul 30, 2024
73 checks passed
@yuyi98 yuyi98 deleted the check_veb_html_call branch July 30, 2024 13:35
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.

Calling $veb.html() generates cgen error
2 participants