Avoid trampolines where optional arguments are constant literals, see #102; Fix temporary local flags not being cleared; Fix inlined temporary locals not being free'd; Fix inlined flows not breaking after returns; Allow changetype of u32s, i.e. function pointers

This commit is contained in:
dcodeIO
2018-05-11 16:31:56 +02:00
parent ef9b43740d
commit e415377cda
35 changed files with 3424 additions and 4059 deletions

View File

@ -1945,13 +1945,6 @@ export function compileCall(
reportNode.range, "1", typeArguments ? typeArguments.length.toString(10) : "0"
);
return module.createUnreachable();
} else if (typeArguments[0].kind != TypeKind.USIZE) { // any usize
compiler.error(
DiagnosticCode.Operation_not_supported,
reportNode.range
);
compiler.currentType = typeArguments[0];
return module.createUnreachable();
}
if (operands.length != 1) {
compiler.error(
@ -1963,11 +1956,11 @@ export function compileCall(
}
arg0 = compiler.compileExpressionRetainType(
operands[0],
compiler.options.usizeType,
typeArguments[0],
WrapMode.NONE
);
compiler.currentType = typeArguments[0];
if (compiler.currentType.kind != TypeKind.USIZE) {
if (compiler.currentType.size != typeArguments[0].size) {
compiler.error(
DiagnosticCode.Operation_not_supported,
reportNode.range