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:
parent
45f16a2640
commit
50247d5093
11
thirdparty/photon/photonwrapper.h
vendored
11
thirdparty/photon/photonwrapper.h
vendored
@ -1,6 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef C_PHOTONWRAPPER_H_
|
#ifndef C_PHOTONWRAPPER_H_
|
||||||
#define C_PHOTONWRAPPER_H_
|
#define C_PHOTONWRAPPER_H_
|
||||||
|
|
||||||
@ -20,18 +17,12 @@
|
|||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#else
|
#else
|
||||||
typedef struct CppClass CppClass;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//CppClass *cpp_class_create();
|
#endif
|
||||||
//void cpp_class_destroy(CppClass *c);
|
|
||||||
//void cpp_class_do_work(CppClass *c);
|
|
||||||
|
|
||||||
int photon_init_default();
|
int photon_init_default();
|
||||||
void photon_thread_create11(void* (* f)(void*));
|
void photon_thread_create11(void* (* f)(void*));
|
||||||
|
|
||||||
void photon_sleep_s(int n);
|
void photon_sleep_s(int n);
|
||||||
|
|
||||||
void photon_sleep_ms(int n);
|
void photon_sleep_ms(int n);
|
||||||
|
|
||||||
|
|
||||||
|
@ -563,6 +563,9 @@ pub fn (mut f Gen) expr(node_ ast.Expr) {
|
|||||||
ast.GoExpr {
|
ast.GoExpr {
|
||||||
f.go_expr(node)
|
f.go_expr(node)
|
||||||
}
|
}
|
||||||
|
ast.SpawnExpr {
|
||||||
|
f.spawn_expr(node)
|
||||||
|
}
|
||||||
ast.Ident {
|
ast.Ident {
|
||||||
f.ident(node)
|
f.ident(node)
|
||||||
}
|
}
|
||||||
@ -1043,6 +1046,11 @@ pub fn (mut f Gen) go_expr(node ast.GoExpr) {
|
|||||||
f.call_expr(node.call_expr)
|
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) {
|
pub fn (mut f Gen) goto_label(node ast.GotoLabel) {
|
||||||
f.writeln('${node.name}:')
|
f.writeln('${node.name}:')
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user