mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-19 09:51:33 +00:00
Fix contextual type argument propagation when calling function expressions; Implement indirect calls to concrete functions
This commit is contained in:
@ -4550,6 +4550,16 @@ export class Compiler extends DiagnosticEmitter {
|
||||
}
|
||||
return this.module.createGetGlobal((<EnumValue>element).internalName, NativeType.I32);
|
||||
}
|
||||
case ElementKind.FUNCTION_PROTOTYPE: {
|
||||
let instance = (<FunctionPrototype>element).resolve(
|
||||
null,
|
||||
this.currentFunction.contextualTypeArguments
|
||||
);
|
||||
if (!(instance && this.compileFunction(instance))) return module.createUnreachable();
|
||||
let index = this.ensureFunctionTableEntry(instance);
|
||||
this.currentType = Type.u32.asFunction(instance.signature);
|
||||
return this.module.createI32(index);
|
||||
}
|
||||
}
|
||||
this.error(
|
||||
DiagnosticCode.Operation_not_supported,
|
||||
|
@ -1892,7 +1892,7 @@ export class Program extends DiagnosticEmitter {
|
||||
if (element && element.kind == ElementKind.FUNCTION_PROTOTYPE) {
|
||||
let instance = (<FunctionPrototype>element).resolveUsingTypeArguments(
|
||||
(<CallExpression>expression).typeArguments,
|
||||
null,
|
||||
contextualFunction.contextualTypeArguments,
|
||||
expression
|
||||
);
|
||||
if (instance) {
|
||||
|
Reference in New Issue
Block a user