Show
Ignore:
Timestamp:
08/23/05 22:18:24 (3 years ago)
Author:
iblech
Message:

* Pugs.PIL1: Added pSubLValue/pLValue to PSub and PCode, indicating the

difference between "sub foo {...}" and "sub foo is rw {...}".

* Pugs.Compile: Extract the (subLValue vcode) and put in in the appropriate

field of PSub/PCode.

* Pugs.CodeGen?.PIR: Accomodate for the above changes.
* Pugs.Parser: Parse traits for anonymous subs, too (i.e. "sub () is rw

{...}" parses and works now).

Files:
1 modified

Legend:

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

    r6248 r6424  
    106106        tellLabel endL 
    107107        return (ExpLV this) 
    108     trans (PCode styp params body) = do 
     108    trans (PCode styp params _ body) = do 
    109109        [begL, endL] <- genLabel ["blockBegin", "blockEnd"] 
    110110        this    <- genPMC "block" 
     
    126126 
    127127instance Translate PIL_Decl Decl where 
    128     trans (PSub name styp params body) | Just (pkg, name') <- isQualified name = do 
    129         declC <- trans $ PSub name' styp params body 
     128    trans (PSub name styp params lvalue body) | Just (pkg, name') <- isQualified name = do 
     129        declC <- trans $ PSub name' styp params lvalue body 
    130130        return $ DeclNS pkg [declC] 
    131     trans (PSub name styp params body) = do 
     131    trans (PSub name styp params _ body) = do 
    132132        (_, stmts)  <- listen $ do 
    133133            let prms = map tpParam params 
     
    186186        tellIns $ lhsC <:= rhsC 
    187187        return lhsC 
    188     trans (PApp _ exp@(PCode _ _ _) Nothing []) = do 
     188    trans (PApp _ exp@(PCode _ _ _ _) Nothing []) = do 
    189189        blockC  <- trans exp 
    190190        tellIns $ [reg tempPMC] <-& blockC $ [] 
     
    383383            , InsNew tempPMC PerlScalar 
    384384            , "store_global"    .- [lit "$_", tempPMC] 
    385             ]) ++ [ StmtRaw (text (name ++ "()")) | PSub name@('_':'_':_) _ _ _ <- pilGlob penv ] ++ 
     385            ]) ++ [ StmtRaw (text (name ++ "()")) | PSub name@('_':'_':_) _ _ _ _ <- pilGlob penv ] ++ 
    386386            [ StmtRaw (text "main()") 
    387387            , StmtIns $ tempPMC  <-- "find_global" $ [lit "Perl6::Internals", lit "&exit"]