[svn:parrot] r42902 - in trunk: src/pmc t/pmc

chromatic at svn.parrot.org chromatic at svn.parrot.org
Sat Dec 5 22:48:31 UTC 2009


Author: chromatic
Date: Sat Dec  5 22:48:31 2009
New Revision: 42902
URL: https://trac.parrot.org/parrot/changeset/42902

Log:
[PCC] Made boxed incoming parameters respect HLL map types (reported by Patrick
Michaud).

Modified:
   trunk/src/pmc/callsignature.pmc
   trunk/t/pmc/parrotinterpreter.t

Modified: trunk/src/pmc/callsignature.pmc
==============================================================================
--- trunk/src/pmc/callsignature.pmc	Sat Dec  5 22:36:21 2009	(r42901)
+++ trunk/src/pmc/callsignature.pmc	Sat Dec  5 22:48:31 2009	(r42902)
@@ -101,6 +101,8 @@
         a->positionals  = (cell); \
     } while (0)
 
+#define HLL_TYPE(i) Parrot_get_ctx_HLL_type(interp, (i))
+
 /* TODO: could use get_cell_at */
 static Pcc_cell *
 pop_cell(PARROT_INTERP, ARGIN(PMC *SELF))
@@ -251,18 +253,17 @@
 {
     PMC *result = PMCNULL;
 
-    /* TODO: respect HLL types? */
     switch (CELL_TYPE_MASK(cell)) {
         case INTCELL:
-            result = pmc_new(interp, enum_class_Integer);
+            result = pmc_new(interp, HLL_TYPE(enum_class_Integer));
             VTABLE_set_integer_native(interp, result, CELL_INT(cell));
             break;
         case FLOATCELL:
-            result = pmc_new(interp, enum_class_Float);
+            result = pmc_new(interp, HLL_TYPE(enum_class_Float));
             VTABLE_set_number_native(interp, result, CELL_FLOAT(cell));
             break;
         case STRINGCELL:
-            result = pmc_new(interp, enum_class_String);
+            result = pmc_new(interp, HLL_TYPE(enum_class_String));
             VTABLE_set_string_native(interp, result, CELL_STRING(cell));
             break;
         case PMCCELL:

Modified: trunk/t/pmc/parrotinterpreter.t
==============================================================================
--- trunk/t/pmc/parrotinterpreter.t	Sat Dec  5 22:36:21 2009	(r42901)
+++ trunk/t/pmc/parrotinterpreter.t	Sat Dec  5 22:48:31 2009	(r42902)
@@ -21,9 +21,9 @@
 .sub main :main
 .include 'test_more.pir'
 
-    plan(11)
+    plan(12)
     test_new()      # 1 test
-    test_hll_map()  # 2 tests
+    test_hll_map()  # 3 tests
 
 # Need for testing
 .annotate 'foo', 'bar'
@@ -46,15 +46,22 @@
     $P2.'hll_map'($P0, $P1)
 
     $P3 = 'foo'()
-    is($P3,3)
+    is($P3, 3)
     $S0 = typeof $P3
-    is($S0,"MyInt")
+    is($S0, "MyInt")
+    bar(4)
 .end
 
 .sub foo
     .return (3)
 .end
 
+.sub bar
+    .param pmc n
+    $S0 = typeof n
+    is($S0, 'MyInt')
+.end
+
 # Switch back to root namespace
 .HLL 'parrot'
 


More information about the parrot-commits mailing list