test v -live message.v
							parent
							
								
									2144c162c4
								
							
						
					
					
						commit
						e707ac4f28
					
				| 
						 | 
					@ -3,12 +3,21 @@ module main
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	os
 | 
						os
 | 
				
			||||||
	testing
 | 
						testing
 | 
				
			||||||
)  
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fn main() {
 | 
					fn main() {
 | 
				
			||||||
	args := os.args
 | 
						args := os.args
 | 
				
			||||||
	args_string := args[1..].join(' ')
 | 
						args_string := args[1..].join(' ')
 | 
				
			||||||
	if testing.v_build_failing(args_string.all_before('build-examples'), 'examples') {
 | 
						if testing.v_build_failing(
 | 
				
			||||||
 | 
							args_string.all_before('build-examples'), 'examples')
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							exit(1)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						// Test -live
 | 
				
			||||||
 | 
						vexe := args[1]
 | 
				
			||||||
 | 
						ret := os.system('$vexe -live examples/hot_reload/message.v')
 | 
				
			||||||
 | 
						if ret != 0 {
 | 
				
			||||||
 | 
							println('-live message.v failed')
 | 
				
			||||||
		exit(1)
 | 
							exit(1)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1236,11 +1236,16 @@ fn (p mut Parser) statement(add_semi bool) string {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else {
 | 
							else {
 | 
				
			||||||
			// panic and exit count as returns since they stop the function
 | 
								// panic and exit count as returns since they stop the function
 | 
				
			||||||
			if p.lit == 'panic' || p.lit == 'exit' {
 | 
								is_panic :=	p.lit == 'panic' || p.lit == 'exit'
 | 
				
			||||||
 | 
								if is_panic {
 | 
				
			||||||
				p.returns = true
 | 
									p.returns = true
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			// `a + 3`, `a(7)`, or just `a`
 | 
								// `a + 3`, `a(7)`, or just `a`
 | 
				
			||||||
			q = p.bool_expression()
 | 
								q = p.bool_expression()
 | 
				
			||||||
 | 
								// Fix "control reaches end of non-void function" error
 | 
				
			||||||
 | 
								if is_panic && p.cur_fn.typ == 'bool' {
 | 
				
			||||||
 | 
									p.genln(';\nreturn false;')
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	.key_goto {
 | 
						.key_goto {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										12
									
								
								vlib/os/os.v
								
								
								
								
							
							
						
						
									
										12
									
								
								vlib/os/os.v
								
								
								
								
							| 
						 | 
					@ -858,11 +858,15 @@ pub fn is_dir(path string) bool {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// is_link returns a boolean indicating whether the given path is a link.
 | 
					// is_link returns a boolean indicating whether the given path is a link.
 | 
				
			||||||
pub fn is_link(path string) bool {
 | 
					pub fn is_link(path string) bool {
 | 
				
			||||||
	statbuf := C.stat{}
 | 
						$if windows {
 | 
				
			||||||
	if C.lstat(path.str, &statbuf) != 0 {
 | 
							return false // TODO
 | 
				
			||||||
		return false
 | 
						} $else {
 | 
				
			||||||
 | 
							statbuf := C.stat{}
 | 
				
			||||||
 | 
							if C.lstat(path.str, &statbuf) != 0 {
 | 
				
			||||||
 | 
								return false
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							return int(statbuf.st_mode) & S_IFMT == S_IFLNK
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return int(statbuf.st_mode) & S_IFMT == S_IFLNK
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// chdir changes the current working directory to the new directory path.
 | 
					// chdir changes the current working directory to the new directory path.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue