cell type() const { return TAG(value_); }
- bool type_p(cell type_) const { return type() == type_; }
-
bool type_p() const {
if (Type::type_number == TYPE_COUNT)
return true;
- else
- return type_p(Type::type_number);
+ return type() == Type::type_number;
}
cell value() const {
return (Type*)(UNTAG(value_));
}
- Type* untag_check(factor_vm* parent) const {
- if (!type_p())
- parent->type_error(Type::type_number, value_);
- return untagged();
- }
-
explicit tagged(cell tagged) : value_(tagged) {}
explicit tagged(Type* untagged) : value_(factor::tag(untagged)) {}
}
};
-template <typename Type> Type* factor_vm::untag_check(cell value) {
- return tagged<Type>(value).untag_check(this);
-}
-
template <typename Type> Type* untag(cell value) {
return tagged<Type>(value).untagged();
}