mirror of
https://github.com/Open-Argon/argon-v3.git
synced 2025-12-06 00:46:07 +00:00
fix do wrap bugs
This commit is contained in:
@@ -94,11 +94,7 @@ func runCall(c call, stack stack) (any, ArErr) {
|
|||||||
level[param] = args[i]
|
level[param] = args[i]
|
||||||
}
|
}
|
||||||
resp, err := runVal(x.run, append(x.stack, level))
|
resp, err := runVal(x.run, append(x.stack, level))
|
||||||
switch x := resp.(type) {
|
return openJump(resp), err
|
||||||
case PassBackJumpStatment:
|
|
||||||
resp = x.value
|
|
||||||
}
|
|
||||||
return resp, err
|
|
||||||
}
|
}
|
||||||
return nil, ArErr{"Runtime Error", "type '" + typeof(callable) + "' is not callable", c.line, c.path, c.code, true}
|
return nil, ArErr{"Runtime Error", "type '" + typeof(callable) + "' is not callable", c.line, c.path, c.code, true}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ func isDoWrap(code UNPARSEcode) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func parseDoWrap(code UNPARSEcode, index int, codelines []UNPARSEcode) (any, bool, ArErr, int) {
|
func parseDoWrap(code UNPARSEcode, index int, codelines []UNPARSEcode) (any, bool, ArErr, int) {
|
||||||
currentindent := len(code.code) - len(strings.TrimLeft(code.code, " "))
|
currentindent := len(code.realcode) - len(strings.TrimLeft(code.realcode, " "))
|
||||||
var setindent int = -1
|
var setindent int = -1
|
||||||
var i = index + 1
|
var i = index + 1
|
||||||
translated := []any{}
|
translated := []any{}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ func parseReturn(code UNPARSEcode, index int, codeline []UNPARSEcode) (CallJumpS
|
|||||||
realcode: code.realcode,
|
realcode: code.realcode,
|
||||||
line: code.line,
|
line: code.line,
|
||||||
path: code.path,
|
path: code.path,
|
||||||
}, index, codeline, 0)
|
}, index, codeline, 1)
|
||||||
return CallJumpStatment{
|
return CallJumpStatment{
|
||||||
TYPE: "return",
|
TYPE: "return",
|
||||||
value: resp,
|
value: resp,
|
||||||
@@ -57,3 +57,12 @@ func runJumpStatment(code CallJumpStatment, stack stack) (any, ArErr) {
|
|||||||
path: code.path,
|
path: code.path,
|
||||||
}, ArErr{}
|
}, ArErr{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func openJump(resp any) any {
|
||||||
|
switch x := resp.(type) {
|
||||||
|
case PassBackJumpStatment:
|
||||||
|
return x.value
|
||||||
|
default:
|
||||||
|
return resp
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -193,11 +193,7 @@ func setVariableValue(v setVariable, stack stack) (any, ArErr) {
|
|||||||
if err.EXISTS {
|
if err.EXISTS {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
switch x := respp.(type) {
|
resp = openJump(respp)
|
||||||
case PassBackJumpStatment:
|
|
||||||
respp = x.value
|
|
||||||
}
|
|
||||||
resp = respp
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if v.TYPE == "let" {
|
if v.TYPE == "let" {
|
||||||
|
|||||||
Reference in New Issue
Block a user