on master help sign in
javascript: inline some missed cases
fed330eraichoo
src/IRTS/CodegenJavaScript.hs+10−10
@@ -436,16 +436,16 @@ inlineJS (JSApp (JSIdent "__IDRRT__tailcall") [
436inlineJS (JSApp (JSFunction [arg] (JSReturn ret)) [val])
436inlineJS (JSApp (JSFunction [arg] (JSReturn ret)) [val])
437 | JSNew con [tag, vals] <- ret
437 | JSNew con [tag, vals] <- ret
438 , opt <- inlineJS val =
438 , opt <- inlineJS val =
439− inlineJS $ JSNew con [tag, jsSubst (JSIdent arg) opt vals]
439+ inlineJS $ JSNew con [tag, inlineJS $ jsSubst (JSIdent arg) opt vals]
440
440
441 | JSNew con [JSFunction [] (JSReturn (JSApp fun vars))] <- ret
441 | JSNew con [JSFunction [] (JSReturn (JSApp fun vars))] <- ret
442 , opt <- inlineJS val =
442 , opt <- inlineJS val =
443 inlineJS $ JSNew con [JSFunction [] (
443 inlineJS $ JSNew con [JSFunction [] (
444 JSReturn (
444 JSReturn (
445 JSApp (
445 JSApp (
446− jsSubst (JSIdent arg) opt fun
446+ inlineJS $ jsSubst (JSIdent arg) opt fun
447 ) (
447 ) (
448− map (jsSubst (JSIdent arg) opt) vars
448+ map (inlineJS . jsSubst (JSIdent arg) opt) vars
449 )
449 )
450 )
450 )
451 )]
451 )]
@@ -453,26 +453,26 @@ inlineJS (JSApp (JSFunction [arg] (JSReturn ret)) [val])
453 | JSApp (JSProj obj field) args <- ret
453 | JSApp (JSProj obj field) args <- ret
454 , opt <- inlineJS val =
454 , opt <- inlineJS val =
455 inlineJS $ JSApp (
455 inlineJS $ JSApp (
456− JSProj (jsSubst (JSIdent arg) opt obj) field
456+ inlineJS $ JSProj (jsSubst (JSIdent arg) opt obj) field
457 ) (
457 ) (
458− map (jsSubst (JSIdent arg) opt) args
458+ map (inlineJS . jsSubst (JSIdent arg) opt) args
459 )
459 )
460
460
461 | JSIndex (JSProj obj field) idx <- ret
461 | JSIndex (JSProj obj field) idx <- ret
462 , opt <- inlineJS val =
462 , opt <- inlineJS val =
463 inlineJS $ JSIndex (JSProj (
463 inlineJS $ JSIndex (JSProj (
464− jsSubst (JSIdent arg) opt obj
464+ inlineJS $ jsSubst (JSIdent arg) opt obj
465 ) field
465 ) field
466− ) (jsSubst (JSIdent arg) opt idx)
466+ ) (inlineJS $ jsSubst (JSIdent arg) opt idx)
467
467
468 | JSOp op lhs rhs <- ret
468 | JSOp op lhs rhs <- ret
469 , opt <- inlineJS val =
469 , opt <- inlineJS val =
470− inlineJS $ JSOp op (jsSubst (JSIdent arg) opt lhs) $
470+ inlineJS $ JSOp op (inlineJS $ jsSubst (JSIdent arg) opt lhs) $
471− (jsSubst (JSIdent arg) opt rhs)
471+ (inlineJS $ jsSubst (JSIdent arg) opt rhs)
472
472
473 | JSApp (JSIdent fun) args <- ret
473 | JSApp (JSIdent fun) args <- ret
474 , opt <- inlineJS val =
474 , opt <- inlineJS val =
475− inlineJS $ JSApp (JSIdent fun) $ map (jsSubst (JSIdent arg) opt) args
475+ inlineJS $ JSApp (JSIdent fun) $ map (inlineJS . jsSubst (JSIdent arg) opt) args
476
476
477inlineJS (JSApp fun args) =
477inlineJS (JSApp fun args) =
478 JSApp (inlineJS fun) (map inlineJS args)
478 JSApp (inlineJS fun) (map inlineJS args)