Skip to content

Commit

Permalink
Fix inadvertant creation of destructor property.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmiw committed Dec 26, 2012
1 parent 8107250 commit 823ff36
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
5 changes: 5 additions & 0 deletions src/stdlib/System/dynamic_object.cpp
Expand Up @@ -97,6 +97,11 @@ void kite_dynamic_object_set_parent(void *object, void *parent)
System::method *method = (System::method*)*ptr;
kite_dynamic_object_enable_finalizer(object, method->method_ptr);
}
else
{
// Erase the item get_property created.
((System::dynamic_object*)object)->properties.erase("__destruct____o");
}
}

void kite_dynamic_object_set_name(void *object, char *name)
Expand Down
22 changes: 14 additions & 8 deletions src/stdlib/System/object.cpp
Expand Up @@ -325,17 +325,20 @@ void *get_property__oo(void *obj, void *prop)
System::dynamic_object *object = (System::dynamic_object*)obj;
if (object->type != kite::semantics::OBJECT)
{
return new System::string("");
return NULL;
}

System::string *key = (System::string*)prop;

System::object *val;
System::object *val = NULL;
do
{
val = object->properties[key->string_val.c_str()];
if (object->properties.count(key->string_val) > 0)
{
val = object->properties[key->string_val];
}
object = (System::dynamic_object*)object->parent;
} while (object && object->properties.find(key->string_val.c_str()) != object->properties.end());
} while (object && object->properties.count(key->string_val) == 0);

return val;
}
Expand All @@ -345,15 +348,18 @@ void *get_property__os(void *obj, const char *prop)
System::dynamic_object *object = (System::dynamic_object*)obj;
if (object->type != kite::semantics::OBJECT)
{
return new System::string("");
return NULL;
}

System::object *val;
System::object *val = NULL;
do
{
val = object->properties[prop];
if (object->properties.count(prop) > 0)
{
val = object->properties[prop];
}
object = (System::dynamic_object*)object->parent;
} while (object && object->properties.find(prop) != object->properties.end());
} while (object && object->properties.count(prop) == 0);

return val;
}
Expand Down

0 comments on commit 823ff36

Please sign in to comment.