We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
当测试代码片段含有二元表达式时存在死循环问题,如:
var test = function (a, b){ return a > 20 ? a : b } console.log(test(10, 1))
The text was updated successfully, but these errors were encountered:
尝试效仿IfStatement的解析,改动compiler.ts后可行,望作者CR并修复问题
IfStatement
compiler.ts
case 'ConditionalExpression': { const endLabel = this.createLabelName('cond_end'); const altLabel = this.createLabelName('cond_alt'); const { test, consequent, alternate } = expr; this.compileExpression(test); - this.writeLabel(altLabel); + this.writeReference(alternate ? altLabel : endLabel); this.writeOp(OpCode.JUMPNOT); this.compileExpression(consequent); - this.writeReference(endLabel); - this.writeOp(OpCode.JUMP); - this.writeLabel(altLabel); - this.compileExpression(alternate); + if (alternate) { + this.writeReference(endLabel); + this.writeOp(OpCode.JUMP); + this.writeLabel(altLabel); + this.compileExpression(alternate); + } this.writeLabel(endLabel); break; }
Sorry, something went wrong.
No branches or pull requests
当测试代码片段含有二元表达式时存在死循环问题,如:
The text was updated successfully, but these errors were encountered: