Changeset 22990 for src/Pugs/Eval.hs
- Timestamp:
- 11/12/08 10:01:29 (8 weeks ago)
- Files:
-
- 1 modified
-
src/Pugs/Eval.hs (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Pugs/Eval.hs
r21763 r22990 196 196 -- auto-enreference 197 197 esc $ VRef ref 198 case ref of198 (case ref of 199 199 MkRef IPair{} -> esc (VRef ref) 200 _ -> esc =<< readRef ref 200 _ -> esc =<< readRef ref) :: Eval () 201 201 -- LValue here 202 202 when isCollectionRef $ esc (castV ref) … … 508 508 sub <- fromCodeExp body 509 509 -- XXX this is wrong -- should use Array.next 510 elms <- case av of510 elms <- (case av of 511 511 VRef (MkRef sv@IScalar{}) -> return [sv] 512 VList xs -> return . (`map` xs) $ \x -> case x of512 VList xs -> return . (`map` xs) $ \x -> ((case x of 513 513 VRef (MkRef sv@IScalar{}) -> sv 514 _ -> (IScalar x) 515 _ -> join $ doArray av array_fetchElemAll 514 _ -> (IScalar x)) :: IVar VScalar) 515 _ -> join $ doArray av array_fetchElemAll) :: Eval [IVar VScalar] 516 516 -- This makes "for @x { ... }" into "for @x -> $_ is rw {...}" 517 517 let arity = length (subParams sub) … … 1151 1151 | v <- vals 1152 1152 ] 1153 forceThunk :: Val -> Eval Val 1153 1154 forceThunk (VRef (MkRef (IThunk tv))) = thunk_force tv 1154 1155 forceThunk x = return x … … 1491 1492 --- not scalarRef! -- use the new "transparent IType" thing! 1492 1493 case showType (typeOfSigilVar var) of 1493 "Hash" -> ($ v) . fix $ \(redo :: Val -> Eval Val) x -> case x of1494 "Hash" -> ($ v) . fix $ \(redo :: Val -> Eval Val) x -> (case x of 1494 1495 VRef (MkRef (IHash h)) -> return (VRef $ hashRef h) 1495 1496 VRef ref@(MkRef IScalar{}) -> redo =<< readRef ref 1496 _ -> fmap (VRef . hashRef) (fromVal v :: Eval VHash) 1497 "Array" -> ($ v) . fix $ \(redo :: Val -> Eval Val) x -> case x of1497 _ -> fmap (VRef . hashRef) (fromVal v :: Eval VHash)) :: Eval Val 1498 "Array" -> ($ v) . fix $ \(redo :: Val -> Eval Val) x -> (case x of 1498 1499 VRef (MkRef (IArray a)) -> return (VRef $ arrayRef a) 1499 1500 VRef ref@(MkRef IScalar{}) -> redo =<< readRef ref 1500 _ -> fmap (VRef . arrayRef) (fromVal v :: Eval VArray) 1501 _ -> case v of1501 _ -> fmap (VRef . arrayRef) (fromVal v :: Eval VArray)) :: Eval Val 1502 _ -> (case v of 1502 1503 VRef (MkRef IScalar{}) -> return (VRef $ scalarRef v) 1503 1504 VRef _ -> return v -- XXX - preserving ref 1504 _ -> return (VRef $ scalarRef v) 1505 _ -> return (VRef $ scalarRef v)) :: Eval Val 1505 1506 (False, False) -> return v -- XXX reduce to val? 1506 1507 (False, True) -> do
