mirror of
https://github.com/Open-Argon/argon-v3.git
synced 2025-12-06 00:46:07 +00:00
fix getindex and add debug
This commit is contained in:
2
build
2
build
@@ -1 +1 @@
|
|||||||
go build -o bin/argon ./src
|
go build -ldflags "-s -w" -o bin/argon ./src
|
||||||
2
debug
Executable file
2
debug
Executable file
@@ -0,0 +1,2 @@
|
|||||||
|
# run the go run command passing the path to the main.go file, with the working directory set to the bin folder. pass in the arguments
|
||||||
|
__ARGON_DEBUG__=true go run ./src "$@"
|
||||||
2
run
2
run
@@ -1,2 +1,2 @@
|
|||||||
# run the go run command passing the path to the main.go file, with the working directory set to the bin folder. pass in the arguments
|
# run the go run command passing the path to the main.go file, with the working directory set to the bin folder. pass in the arguments
|
||||||
__ARGON_DEBUG__=true go run ./src "$@"
|
go run ./src "$@"
|
||||||
@@ -65,7 +65,7 @@ func parseCall(code UNPARSEcode, index int, codelines []UNPARSEcode) (any, bool,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func runCall(c call, stack stack, stacklevel int) (any, ArErr) {
|
func runCall(c call, stack stack, stacklevel int) (any, ArErr) {
|
||||||
var callable any
|
var callable any = c.callable
|
||||||
switch x := c.callable.(type) {
|
switch x := c.callable.(type) {
|
||||||
case builtinFunc:
|
case builtinFunc:
|
||||||
callable = x
|
callable = x
|
||||||
|
|||||||
@@ -28,8 +28,7 @@ func mapGet(r ArMapGet, stack stack, stacklevel int) (any, ArErr) {
|
|||||||
}
|
}
|
||||||
switch m := resp.(type) {
|
switch m := resp.(type) {
|
||||||
case ArObject:
|
case ArObject:
|
||||||
if _, ok := m.obj["__getindex__"]; ok {
|
if callable, ok := m.obj["__getindex__"]; ok {
|
||||||
callable := m.obj["__getindex__"]
|
|
||||||
resp, err := runCall(call{
|
resp, err := runCall(call{
|
||||||
callable: callable,
|
callable: callable,
|
||||||
args: r.args,
|
args: r.args,
|
||||||
@@ -48,6 +47,13 @@ func mapGet(r ArMapGet, stack stack, stacklevel int) (any, ArErr) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch m := resp.(type) {
|
||||||
|
case ArObject:
|
||||||
|
if obj, ok := m.obj[r.args[0]]; ok {
|
||||||
|
return obj, ArErr{}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
key, err := runVal(r.args[0], stack, stacklevel+1)
|
key, err := runVal(r.args[0], stack, stacklevel+1)
|
||||||
if err.EXISTS {
|
if err.EXISTS {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
Reference in New Issue
Block a user