Skip to content

Commit 4870b17

Browse files
committed
feat: make unit test works
1 parent 3c0df72 commit 4870b17

File tree

5 files changed

+96
-284
lines changed

5 files changed

+96
-284
lines changed

src/parser.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -653,10 +653,8 @@ function defaultReader(x) {
653653
}
654654
}
655655

656-
function compile(
657-
lang,
658-
txt,
659-
{
656+
function compile(lang, txt, options = {}) {
657+
const {
660658
romanizeIdentifiers = "none",
661659
resetVarCnt,
662660
logCallback = x =>
@@ -666,8 +664,8 @@ function compile(
666664
errorCallback = process.exit,
667665
lib = typeof STDLIB == "undefined" ? {} : STDLIB,
668666
reader = defaultReader
669-
} = {}
670-
) {
667+
} = options;
668+
671669
if (resetVarCnt) idenMap = {};
672670
txt = (txt || "").replace(/\r\n/g, "\n");
673671

src/stdlib.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
const STDLIB = {};
2+
13
try {
24
function loadStdlib() {
35
const STDLIB = {};
@@ -17,6 +19,6 @@ try {
1719

1820
return STDLIB;
1921
}
20-
21-
module.exports = loadStdlib();
22+
STDLIB = loadStdlib();
23+
module.exports = STDLIB;
2224
} catch (e) {}

0 commit comments

Comments
 (0)