Skip to content

Commit

Permalink
wasm fix
Browse files Browse the repository at this point in the history
  • Loading branch information
refaktor committed Nov 30, 2024
1 parent ef2a4f8 commit 0464fc5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion evaldo/evaldo.go
Original file line number Diff line number Diff line change
Expand Up @@ -1108,9 +1108,10 @@ func MaybeDisplayFailureOrError(es *env.ProgramState, genv *env.Idxs, tag string
// cebelca2659- vklopi kontne skupine
}

func MaybeDisplayFailureOrErrorWASM(es *env.ProgramState, genv *env.Idxs, printfn func(string)) {
func MaybeDisplayFailureOrErrorWASM(es *env.ProgramState, genv *env.Idxs, printfn func(string), tag string) {
if es.FailureFlag {
printfn("\x1b[33m" + "Failure" + "\x1b[0m")
printfn(tag)
}
if es.ErrorFlag {
printfn("\x1b[31;3m" + es.Res.Print(*genv))
Expand All @@ -1123,6 +1124,7 @@ func MaybeDisplayFailureOrErrorWASM(es *env.ProgramState, genv *env.Idxs, printf
printfn(err.CodeBlock.PositionAndSurroundingElements(*genv))
}
printfn("\x1b[0m")
printfn(tag)
}
}

Expand Down
4 changes: 2 additions & 2 deletions main_wasm.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func RyeEvalShellLine(this js.Value, args []js.Value) any {
}

evaldo.EvalBlockInj(ps, prevResult, true)
evaldo.MaybeDisplayFailureOrErrorWASM(ps, ps.Idx, sendMessageToJSNL)
evaldo.MaybeDisplayFailureOrErrorWASM(ps, ps.Idx, sendMessageToJSNL, "rye shell line wasm")

prevResult = ps.Res

Expand Down Expand Up @@ -239,7 +239,7 @@ func RyeEvalString(this js.Value, args []js.Value) any {
}

evaldo.EvalBlock(es)
evaldo.MaybeDisplayFailureOrError(es, genv)
evaldo.MaybeDisplayFailureOrError(es, genv, "rye eval string wasm")
return es.Res.Print(*es.Idx)
case env.Error:
fmt.Println(val.Message)
Expand Down

0 comments on commit 0464fc5

Please sign in to comment.