Show
Ignore:
Timestamp:
06/20/05 19:08:03 (4 years ago)
Author:
autrijus
svk:copy_cache_prev:
6641
Message:

* closures: my $x = { say 5 }; $x() ; $x()

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/Compile/PIR.hs

    r4874 r4875  
    344344        -- XXX I'd like to lambda lift... :-/ 
    345345        _       <- askTCxt 
    346         bodyC   <- compile (subBody sub) 
     346        bodyC   <- compile $ case subBody sub of 
     347            Syn "block" [exp]   -> exp 
     348            exp                 -> exp 
    347349        return $ PBlock bodyC 
    348350    compile (Syn "for" _) = compile Noop -- XXX TODO 
     
    473475        [begC, endC] <- genLabel ["blockBegin", "blockEnd"] 
    474476        this    <- genPMC "block" 
    475         tellIns $ "newsub" .- [reg this, bare ".Continuation", bare begC] 
     477        tellIns $ "newsub" .- [reg this, bare ".Closure", bare begC] 
    476478        tellIns $ "goto" .- [bare endC] 
    477479        tellLabel begC 
    478         cc      <- genPMC "cc" 
    479         fetchCC cc (reg this) 
    480480        trans body  -- XXX - consistency check 
    481481        bodyC   <- lastPMC 
    482         tellIns $ if parrotBrokenXXX 
    483             then "store_global" .- [tempSTR, bodyC] -- XXX HACK 
    484             else "set_args" .- [lit "(0b10)", bodyC] 
    485 --      tellIns $ "invoke" .- [reg cc] 
     482        tellIns $ "set_returns" .- retSigList [bodyC] 
     483        tellIns $ "returncc" .- [] 
    486484        tellLabel endC 
    487485        return (ExpLV this)