2
0
mirror of https://github.com/esiur/esiur-js.git synced 2026-04-03 21:48:21 +00:00

Static Calling

This commit is contained in:
2022-08-07 23:08:33 +03:00
parent 551f0f4684
commit bf861395c3
10 changed files with 429 additions and 77 deletions

View File

@@ -46,18 +46,19 @@ export default class FunctionTemplate extends MemberTemplate {
bl
.addInt32(exp.length)
.addDC(exp);
bl.insertUint8(0, this.inherited ? 0x90 : 0x10);
bl.insertUint8(0, (this.inherited ? 0x90 : 0x10) | (this.isStatic ? 0x4 : 0));
} else
bl.insertUint8(0, this.inherited ? 0x80 : 0x0);
bl.insertUint8(0, (this.inherited ? 0x80 : 0x0) | (this.isStatic ? 0x4 : 0));
return bl.toDC();
}
constructor(template, index, name, inherited, args, returnType, annotation = null){
constructor(template, index, name, inherited, isStatic, args, returnType, annotation = null){
super(template, index, name, inherited);
this.args = args;
this.returnType = returnType;
this.annotation = annotation;
this.isStatic = isStatic;
}
}

View File

@@ -452,6 +452,7 @@ export default class TypeTemplate {
if (type == 0) // function
{
let annotation = null;
let isStatic = ((data[offset] & 0x4) == 0x4);
let hasAnnotation = ((data.getUint8(offset++) & 0x10) == 0x10);
let len = data.getUint8(offset++);
@@ -484,7 +485,7 @@ export default class TypeTemplate {
offset += cs;
}
let ft = new FunctionTemplate(od, functionIndex++, name, inherited,
let ft = new FunctionTemplate(od, functionIndex++, name, inherited, isStatic,
args, dt.type, annotation);
od.functions.push(ft);