[svn:parrot] r45850 - trunk/src/pmc

bacek at svn.parrot.org bacek at svn.parrot.org
Wed Apr 21 09:51:14 UTC 2010


Author: bacek
Date: Wed Apr 21 09:51:13 2010
New Revision: 45850
URL: https://trac.parrot.org/parrot/changeset/45850

Log:
Revert "eliminate LexInfo.thaw that was almost an exact duplicate of
Hash.thaw". It broke LexInfo tests by changing semantic of LexInfo.init.

Modified:
   trunk/src/pmc/lexinfo.pmc

Modified: trunk/src/pmc/lexinfo.pmc
==============================================================================
--- trunk/src/pmc/lexinfo.pmc	Wed Apr 21 09:44:01 2010	(r45849)
+++ trunk/src/pmc/lexinfo.pmc	Wed Apr 21 09:51:13 2010	(r45850)
@@ -56,6 +56,11 @@
     }
 
     VTABLE void init() {
+        Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION,
+                "Cannot create a LexInfo PMC without an initializer");
+    }
+
+    VTABLE void init_pmc(PMC *sub) {
         PARROT_ASSERT(PObj_constant_TEST(SELF));
 
         /* Set value type to INTVAL */
@@ -63,11 +68,6 @@
         PObj_custom_mark_destroy_SETALL(SELF);
     }
 
-    VTABLE void init_pmc(PMC *sub) {
-        UNUSED(sub);
-        SELF.init();
-    }
-
 /*
 
 =item C<void declare_lex_preg(STRING *name, INTVAL preg)>
@@ -125,6 +125,41 @@
             Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
                 "Unknown introspection value '%S'", what);
     }
+
+/*
+
+=item C<void visit(PMC *info)>
+
+=item C<void freeze(PMC *info)>
+
+=item C<void thaw(PMC *info)>
+
+Freeze/thaw interface used during freeze/thaw of the Sub PMC.
+The implementation of the Hash PMC is called.
+
+=cut
+
+*/
+
+
+    VTABLE void thaw(PMC *info) {
+        const INTVAL elems  = VTABLE_shift_integer(INTERP, info);
+        const INTVAL k_type = VTABLE_shift_integer(INTERP, info);
+        const INTVAL v_type = VTABLE_shift_integer(INTERP, info);
+        Hash        *hash;
+
+        UNUSED(k_type);
+        UNUSED(v_type);
+
+        PARROT_ASSERT(v_type == enum_hash_int);
+        /* TODO make a better interface for hash creation
+         * TODO create hash with needed types in the first place
+         */
+
+        SELF.init_pmc(NULL);
+        hash          = (Hash *)SELF.get_pointer();
+        hash->entries = elems;
+    }
 }
 
 
@@ -134,7 +169,7 @@
 
 =head1 SEE ALSO
 
-F<docs/pdds/pdd20_lexical_vars.pod>, F<src/pmc/lexpad.pmc>.
+F<docs/pdds/pdd20_lexical_vars.pod>, F<src/classes/lexpad.pmc>.
 
 =cut
 


More information about the parrot-commits mailing list