mirror of
https://git.tesses.org/tesses50/crosslang.git
synced 2026-06-13 07:15:31 +00:00
Fix bug with classes, use slim exclusively, add package private data and change rehaul cmake configs
This commit is contained in:
@@ -2,53 +2,46 @@
|
||||
#include "TessesFramework/Serialization/BitConverter.hpp"
|
||||
#include "TessesFramework/Streams/ByteReader.hpp"
|
||||
#include "TessesFramework/Uuid.hpp"
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <cstring>
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include <sstream>
|
||||
#include <variant>
|
||||
|
||||
namespace Tesses::CrossLang {
|
||||
|
||||
bool InterperterThread::InvokeMethod(GCList& ls, TObject fn, TObject instance, std::vector<TObject> args)
|
||||
{
|
||||
|
||||
if(std::holds_alternative<THeapObjectHolder>(fn))
|
||||
{
|
||||
|
||||
auto obj = dynamic_cast<TCallable*>(std::get<THeapObjectHolder>(fn).obj);
|
||||
if(obj != nullptr)
|
||||
{
|
||||
auto closure = dynamic_cast<TClosure*>(obj);
|
||||
if(closure != nullptr)
|
||||
{
|
||||
|
||||
if(!closure->closure->args.empty() && closure->closure->args[0] == "this")
|
||||
{
|
||||
std::vector<TObject> args2;
|
||||
args2.push_back(instance);
|
||||
args2.insert(args2.end(), args.begin(),args.end());
|
||||
this->AddCallStackEntry(ls,closure,args2);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->AddCallStackEntry(ls,closure,args);
|
||||
}
|
||||
|
||||
bool InterperterThread::InvokeMethod(GCList &ls, TObject fn, TObject instance,
|
||||
std::vector<TObject> args) {
|
||||
|
||||
if (std::holds_alternative<THeapObjectHolder>(fn)) {
|
||||
|
||||
auto obj =
|
||||
dynamic_cast<TCallable *>(std::get<THeapObjectHolder>(fn).obj);
|
||||
if (obj != nullptr) {
|
||||
auto closure = dynamic_cast<TClosure *>(obj);
|
||||
if (closure != nullptr) {
|
||||
|
||||
if (!closure->closure->args.empty() &&
|
||||
closure->closure->args[0] == "this") {
|
||||
std::vector<TObject> args2;
|
||||
args2.push_back(instance);
|
||||
args2.insert(args2.end(), args.begin(), args.end());
|
||||
this->AddCallStackEntry(ls, closure, args2);
|
||||
} else {
|
||||
this->AddCallStackEntry(ls, closure, args);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto val = obj->Call(ls,args);
|
||||
this->call_stack_entries.back()->Push(ls.GetGC(), val);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
} else {
|
||||
auto val = obj->Call(ls, args);
|
||||
this->call_stack_entries.back()->Push(ls.GetGC(), val);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
this->call_stack_entries.back()->Push(ls.GetGC(),Undefined());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
this->call_stack_entries.back()->Push(ls.GetGC(), Undefined());
|
||||
return false;
|
||||
}
|
||||
} // namespace Tesses::CrossLang
|
||||
Reference in New Issue
Block a user