2
0
mirror of https://github.com/esiur/esiur-dart.git synced 2026-04-03 17:58: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

@@ -2,7 +2,6 @@ import 'MemberTemplate.dart';
import '../../Data/DC.dart';
import '../../Data/BinaryList.dart';
import 'TypeTemplate.dart';
import 'MemberType.dart';
import 'ArgumentTemplate.dart';
import '../../Data/RepresentationType.dart';
@@ -12,6 +11,7 @@ class FunctionTemplate extends MemberTemplate {
List<ArgumentTemplate> arguments;
RepresentationType returnType;
bool isStatic;
DC compose() {
var name = super.compose();
@@ -29,15 +29,15 @@ class FunctionTemplate extends MemberTemplate {
bl
..addInt32(exp.length)
..addDC(exp);
bl.insertUint8(0, inherited ? 0x90 : 0x10);
bl.insertUint8(0, (inherited ? 0x90 : 0x10) | (isStatic ? 0x4 : 0));
} else
bl.insertUint8(0, inherited ? 0x80 : 0x0);
bl.insertUint8(0, (inherited ? 0x80 : 0x0) | (isStatic ? 0x4 : 0));
return bl.toDC();
}
FunctionTemplate(TypeTemplate template, int index, String name,
bool inherited, this.arguments, this.returnType,
bool inherited, this.isStatic, this.arguments, this.returnType,
[this.annotation = null])
: super(template, index, name, inherited) {}
}

View File

@@ -305,7 +305,6 @@ class TypeTemplate {
_className = data.getString(offset + 1, data[offset]);
offset += data[offset] + 1;
if (hasParent) {
_parentId = data.getGuid(offset);
offset += 16;
@@ -316,7 +315,6 @@ class TypeTemplate {
offset += 2;
_annotation = data.getString(offset, len);
offset += len;
}
_version = data.getInt32(offset);
@@ -337,6 +335,8 @@ class TypeTemplate {
if (type == 0) // function
{
String? annotation = null;
var isStatic = ((data[offset] & 0x4) == 0x4);
var hasAnnotation = ((data[offset++] & 0x10) == 0x10);
var name = data.getString(offset + 1, data[offset]);
@@ -364,7 +364,7 @@ class TypeTemplate {
}
var ft = new FunctionTemplate(this, functionIndex++, name, inherited,
arguments, dt.type, annotation);
isStatic, arguments, dt.type, annotation);
_functions.add(ft);
} else if (type == 1) // property