mirror of
https://github.com/Open-Argon/argon-v3.git
synced 2025-12-06 08:56:07 +00:00
move to test folder and fix import bug in shell
This commit is contained in:
@@ -107,7 +107,11 @@ func importMod(realpath string, origin string, main bool) (ArObject, ArErr) {
|
||||
return ArObject{}, translationerr
|
||||
}
|
||||
ArgsArArray := []any{}
|
||||
for _, arg := range Args[1:] {
|
||||
withoutarfile := []string{}
|
||||
if len(Args) > 1 {
|
||||
withoutarfile = Args[1:]
|
||||
}
|
||||
for _, arg := range withoutarfile {
|
||||
ArgsArArray = append(ArgsArArray, arg)
|
||||
}
|
||||
global := newscope()
|
||||
|
||||
@@ -194,7 +194,9 @@ func runVal(line any, stack stack, stacklevel int) (any, ArErr) {
|
||||
case bool:
|
||||
return x, ArErr{}
|
||||
case nil:
|
||||
return nil, ArErr{}
|
||||
return x, ArErr{}
|
||||
case ArObject:
|
||||
return x, ArErr{}
|
||||
}
|
||||
if stackoverflow {
|
||||
return nil, ArErr{
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package main
|
||||
|
||||
import "sync"
|
||||
import (
|
||||
"fmt"
|
||||
"sync"
|
||||
)
|
||||
|
||||
func ArThread(args ...any) (any, ArErr) {
|
||||
if len(args) == 0 {
|
||||
return nil, ArErr{TYPE: "TypeError", message: "Cannot call thread without a function", EXISTS: true}
|
||||
if len(args) != 1 {
|
||||
return nil, ArErr{TYPE: "TypeError", message: "Invalid number of arguments, expected 1, got " + fmt.Sprint(len(args)), EXISTS: true}
|
||||
}
|
||||
var tocall any
|
||||
switch x := args[0].(type) {
|
||||
@@ -26,6 +29,9 @@ func ArThread(args ...any) (any, ArErr) {
|
||||
if hasrun {
|
||||
return nil, ArErr{TYPE: "Runtime Error", message: "Cannot start a thread twice", EXISTS: true}
|
||||
}
|
||||
if len(args) != 0 {
|
||||
return nil, ArErr{TYPE: "TypeError", message: "Invalid number of arguments, expected 0, got " + fmt.Sprint(len(args)), EXISTS: true}
|
||||
}
|
||||
hasrun = true
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
@@ -40,6 +46,9 @@ func ArThread(args ...any) (any, ArErr) {
|
||||
} else if joined {
|
||||
return nil, ArErr{TYPE: "Runtime Error", message: "Cannot join a thread twice", EXISTS: true}
|
||||
}
|
||||
if len(args) != 0 {
|
||||
return nil, ArErr{TYPE: "TypeError", message: "Invalid number of arguments, expected 0, got " + fmt.Sprint(len(args)), EXISTS: true}
|
||||
}
|
||||
joined = true
|
||||
wg.Wait()
|
||||
return resp, err
|
||||
|
||||
Reference in New Issue
Block a user