Changeset 13817 for src/Pugs/Eval
- Timestamp:
- 10/03/06 14:06:33 (2 years ago)
- Files:
-
- 1 modified
-
src/Pugs/Eval/Var.hs (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Pugs/Eval/Var.hs
r13801 r13817 327 327 isNamedArg _ = False 328 328 rv = return $ arityMatch sub (length positional) (length named) slurpLen 329 329 330 maybeM rv $ \fun -> do 330 331 331 -- if deltaFromCxt ret == 0 then return Nothing else do 332 332 let pairs = [ typeOfParam p | p <- prms, not (isSlurpy p) ] `zip` _invs_args … … 657 657 arityMatch :: VCode -> Int -> Int -> Int -> Maybe VCode 658 658 arityMatch sub@MkCode{ subAssoc = assoc, subParams = prms } posLen namLen argSlurpLen 659 | A_list <- assoc = Just sub 660 | A_chain <- assoc = Just sub 659 | A_list <- assoc = Just sub 660 | A_chain <- assoc = Just sub 661 661 662 | isNothing $ find (not . isSlurpy) prms -- XXX - what about empty ones? 662 , slurpLen <- length $ filter (\p -> isSlurpy p && v_sigil (paramName p) == SScalar) prms663 , hasArray <- isJust $ find (\p -> isSlurpy p && v_sigil (paramName p) == SArray) prms663 , slurpLen <- length $ filter (\p -> isSlurpy p && v_sigil (paramName p) == SScalar) prms 664 , hasArray <- isJust $ find (\p -> isSlurpy p && v_sigil (paramName p) == SArray) prms 664 665 , if hasArray then slurpLen <= argSlurpLen else slurpLen == argSlurpLen 665 666 = Just sub 666 | reqLen <- length $ filter (\p -> not (isOptional p || isSlurpy p)) prms 667 , optLen <- length $ filter (\p -> isOptional p) prms 668 , hasArray <- isJust $ find (\p -> isSlurpy p && v_sigil (paramName p) == SArray) prms 669 , hasHash <- isJust $ find (\p -> isSlurpy p && v_sigil (paramName p) == SHash) prms 667 668 | reqLen <- length $ filter (\p -> not (isOptional p) || isSlurpy p && v_sigil (paramName p) == SScalar) prms 669 , optLen <- length $ filter (\p -> isOptional p) prms 670 , hasArray <- isJust $ find (\p -> isSlurpy p && v_sigil (paramName p) == SArray) prms 671 , hasHash <- isJust $ find (\p -> isSlurpy p && v_sigil (paramName p) == SHash) prms 670 672 , argLen >= reqLen && (hasArray || (if hasHash then posLen else argLen) <= (reqLen + optLen)) 671 673 = Just sub 674 672 675 | otherwise 673 676 = Nothing
