void load_class( context &ctx, object &constructor) { root_object prototype(T::class_info::create_prototype()); ctx.add_prototype<T>(prototype); prototype.define_property( "constructor", constructor, permanent_property | read_only_property | dont_enumerate); root_value old_to_string(prototype.get_property("toString")); if (old_to_string == ctx.prototype("").get_property("toString") || root_object(old_to_string.to_object()).get_property("auto").to_boolean()) { root_object fn( flusspferd::create<function>( "toString", &default_to_string<T>, param::_container = prototype)); fn.set_property("auto", true); } root_value old_to_source(prototype.get_property("toSource")); if (old_to_source == ctx.prototype("").get_property("toSource") || root_object(old_to_source.to_object()).get_property("auto").to_boolean()) { root_object fn( flusspferd::create<function>( "toSource", &default_to_source<T>, param::_container = prototype)); fn.set_property("auto", true); } constructor.define_property( "prototype", prototype, dont_enumerate); T::class_info::augment_constructor(constructor); }
void object_descriptor_exprt::build( const exprt &expr, const namespacet &ns) { assert(object().id()==ID_unknown); object()=expr; if(offset().id()==ID_unknown) offset()=from_integer(0, signedbv_typet(config.ansi_c.pointer_width)); build_object_descriptor_rec(ns, expr, *this); assert(root_object().type().id()!=ID_empty); }