From 47b4f2ead2c34fa6efc0dd305263c29edf8e39b5 Mon Sep 17 00:00:00 2001 From: CanadaHonk Date: Mon, 22 Jan 2024 02:09:44 +0000 Subject: [PATCH] compiler/2c: add hack to fix conversion bracket removal --- compiler/2c.js | 5 ++++- compiler/index.js | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/compiler/2c.js b/compiler/2c.js index 8ad450f9..e637e5ee 100644 --- a/compiler/2c.js +++ b/compiler/2c.js @@ -35,7 +35,10 @@ const todo = msg => { throw new TodoError(`todo: ${msg}`); }; -const removeBrackets = str => str.startsWith('(') && str.endsWith(')') ? str.slice(1, -1) : str; +const removeBrackets = str => { + if (str.startsWith('(long)(unsigned long)')) return '(long)(unsigned long)(' + removeBrackets(str.slice(22, -1)) + ')'; + return str.startsWith('(') && str.endsWith(')') ? str.slice(1, -1) : str; +}; export default ({ funcs, globals, tags, exceptions, pages }) => { const invOperatorOpcode = Object.values(operatorOpcode).reduce((acc, x) => { diff --git a/compiler/index.js b/compiler/index.js index 43e43dc0..139bf32b 100644 --- a/compiler/index.js +++ b/compiler/index.js @@ -82,6 +82,8 @@ export default (code, flags) => { } else { console.log(c); } + + if (process.version) process.exit(); } if (target === 'native') { @@ -96,6 +98,8 @@ export default (code, flags) => { // obvious command escape is obvious execSync(args.join(' '), { stdio: 'inherit' }); + + if (process.version) process.exit(); } return out;