Skip to content

Commit

Permalink
REPL panic 不退出
Browse files Browse the repository at this point in the history
  • Loading branch information
lollipopkit committed Oct 25, 2022
1 parent dc70f16 commit 2d4df33
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
- 支持三元操作符 `a ? b : c`
- 去除 `concat`
- 修复 `os.args` 索引错误
- 支持 `shy a = b` -> `a := b` 语法糖
- 支持 `a := fn(b) => c` 语法
- 优化 `stdlib_os`

## 0.1.4
- `+` 支持 `String`
Expand Down
2 changes: 1 addition & 1 deletion consts/lang.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package consts

var (
VERSION = `0.1.5`
VERSION = `0.1.6`
SIGNATURE = `LANG_LK`
)
9 changes: 6 additions & 3 deletions repl.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,12 @@ func repl() {
}

func catchErr(ls *api.LkState, first *bool, cmd string) {
if err := recover(); err != nil && *first {
*first = false
(*ls).LoadString(cmd, "stdin")
if err := recover(); err != nil {
defer catchErr(ls, first, cmd)
if *first {
*first = false
(*ls).LoadString(cmd, "stdin")
}
}
}

Expand Down

0 comments on commit 2d4df33

Please sign in to comment.