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

gen.golang: handle spawn/go

This commit is contained in:
Alexander Medvednikov 2023-05-28 02:44:47 +02:00
parent 45f16a2640
commit 50247d5093
2 changed files with 9 additions and 10 deletions

View File

@ -1,6 +1,3 @@
#ifndef C_PHOTONWRAPPER_H_
#define C_PHOTONWRAPPER_H_
@ -20,18 +17,12 @@
extern "C" {
#else
typedef struct CppClass CppClass;
#endif
//CppClass *cpp_class_create();
//void cpp_class_destroy(CppClass *c);
//void cpp_class_do_work(CppClass *c);
#endif
int photon_init_default();
void photon_thread_create11(void* (* f)(void*));
void photon_sleep_s(int n);
void photon_sleep_ms(int n);

View File

@ -563,6 +563,9 @@ pub fn (mut f Gen) expr(node_ ast.Expr) {
ast.GoExpr {
f.go_expr(node)
}
ast.SpawnExpr {
f.spawn_expr(node)
}
ast.Ident {
f.ident(node)
}
@ -1043,6 +1046,11 @@ pub fn (mut f Gen) go_expr(node ast.GoExpr) {
f.call_expr(node.call_expr)
}
pub fn (mut f Gen) spawn_expr(node ast.SpawnExpr) {
f.write('go ')
f.call_expr(node.call_expr)
}
pub fn (mut f Gen) goto_label(node ast.GotoLabel) {
f.writeln('${node.name}:')
}