Skip to content

Commit

Permalink
[ELF] Simplify readExpr. NFC
Browse files Browse the repository at this point in the history
  • Loading branch information
MaskRay committed Jul 20, 2024
1 parent c93554b commit efa833d
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lld/ELF/ScriptParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1182,10 +1182,8 @@ SymbolAssignment *ScriptParser::readSymbolAssignment(StringRef name) {
Expr ScriptParser::readExpr() {
// Our lexer is context-aware. Set the in-expression bit so that
// they apply different tokenization rules.
bool orig = inExpr;
inExpr = true;
SaveAndRestore saved(inExpr, true);
Expr e = readExpr1(readPrimary(), 0);
inExpr = orig;
return e;
}

Expand Down Expand Up @@ -1251,9 +1249,9 @@ Expr ScriptParser::readExpr1(Expr lhs, int minPrec) {
StringRef op1 = peek();
if (precedence(op1) < minPrec)
break;
if (consume("?"))
return readTernary(lhs);
skip();
if (op1 == "?")
return readTernary(lhs);
Expr rhs = readPrimary();

// Evaluate the remaining part of the expression first if the
Expand Down

0 comments on commit efa833d

Please sign in to comment.