Skip to content

Commit

Permalink
compiler/2c: add hack to fix conversion bracket removal
Browse files Browse the repository at this point in the history
  • Loading branch information
CanadaHonk committed Jan 22, 2024
1 parent 94ef1ca commit 47b4f2e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion compiler/2c.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
4 changes: 4 additions & 0 deletions compiler/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ export default (code, flags) => {
} else {
console.log(c);
}

if (process.version) process.exit();
}

if (target === 'native') {
Expand All @@ -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;
Expand Down

0 comments on commit 47b4f2e

Please sign in to comment.