1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

all: coroutines (part 1)

This commit is contained in:
Alexander Medvednikov
2023-05-27 23:33:46 +02:00
parent 5812579d53
commit 45f16a2640
18 changed files with 216 additions and 24 deletions

View File

@@ -1166,6 +1166,9 @@ fn (t Tree) expr(expr ast.Expr) &Node {
ast.GoExpr {
return t.go_expr(expr)
}
ast.SpawnExpr {
return t.spawn_expr(expr)
}
ast.OffsetOf {
return t.offset_of(expr)
}
@@ -1862,6 +1865,15 @@ fn (t Tree) go_expr(expr ast.GoExpr) &Node {
return obj
}
fn (t Tree) spawn_expr(expr ast.SpawnExpr) &Node {
mut obj := new_object()
obj.add_terse('ast_type', t.string_node('SpawnExpr'))
obj.add_terse('call_expr', t.call_expr(expr.call_expr))
obj.add_terse('is_expr', t.bool_node(expr.is_expr))
obj.add('pos', t.pos(expr.pos))
return obj
}
fn (t Tree) offset_of(expr ast.OffsetOf) &Node {
mut obj := new_object()
obj.add_terse('ast_type', t.string_node('OffsetOf'))