[svn:parrot] r41204 - trunk/src/pmc
bacek at svn.parrot.org
bacek at svn.parrot.org
Fri Sep 11 12:20:30 UTC 2009
Author: bacek
Date: Fri Sep 11 12:20:27 2009
New Revision: 41204
URL: https://trac.parrot.org/parrot/changeset/41204
Log:
[cage] Apply patch from TT#999 to use more VTABLE_type. Coke++
Also drop explicit store of const strings.
Modified:
trunk/src/pmc/scalar.pmc
Modified: trunk/src/pmc/scalar.pmc
==============================================================================
--- trunk/src/pmc/scalar.pmc Fri Sep 11 09:56:39 2009 (r41203)
+++ trunk/src/pmc/scalar.pmc Fri Sep 11 12:20:27 2009 (r41204)
@@ -96,41 +96,36 @@
*/
VTABLE void assign_pmc(PMC *value) {
- STRING * const s_int = CONST_STRING(INTERP, "Integer");
- STRING *s_num;
- STRING *s_str;
+ INTVAL self_type = VTABLE_type(INTERP,SELF);
+ INTVAL val_type = VTABLE_type(INTERP,value);
- if (SELF->vtable->base_type == enum_class_Boolean)
+ if (self_type == enum_class_Boolean)
/* doesn't morph */
- pmc_reuse(INTERP, SELF, value->vtable->base_type, 0);
+ pmc_reuse(INTERP, SELF, val_type, 0);
- if (value->vtable->base_type == enum_class_Undef) {
- pmc_reuse(INTERP, SELF, value->vtable->base_type, 0);
+ if (val_type == enum_class_Undef) {
+ pmc_reuse(INTERP, SELF, val_type, 0);
return;
}
- if (VTABLE_isa(INTERP, value, s_int)) {
+ if (VTABLE_isa(INTERP, value, CONST_STRING(INTERP, "Integer"))) {
const INTVAL v = VTABLE_get_integer(INTERP, value);
SELF.set_integer_native(v);
return;
}
- s_num = CONST_STRING(INTERP, "Float");
-
- if (VTABLE_isa(INTERP, value, s_num)) {
+ if (VTABLE_isa(INTERP, value, CONST_STRING(INTERP, "Float"))) {
const FLOATVAL v = VTABLE_get_number(INTERP, value);
SELF.set_number_native(v);
return;
}
- s_str = CONST_STRING(INTERP, "String");
-
- if (VTABLE_isa(INTERP, value, s_str)) {
+ if (VTABLE_isa(INTERP, value, CONST_STRING(INTERP, "String"))) {
STRING * const v = VTABLE_get_string(INTERP, value);
SELF.set_string_native(v);
return;
}
- pmc_reuse(INTERP, SELF, value->vtable->base_type, 0);
+ pmc_reuse(INTERP, SELF, val_type, 0);
SELF.set_pmc(value);
}
More information about the parrot-commits
mailing list