Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add test caase for problem raised in TT #1487. Test passes here in br…

…anch

git-svn-id: https://svn.parrot.org/parrot/branches/find_method_object@44551 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information...
commit 90c0436d81b06cf3cbad21d49f51ba6f1920e704 1 parent a108ef2
whiteknight authored
Showing with 60 additions and 26 deletions.
  1. +1 −0  MANIFEST
  2. +0 −26 src/pmc/object.pmc
  3. +59 −0 t/oo/vtable_find_method.t
View
1  MANIFEST
@@ -1795,6 +1795,7 @@ t/oo/ops.t [test]
t/oo/proxy.t [test]
t/oo/root_new.t [test]
t/oo/subclass.t [test]
+t/oo/vtable_find_method.t [test]
t/oo/vtableoverride.t [test]
t/op/00ff-dos.t [test]
t/op/00ff-unix.t [test]
View
26 src/pmc/object.pmc
@@ -107,32 +107,6 @@ get_attrib_index_keyed(PARROT_INTERP, PMC *self, PMC *key, STRING *name)
return -1;
}
-static PMC *
-find_cached(PARROT_INTERP, PMC *_class, STRING *name)
-{
- PMC *cache;
- GETATTR_Class_meth_cache(interp, _class, cache);
-
- if (PMC_IS_NULL(cache))
- return PMCNULL;
-
- return VTABLE_get_pmc_keyed_str(interp, cache, name);
-}
-
-static void
-cache_method(PARROT_INTERP, PMC *_class, STRING *name, PMC *method)
-{
- PMC *cache;
- GETATTR_Class_meth_cache(interp, _class, cache);
-
- if (PMC_IS_NULL(cache)) {
- cache = Parrot_pmc_new(interp, enum_class_Hash);
- SETATTR_Class_meth_cache(interp, _class, cache);
- }
-
- VTABLE_set_pmc_keyed_str(interp, cache, name, method);
-}
-
pmclass Object auto_attrs {
ATTR PMC *_class; /* The class this is an instance of. */
ATTR PMC *attrib_store; /* The attributes store - a resizable PMC array. */
View
59 t/oo/vtable_find_method.t
@@ -0,0 +1,59 @@
+#! parrot
+# Copyright (C) 2007-2009, Parrot Foundation.
+# $Id: vtableoverride.t 36833 2009-02-17 20:09:26Z allison $
+
+=head1 NAME
+
+t/oo/vtable_find_method.t - test various aspects of the find_method vtable
+
+=head1 SYNOPSIS
+
+ % prove t/oo/vtable_find_method.t
+
+=head1 DESCRIPTION
+
+Tests the behavior of the find_method vtable, especially when overriden and
+subclassed.
+
+=cut
+
+.sub main :main
+ .include 'test_more.pir'
+ plan(2)
+
+ override_fails()
+.end
+
+.sub override_fails
+ $P0 = newclass "Test"
+ $P1 = subclass $P0, "MyTest"
+ $P2 = new $P1
+ $P3 = find_method $P2, "foo"
+ $I0 = isnull $P3
+ is($I0, 0, "can find foo in MyTest")
+ $P4 = find_method $P2, "bar"
+ $I0 = isnull $P4
+ is($I0, 0, "can find bar in MyTest from parent")
+.end
+
+.namespace ["Test"]
+
+.sub "bar" :method
+ .return("bar")
+.end
+
+.namespace ["MyTest"]
+
+.sub 'find_method' :vtable
+ .param string name
+ if name == "foo" goto have_foo
+ $P0 = null
+ .return($P0)
+ have_foo:
+ .const 'Sub' foo = 'meth_foo'
+ .return(foo)
+.end
+
+.sub 'meth_foo' :method
+ .return("foo")
+.end
Please sign in to comment.
Something went wrong with that request. Please try again.