@@ -347,8 +347,8 @@ codegenJS_all target definitions includes filename outputType = do
347347 JSIdent (translateName (sMN 0 "runMain"))
348348 ) [JSNum (JSInt 0)]
349349 , JSWhile (JSProj jsCALLSTACK "length") (
350− JSSeq [ JSAlloc "func" (Just (JSApp (JSProj jsCALLSTACK "pop") []))
351− , JSAlloc "args" (Just (JSApp (JSProj jsCALLSTACK "pop") []))
350+ JSSeq [ JSAlloc "func" (Just jsPOP)
351+ , JSAlloc "args" (Just jsPOP)
352352 , JSApp (JSProj (JSIdent "func") "apply") [JSThis, JSIdent "args"]
353353 ]
354354 )
@@ -1358,6 +1358,12 @@ jsTOP :: Int -> JS
13581358jsTOP 0 = JSIndex jsSTACK jsSTACKTOP
13591359jsTOP n = JSIndex jsSTACK (JSBinOp "+" jsSTACKTOP (JSNum (JSInt n)))
13601360
1361+jsPUSH :: [JS] -> JS
1362+jsPUSH args = JSApp (JSProj jsCALLSTACK "push") args
1363+
1364+jsPOP :: JS
1365+jsPOP = JSApp (JSProj jsCALLSTACK "pop") []
1366+
13611367translateBC :: CompileInfo -> BC -> JS
13621368translateBC info bc
13631369 | ASSIGN r1 r2 <- bc = jsASSIGN info r1 r2