[svn:parrot] r44551 - in branches/find_method_object: . src/pmc t/oo

whiteknight at svn.parrot.org whiteknight at svn.parrot.org
Sun Feb 28 15:14:55 UTC 2010


Author: whiteknight
Date: Sun Feb 28 15:14:53 2010
New Revision: 44551
URL: https://trac.parrot.org/parrot/changeset/44551

Log:
add test caase for problem raised in TT #1487. Test passes here in branch

Added:
   branches/find_method_object/t/oo/vtable_find_method.t
Modified:
   branches/find_method_object/MANIFEST
   branches/find_method_object/src/pmc/object.pmc

Modified: branches/find_method_object/MANIFEST
==============================================================================
--- branches/find_method_object/MANIFEST	Sun Feb 28 14:51:48 2010	(r44550)
+++ branches/find_method_object/MANIFEST	Sun Feb 28 15:14:53 2010	(r44551)
@@ -1795,6 +1795,7 @@
 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]

Modified: branches/find_method_object/src/pmc/object.pmc
==============================================================================
--- branches/find_method_object/src/pmc/object.pmc	Sun Feb 28 14:51:48 2010	(r44550)
+++ branches/find_method_object/src/pmc/object.pmc	Sun Feb 28 15:14:53 2010	(r44551)
@@ -107,32 +107,6 @@
     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. */

Added: branches/find_method_object/t/oo/vtable_find_method.t
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/find_method_object/t/oo/vtable_find_method.t	Sun Feb 28 15:14:53 2010	(r44551)
@@ -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


More information about the parrot-commits mailing list