mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: make spawn
behave like go
This commit is contained in:
parent
141c404d45
commit
a082328e40
@ -114,7 +114,7 @@ pub fn (mut p Parser) check_expr(precedence int) !ast.Expr {
|
||||
node = p.prefix_expr()
|
||||
}
|
||||
}
|
||||
.key_go {
|
||||
.key_go, .key_spawn {
|
||||
mut go_expr := p.go_expr()
|
||||
go_expr.is_expr = true
|
||||
node = go_expr
|
||||
|
@ -1051,7 +1051,7 @@ pub fn (mut p Parser) stmt(is_top_level bool) ast.Stmt {
|
||||
}
|
||||
}
|
||||
}
|
||||
.key_go {
|
||||
.key_go, .key_spawn {
|
||||
go_expr := p.go_expr()
|
||||
return ast.ExprStmt{
|
||||
expr: go_expr
|
||||
|
@ -1 +1,2 @@
|
||||
[1, 2, 3]
|
||||
[4,5, 6]
|
||||
|
@ -1,4 +1,7 @@
|
||||
fn main(){
|
||||
g := go print([1, 2, 3])
|
||||
g.wait()
|
||||
println('')
|
||||
g2 := spawn print([4, 5, 6])
|
||||
g2.wait()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user