Skip to content

Commit

Permalink
ACTIONSCRIPT: Enable calling objects themselves
Browse files Browse the repository at this point in the history
  • Loading branch information
Nostritius authored and DrMcCoy committed Sep 30, 2019
1 parent 864311f commit 1550d7b
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/aurora/actionscript/object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,21 @@ void Object::setMember(const Common::UString &id, Function *function) {
}

Variable Object::call(const Common::UString &function, AVM &avm, const std::vector<Variable> &arguments) {
if (!hasMember(function))
throw Common::Exception("object has no member %s", function.c_str());
Function *f = reinterpret_cast<Function *>(getMember(function).asObject().get());

if (!getMember(function).isFunction())
throw Common::Exception("%s is no method", function.c_str());
if (!function.empty()) {
if (!hasMember(function))
throw Common::Exception("object has no member %s", function.c_str());

Function *f = reinterpret_cast<Function *>(getMember(function).asObject().get());
if (!getMember(function).isFunction())
throw Common::Exception("%s is no method", function.c_str());

f = reinterpret_cast<Function *>(getMember(function).asObject().get());
} else {
f = dynamic_cast<Function *>(this);
if (!f)
throw Common::Exception("Object is no function");
}

byte counter = 1;
if (f->getPreloadRootFlag()) {
Expand Down

0 comments on commit 1550d7b

Please sign in to comment.