Changeset 6594 for src/Pugs/Compile.hs

Show
Ignore:
Timestamp:
08/30/05 22:57:49 (3 years ago)
Author:
putter
Message:

pugs - a Syn package/namespace now remembers whether it was a package/module/class/etc. When compiling to PIL, emit a kludge declaration info statement (eg &Module::_create("M"); for a module M {...}).
Prelude/JS.pm: added placeholder hooks for declaration info calls.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/Compile.hs

    r6589 r6594  
    167167        tailCall (PPos pos exp x) = PPos pos exp (tailCall x) 
    168168        tailCall x = x 
    169     Stmts this (Syn "namespace" [Val (VStr pkg), rest]) -> do 
     169    Stmts this (Syn "namespace" [Val (VStr sym), Val (VStr pkg), rest]) -> do 
    170170        thisC   <- enter cxtVoid $ compile this 
     171        declC   <- enter cxtVoid $ compile decl 
    171172        restC   <- enterPackage pkg $ compileStmts rest 
    172         return $ PStmts thisC restC 
     173        return $ PStmts thisC $ PStmts declC restC 
     174        where 
     175          -- XXX - kludge. 
     176          decl = App (Var func) Nothing [(Val (VStr pkg))] 
     177          func = "&" ++ (capitalize sym) ++ "::_create" 
     178          capitalize []     = [] 
     179          capitalize (c:cs) = toUpper c:cs 
     180 
    173181    Stmts this rest -> do 
    174182        thisC   <- enter cxtVoid $ compile this