Changeset 12871 for src/Pugs/Eval

Show
Ignore:
Timestamp:
08/30/06 08:14:32 (2 years ago)
Author:
audreyt
svk:copy_cache_prev:
19311
Message:

* Calling methods in Embperl5 now works again

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/Eval/Var.hs

    r12800 r12871  
    158158        -> [Exp]      -- ^ Other arguments 
    159159        -> Eval (Either FindSubFailure VCode) 
    160 findSub _var _invs _args = case _invs of 
    161     Nothing -> findBuiltinSub NoMatchingMulti _var 
    162     _ | not (isQualifiedVar _var) -> case unwrap _inv of 
     160findSub _var _invs _args 
     161    | Nothing <- _invs = do 
     162        findBuiltinSub NoMatchingMulti _var 
     163    | not (isQualifiedVar _var) = case unwrap _inv of 
    163164        Val vv@VV{}     -> withExternalCall callMethodVV vv 
    164165        Val sv@PerlSV{} -> withExternalCall callMethodPerl5 sv 
    165166        inv' -> do 
    166167            typ <- evalInvType inv' 
    167             findTypedSub (cast typ) _var 
    168       | Just var' <- dropVarPkg _SUPER _var -> do 
     168            if typ == mkType "Scalar::Perl5" 
     169                then evalExp inv' >>= withExternalCall callMethodPerl5 
     170                else findTypedSub (cast typ) _var 
     171    | Just var' <- dropVarPkg _SUPER _var = do 
    169172        pkg <- asks envPackage 
    170173        findSuperSub pkg var' 
    171       | otherwise -> do 
     174    | otherwise = do 
    172175        findBuiltinSub NoMatchingMulti _var 
    173176    where 
     
    242245                namSVs  <- fmap concat (fromVals named) 
    243246                let svs = posSVs ++ namSVs 
    244                 found   <- liftIO $ canPerl5 sv name 
    245                 found'  <- liftIO $ if found 
    246                     then return found 
    247                     else canPerl5 sv (__"AUTOLOAD") 
    248                 if not found' 
     247                found   <- liftIO $ do 
     248                    rv <- canPerl5 sv name 
     249                    if rv then return rv else canPerl5 sv (__"AUTOLOAD") 
     250                if not found 
    249251                    then do 
    250252                        -- XXX - when svs is empty, this could call back here infinitely