Add a more helpful error message when you haven't defined an allocator (#108)

Also adds a system for writing tests that assert that certain error codes are triggered so that I could test this.
This commit is contained in:
Alan Pierce
2018-05-22 03:09:05 -07:00
committed by Daniel Wirtz
parent edf4aaa966
commit 558ed78cc9
5 changed files with 46 additions and 0 deletions

View File

@ -2721,6 +2721,10 @@ export function compileAllocate(
DiagnosticCode.Cannot_find_name_0,
reportNode.range, allocateInternalName
);
program.info(
DiagnosticCode.An_allocator_must_be_declared_to_allocate_memory_Try_importing_allocator_arena_or_allocator_tlsf,
reportNode.range
);
return module.createUnreachable();
}
if (allocatePrototype.kind != ElementKind.FUNCTION_PROTOTYPE) {