Added wasm target

This commit is contained in:
2025-03-12 23:15:43 +01:00
parent 450e634d79
commit dc664dbf5a
8 changed files with 44 additions and 4 deletions

View File

@ -8,18 +8,21 @@ import (
"git.urbach.dev/cli/q/src/fs"
"git.urbach.dev/cli/q/src/register"
"git.urbach.dev/cli/q/src/scope"
"git.urbach.dev/cli/q/src/wasm"
"git.urbach.dev/cli/q/src/x86"
)
// NewFunction creates a new function.
func NewFunction(pkg string, name string, file *fs.File) *Function {
var cpu *cpu.CPU
var c *cpu.CPU
switch config.TargetArch {
case config.ARM:
cpu = &arm.CPU
c = &arm.CPU
case config.WASM:
c = &wasm.CPU
case config.X86:
cpu = &x86.CPU
c = &x86.CPU
}
return &Function{
@ -34,7 +37,7 @@ func NewFunction(pkg string, name string, file *fs.File) *Function {
Stack: scope.Stack{
Scopes: []*scope.Scope{{}},
},
CPU: cpu,
CPU: c,
},
}
}