mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-21 15:57:42 +00:00
fix(developer): kmc-kmn would abort build on warnings
Fixes #8615. The msgproc was never being located as we were missing the UTF8ToString wrapper for the context. This also ensures error message codes are emitted in hexadecimal, and that the return value from the msgproc callback is 1, meaning 'continue build'.
This commit is contained in:
parent
cb3688d209
commit
5f88bbf50c
2 changed files with 6 additions and 4 deletions
|
|
@ -60,9 +60,10 @@ export class Compiler {
|
|||
|
||||
options = {...baseOptions, ...options};
|
||||
|
||||
(globalThis as any).msgproc = function(line: number, code: number, msg: string) {
|
||||
(globalThis as any).msgproc = function(line: number, code: number, msg: string): number {
|
||||
// TODO: link into the kmc error reporting infrastructure
|
||||
console.log(`[${line}] ${code}: ${msg}`);
|
||||
console.log(`[${line}] ${code.toString(16)}: ${msg}`);
|
||||
return 1; // 1 == continue build
|
||||
}
|
||||
|
||||
// TODO: use callbacks for file access -- so kmc-kmn is entirely fs agnostic
|
||||
|
|
@ -83,7 +84,8 @@ export class Compiler {
|
|||
outfile,
|
||||
options.saveDebug ? 1 : 0,
|
||||
options.compilerWarningsAsErrors ? 1 : 0,
|
||||
options.warnDeprecatedCode ? 1 : 0, 'msgproc');
|
||||
options.warnDeprecatedCode ? 1 : 0,
|
||||
'msgproc');
|
||||
} catch(e) {
|
||||
// TODO: use sentry
|
||||
console.error(e);
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ EXTERN bool kmcmp_SetCompilerOptions(KMCMP_COMPILER_OPTIONS* options) {
|
|||
WASM interface for compiler message callback
|
||||
*/
|
||||
EM_JS(int, wasm_msgproc, (int line, int msgcode, char* text, char* context), {
|
||||
const proc = globalThis[context];
|
||||
const proc = globalThis[UTF8ToString(context)];
|
||||
if(!proc || typeof proc != 'function') {
|
||||
console.log(`[${line}: ${msgcode}: ${UTF8ToString(text)}]`);
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue