2
0
mirror of https://github.com/esiur/esiur-dart.git synced 2026-04-04 02:08:21 +00:00

Static Calling

This commit is contained in:
2022-08-07 23:09:25 +03:00
parent 8eca096b94
commit f5d3ea9ee5
9 changed files with 431 additions and 86 deletions

View File

@@ -23,6 +23,7 @@ SOFTWARE.
*/
import 'dart:async';
import 'dart:ffi';
import '../../Data/IntType.dart';
@@ -45,8 +46,6 @@ import '../Packets/IIPPacketAction.dart';
import '../../Resource/Template/EventTemplate.dart';
class DistributedResource extends IResource {
int? _instanceId;
DistributedConnection? _connection;
@@ -255,8 +254,17 @@ class DistributedResource extends IResource {
if (index >= ins.template.functions.length)
throw new Exception("Function index is incorrect");
return _connection?.sendInvoke(_instanceId as int, index, args)
as AsyncReply;
// return _connection?.sendInvoke(_instanceId as int, index, args)
// as AsyncReply;
var ft = ins.template.getFunctionTemplateByIndex(index);
if (ft == null) throw new Exception("Function template not found.");
if (ft.isStatic)
return _connection?.staticCall(ins.template.classId, index, args);
else
return _connection?.sendInvoke(_instanceId as Int, index, args);
}
operator [](String index) {