From 96cda20bfa487e6f7bfa1e28bc772c0d5e4f7bca Mon Sep 17 00:00:00 2001 From: OldLiu <632171029@qq.com> Date: Sat, 8 Jul 2023 13:03:26 +0800 Subject: [PATCH] fix print privous return value in repl error --- impls/vbs/step1_read_print.vbs | 7 ++++--- impls/vbs/step2_eval.vbs | 7 ++++--- impls/vbs/step3_env.vbs | 7 ++++--- impls/vbs/step4_if_fn_do.vbs | 7 ++++--- impls/vbs/step5_tco.vbs | 7 ++++--- impls/vbs/step6_file.vbs | 7 ++++--- impls/vbs/step7_quote.vbs | 7 ++++--- impls/vbs/step8_macros.vbs | 7 ++++--- impls/vbs/step9_try.vbs | 7 ++++--- impls/vbs/stepA_mal.vbs | 7 ++++--- 10 files changed, 40 insertions(+), 30 deletions(-) diff --git a/impls/vbs/step1_read_print.vbs b/impls/vbs/step1_read_print.vbs index a54140ec..01757b6e 100644 --- a/impls/vbs/step1_read_print.vbs +++ b/impls/vbs/step1_read_print.vbs @@ -19,12 +19,13 @@ Sub REPL() Dim strRes On Error Resume Next strRes = REP(strCode) - If strRes <> "" Then - WScript.Echo strRes - End If If Err.Number <> 0 Then 'WScript.StdErr.WriteLine Err.Source + ": " + Err.Description WScript.StdErr.WriteLine "Exception: " + Err.Description + Else + If strRes <> "" Then + WScript.Echo strRes + End If End If On Error Goto 0 Wend diff --git a/impls/vbs/step2_eval.vbs b/impls/vbs/step2_eval.vbs index e6cad481..769a3426 100644 --- a/impls/vbs/step2_eval.vbs +++ b/impls/vbs/step2_eval.vbs @@ -102,12 +102,13 @@ Sub REPL() Dim strRes On Error Resume Next strRes = REP(strCode) - If strRes <> "" Then - WScript.Echo strRes - End If If Err.Number <> 0 Then 'WScript.StdErr.WriteLine Err.Source + ": " + Err.Description WScript.StdErr.WriteLine "Exception: " + Err.Description + Else + If strRes <> "" Then + WScript.Echo strRes + End If End If On Error Goto 0 Wend diff --git a/impls/vbs/step3_env.vbs b/impls/vbs/step3_env.vbs index ddfaf392..eedff1a9 100644 --- a/impls/vbs/step3_env.vbs +++ b/impls/vbs/step3_env.vbs @@ -113,12 +113,13 @@ Sub REPL() Dim strRes On Error Resume Next strRes = REP(strCode) - If strRes <> "" Then - WScript.Echo strRes - End If If Err.Number <> 0 Then 'WScript.StdErr.WriteLine Err.Source + ": " + Err.Description WScript.StdErr.WriteLine "Exception: " + Err.Description + Else + If strRes <> "" Then + WScript.Echo strRes + End If End If On Error Goto 0 Wend diff --git a/impls/vbs/step4_if_fn_do.vbs b/impls/vbs/step4_if_fn_do.vbs index fc90594e..d9cb2e89 100644 --- a/impls/vbs/step4_if_fn_do.vbs +++ b/impls/vbs/step4_if_fn_do.vbs @@ -127,12 +127,13 @@ Sub REPL() Dim strRes On Error Resume Next strRes = REP(strCode) - If strRes <> "" Then - WScript.Echo strRes - End If If Err.Number <> 0 Then 'WScript.StdErr.WriteLine Err.Source + ": " + Err.Description WScript.StdErr.WriteLine "Exception: " + Err.Description + Else + If strRes <> "" Then + WScript.Echo strRes + End If End If On Error Goto 0 Wend diff --git a/impls/vbs/step5_tco.vbs b/impls/vbs/step5_tco.vbs index bdba9e96..3b77ecac 100644 --- a/impls/vbs/step5_tco.vbs +++ b/impls/vbs/step5_tco.vbs @@ -136,12 +136,13 @@ Sub REPL() Dim strRes On Error Resume Next strRes = REP(strCode) - If strRes <> "" Then - WScript.Echo strRes - End If If Err.Number <> 0 Then 'WScript.StdErr.WriteLine Err.Source + ": " + Err.Description WScript.StdErr.WriteLine "Exception: " + Err.Description + Else + If strRes <> "" Then + WScript.Echo strRes + End If End If On Error Goto 0 Wend diff --git a/impls/vbs/step6_file.vbs b/impls/vbs/step6_file.vbs index 1ca114a3..c7cb37ba 100644 --- a/impls/vbs/step6_file.vbs +++ b/impls/vbs/step6_file.vbs @@ -164,12 +164,13 @@ Sub REPL() Dim strRes On Error Resume Next strRes = REP(strCode) - If strRes <> "" Then - WScript.Echo strRes - End If If Err.Number <> 0 Then 'WScript.StdErr.WriteLine Err.Source + ": " + Err.Description WScript.StdErr.WriteLine "Exception: " + Err.Description + Else + If strRes <> "" Then + WScript.Echo strRes + End If End If On Error Goto 0 Wend diff --git a/impls/vbs/step7_quote.vbs b/impls/vbs/step7_quote.vbs index 6d6365c0..4dadef08 100644 --- a/impls/vbs/step7_quote.vbs +++ b/impls/vbs/step7_quote.vbs @@ -288,12 +288,13 @@ Sub REPL() Dim strRes On Error Resume Next strRes = REP(strCode) - If strRes <> "" Then - WScript.Echo strRes - End If If Err.Number <> 0 Then 'WScript.StdErr.WriteLine Err.Source + ": " + Err.Description WScript.StdErr.WriteLine "Exception: " + Err.Description + Else + If strRes <> "" Then + WScript.Echo strRes + End If End If On Error Goto 0 Wend diff --git a/impls/vbs/step8_macros.vbs b/impls/vbs/step8_macros.vbs index 7b54d2f6..ed02107a 100644 --- a/impls/vbs/step8_macros.vbs +++ b/impls/vbs/step8_macros.vbs @@ -342,12 +342,13 @@ Sub REPL() Dim strRes On Error Resume Next strRes = REP(strCode) - If strRes <> "" Then - WScript.Echo strRes - End If If Err.Number <> 0 Then 'WScript.StdErr.WriteLine Err.Source + ": " + Err.Description WScript.StdErr.WriteLine "Exception: " + Err.Description + Else + If strRes <> "" Then + WScript.Echo strRes + End If End If On Error Goto 0 Wend diff --git a/impls/vbs/step9_try.vbs b/impls/vbs/step9_try.vbs index 6c309a9f..8b4af962 100644 --- a/impls/vbs/step9_try.vbs +++ b/impls/vbs/step9_try.vbs @@ -402,9 +402,6 @@ Sub REPL() Dim strRes On Error Resume Next strRes = REP(strCode) - If strRes <> "" Then - WScript.Echo strRes - End If If Err.Number <> 0 Then If Err.Source = "MThrow" Then 'WScript.StdErr.WriteLine Err.Source + ": " + _ @@ -415,6 +412,10 @@ Sub REPL() 'WScript.StdErr.WriteLine Err.Source + ": " + Err.Description WScript.StdErr.WriteLine "Exception: " + Err.Description End If + Else + If strRes <> "" Then + WScript.Echo strRes + End If End If On Error Goto 0 Wend diff --git a/impls/vbs/stepA_mal.vbs b/impls/vbs/stepA_mal.vbs index 542f5f26..d6bc3f3d 100644 --- a/impls/vbs/stepA_mal.vbs +++ b/impls/vbs/stepA_mal.vbs @@ -403,9 +403,6 @@ Sub REPL() Dim strRes On Error Resume Next strRes = REP(strCode) - If strRes <> "" Then - WScript.Echo strRes - End If If Err.Number <> 0 Then If Err.Source = "MThrow" Then 'WScript.StdErr.WriteLine Err.Source + ": " + _ @@ -416,6 +413,10 @@ Sub REPL() 'WScript.StdErr.WriteLine Err.Source + ": " + Err.Description WScript.StdErr.WriteLine "Exception: " + Err.Description End If + Else + If strRes <> "" Then + WScript.Echo strRes + End If End If On Error Goto 0 Wend