[svn:parrot] r37987 - in branches/packfile_revamp: src/pmc t/pmc

bacek at svn.parrot.org bacek at svn.parrot.org
Wed Apr 8 23:44:25 UTC 2009


Author: bacek
Date: Wed Apr  8 23:44:24 2009
New Revision: 37987
URL: https://trac.parrot.org/parrot/changeset/37987

Log:
Fix PackfileConstantTable.set_pmc_keyed_int.

Now it sets PFC_PMC flag. Add more tests for set_*_int methods.

Modified:
   branches/packfile_revamp/src/pmc/packfileconstanttable.pmc
   branches/packfile_revamp/t/pmc/packfileconstanttable.t

Modified: branches/packfile_revamp/src/pmc/packfileconstanttable.pmc
==============================================================================
--- branches/packfile_revamp/src/pmc/packfileconstanttable.pmc	Wed Apr  8 23:44:07 2009	(r37986)
+++ branches/packfile_revamp/src/pmc/packfileconstanttable.pmc	Wed Apr  8 23:44:24 2009	(r37987)
@@ -201,11 +201,13 @@
 
 =cut
 
+TODO: Distinguish between Key and other PMCs.
+
 */
     VTABLE void set_pmc_keyed_int(INTVAL index, PMC *value)  {
         PackFile_ConstTable *pftable = PMC_data_typed(SELF, PackFile_ConstTable *);
         PackFile_Constant   *constant = vivify(interp, pftable, index);
-        constant->type  = PFC_KEY;
+        constant->type  = PFC_PMC;
         constant->u.key = value;
     }
 

Modified: branches/packfile_revamp/t/pmc/packfileconstanttable.t
==============================================================================
--- branches/packfile_revamp/t/pmc/packfileconstanttable.t	Wed Apr  8 23:44:07 2009	(r37986)
+++ branches/packfile_revamp/t/pmc/packfileconstanttable.t	Wed Apr  8 23:44:24 2009	(r37987)
@@ -24,7 +24,7 @@
 
 .sub 'main' :main
 .include 'test_more.pir'
-	'plan'(7)
+	'plan'(10)
 
 	'test_sanity'()
 	'test_elements'()
@@ -133,6 +133,14 @@
 	$I0 = elements ct
 	is($I0, 3, "PMC elements added")
 
+    # Check types of created constants
+    $I0 = ct.'get_type'(0)
+    is($I0, 0x73, "First element is string")
+    $I0 = ct.'get_type'(1)
+    is($I0, 0x6E, "Second element is number")
+    $I0 = ct.'get_type'(2)
+    is($I0, 0x70, "Third element is PMC")
+
 .end
 
 


More information about the parrot-commits mailing list