mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: disallow statements after a return, branch check $if, $else, switch, and loops correctly
This commit is contained in:
committed by
Alexander Medvednikov
parent
58b52aa9fb
commit
1864e92ff4
@@ -17,13 +17,11 @@ pub fn compile_template(path string) string {
|
||||
//lines := os.read_lines(path)
|
||||
mut html := os.read_file(path) or {
|
||||
panic('html failed')
|
||||
return ''
|
||||
}
|
||||
mut header := ''
|
||||
if os.file_exists('header.html') {
|
||||
h := os.read_file('header.html') or {
|
||||
panic('html failed')
|
||||
return ''
|
||||
}
|
||||
header = h.replace('\'', '"')
|
||||
}
|
||||
|
||||
@@ -85,13 +85,12 @@ $html
|
||||
|
||||
pub fn run<T>(port int) {
|
||||
println('Running vweb app on http://localhost:$port ...')
|
||||
l := net.listen(port) or { panic('failed to listen') return }
|
||||
l := net.listen(port) or { panic('failed to listen') }
|
||||
mut app := T{}
|
||||
app.init()
|
||||
for {
|
||||
conn := l.accept() or {
|
||||
panic('accept() failed')
|
||||
return
|
||||
}
|
||||
// TODO move this to handle_conn<T>(conn, app)
|
||||
s := conn.read_line()
|
||||
|
||||
Reference in New Issue
Block a user