| 167 | | | not (isQualifiedVar _var) = case unwrap _inv of |
| 168 | | Val vv@VV{} -> withExternalCall callMethodVV vv |
| 169 | | Val sv@PerlSV{} -> withExternalCall callMethodPerl5 sv |
| 170 | | inv' -> do |
| 171 | | typ <- evalInvType inv' |
| 172 | | if typ == mkType "Scalar::Perl5" |
| 173 | | then evalExp inv' >>= withExternalCall callMethodPerl5 |
| 174 | | else findTypedSub (cast typ) _var |
| | 166 | | not (isQualifiedVar _var) = do |
| | 167 | case unwrap _inv of |
| | 168 | Val vv@VV{} -> withExternalCall callMethodVV vv |
| | 169 | Val sv@PerlSV{} -> withExternalCall callMethodVV sv |
| | 170 | inv' -> do |
| | 171 | typ <- evalInvType inv' |
| | 172 | if typ == mkType "Scalar::Perl5" -- code for "VV" |
| | 173 | then evalExp inv' >>= withExternalCall callMethodVV |
| | 174 | else findTypedSub (cast typ) _var |
| 233 | | return (key, [val]) :: Eval (ID, [Val.Val]) |
| 234 | | |
| 235 | | -- This is the Capture object we are going to work with |
| 236 | | -- let capt = CaptMeth invVV (MkArguments Val.MkFeed posVVs namVVs] |
| 237 | | -- callMethod methName [] |
| 238 | | -- inv ./ meth = ivDispatch inv $ MkMethodInvocation meth (mkArgs []) |
| 239 | | resVV <- invVV ./ cast methName |
| 240 | | return . castV $ resVV |
| | 233 | return (key, val) :: Eval (ID, Val.Val) |
| | 234 | rv <- tryT $ do |
| | 235 | resVV <- invVV ./ (methName, posVVs, namVVs) |
| | 236 | vvToVal resVV |
| | 237 | case rv of |
| | 238 | VError (VStr s) _ |
| | 239 | | "Can't locate object method" `isPrefixOf` s || "Can't call method" `isPrefixOf` s -> do |
| | 240 | let capt = miArguments (cast (methName, (invVV:posVVs), namVVs) :: Call) |
| | 241 | rv' <- tryT . evalExp $ App (Var _var{ v_sigil = SCodeMulti }) Nothing [Syn "|" [Val (VV (mkVal capt))]] |
| | 242 | case rv' of |
| | 243 | VError (VStr s') _ | "No compatible subroutine found" `isPrefixOf` s' -> EvalT $ return (RException rv) |
| | 244 | VError{} -> EvalT $ return (RException rv') |
| | 245 | _ -> return rv' |
| | 246 | VError{} -> EvalT $ return (RException rv) |
| | 247 | _ -> return rv |