Skip to content

Commit da5c2b5

Browse files
LingDong-Lingdong Huang
authored andcommitted
extend catch
1 parent 52124db commit da5c2b5

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

examples/try.wy

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
豈「「滅頂」」之禍歟。
1515
吾有一言。曰「「嗚呼哀哉。伏维尚飨」」。書之。
1616

17-
不知何禍歟。
17+
不知何禍歟。名之曰「奇禍」。
1818
吾有一言。曰「「人坐家中。禍從天降」」。書之。
1919

2020
乃作罷。
@@ -26,9 +26,6 @@
2626

2727

2828
姑妄行此。
29-
嗚呼。「「無妄」」之禍。
29+
嗚呼。「「事不關心」」之禍。
3030

31-
如事不諧。不知何禍歟。
32-
吾有一言。曰「「事不關心。關心者亂」」。書之。
33-
34-
乃作罷。
31+
如事不諧。不知何禍歟。書之。乃作罷。

src/parser.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -827,9 +827,12 @@ function asc2js(asc, imports = []) {
827827
} else if (a.op == "catcherr") {
828828
var ec = errcurlvls[errcurlvls.length - 1];
829829
if (a.error == undefined) {
830+
var vname = nextTmpVar();
831+
strayvar.push(vname);
830832
if (curlvl != ec[0]) {
831833
js += `}else{`;
832834
}
835+
js += `var ${vname}=${ec[1]}.name;`;
833836
} else {
834837
if (curlvl != ec[0]) {
835838
js += `}else `;

0 commit comments

Comments
 (0)