Changeset 6801 for src/Pugs/CodeGen

Show
Ignore:
Timestamp:
09/06/05 17:00:17 (3 years ago)
Author:
iblech
Message:

* Usual svn props.
* t/var/constant.t: Minor fixes.
* Pugs.PIL1, Pugs.Compile: PSub and PCode contain a p[Sub]?IsMulti? field now,

so PIL2JS and PIL-Run can know which subs are multis and which subs are not.

* Pugs.CodeGen?.PIR: Accomodate for the above change.
* PIL2JS: (Simple) multi subs!

  • PIL2JS.js: If necessary, try to call all .variants of a multi to find out whether the parameters match the sub signature. (Hack)
  • PIL::Subs: Emit appropriate code for multis --

multi foo {...} # is compiled as
our &foo ::= PIL2JS.new_multi(); &foo.add_variant({...});

* Test.pm: Removed the skip_rest_anti_multi-hack which was previously needed

for PIL2JS. :)

Files:
1 modified

Legend:

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

    r6424 r6801  
    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 lvalue body) | Just (pkg, name') <- isQualified name = do 
    129         declC <- trans $ PSub name' styp params lvalue body 
     128    trans (PSub name styp params lvalue ismulti body) | Just (pkg, name') <- isQualified name = do 
     129        declC <- trans $ PSub name' styp params lvalue ismulti 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"]