[svn:parrot] r48785 - in trunk: src/pmc t/pmc
chromatic at svn.parrot.org
chromatic at svn.parrot.org
Sat Sep 4 16:58:07 UTC 2010
Author: chromatic
Date: Sat Sep 4 16:58:07 2010
New Revision: 48785
URL: https://trac.parrot.org/parrot/changeset/48785
Log:
[OO] Removed PIR overriding of Object's get_class.
You're asking for strange and wonderful and bad behavior if you do this, so
nothing does it, so why pay the NQP-rx penalty for it? When we get a more
flexible metaobject system, people can do the kinds of things they need here in
a different (better and safer) way.
Modified:
trunk/src/pmc/object.pmc
trunk/t/pmc/object-meths.t
Modified: trunk/src/pmc/object.pmc
==============================================================================
--- trunk/src/pmc/object.pmc Sat Sep 4 15:28:42 2010 (r48784)
+++ trunk/src/pmc/object.pmc Sat Sep 4 16:58:07 2010 (r48785)
@@ -594,20 +594,7 @@
*/
VTABLE PMC *get_class() {
- PMC * const classobj = PARROT_OBJECT(SELF)->_class;
- STRING * const get_class = CONST_STRING(INTERP, "get_class");
-
- /* If there's a vtable override for 'get_class' run that instead. */
- PMC * const method = Parrot_oo_find_vtable_override(INTERP,
- classobj, get_class);
-
- if (!PMC_IS_NULL(method)) {
- PMC *result;
- Parrot_ext_call(INTERP, method, "Pi->P", SELF, &result);
- return result;
- }
-
- return classobj;
+ return PARROT_OBJECT(SELF)->_class;
}
Modified: trunk/t/pmc/object-meths.t
==============================================================================
--- trunk/t/pmc/object-meths.t Sat Sep 4 15:28:42 2010 (r48784)
+++ trunk/t/pmc/object-meths.t Sat Sep 4 16:58:07 2010 (r48785)
@@ -1,12 +1,12 @@
#! perl
-# Copyright (C) 2001-2009, Parrot Foundation.
+# Copyright (C) 2001-2010, Parrot Foundation.
# $Id$
use strict;
use warnings;
use lib qw( . lib ../lib ../../lib );
use Test::More;
-use Parrot::Test tests => 37;
+use Parrot::Test tests => 36;
=head1 NAME
@@ -1080,24 +1080,6 @@
get_attr_str was called
OUTPUT
-pir_output_is( <<'CODE', <<'OUTPUT', "overloading get_class vtable" );
-.sub main :main
- .local pmc cl, o, cl2
- cl = newclass 'MyClass'
- o = new ['MyClass']
- cl2 = class o
-.end
-
-.namespace ['MyClass']
-
-.sub get_class :method :vtable
- print "get_class was called\n"
-.end
-
-CODE
-get_class was called
-OUTPUT
-
pir_error_output_like( <<'CODE', <<'OUTPUT', "method called on non-object" );
.namespace [ 'Foo' ]
More information about the parrot-commits
mailing list