Something went wrong. Try again.
🌱 A minimal programming language and compiler. git.urbach.dev/cli/q
high-performance programming-language compiler
Something went wrong. Try again.
123456789101112131415161718192021222324252627package core
import ( "git.urbach.dev/cli/q/src/ast" "git.urbach.dev/cli/q/src/ssa")
// compileGo compiles a call that runs asynchronously in a separate thread.func (f *Function) compileGo(g *ast.Go) error { threadFunc, err := f.evaluate(g.Call.Children[0])
if err != nil { return err }
f.Append(threadFunc) createThread := f.Env.Function("thread", "create")
f.Append(&ssa.Call{ Func: &ssa.Function{FunctionRef: createThread, Typ: createThread.Type}, Arguments: []ssa.Value{threadFunc}, })
f.Calls.Add(createThread) f.Calls.Add(threadFunc.(*ssa.Function).FunctionRef.(*Function)) return nil}