Skip to content

Commit 1250fa3

Browse files
MaskRayyuxuanchen1997
authored andcommitted
[ELF] Simplify readExpr. NFC
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: https://phabricator.intern.facebook.com/D60251464
1 parent 6aa8b7a commit 1250fa3

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lld/ELF/ScriptParser.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,10 +1182,8 @@ SymbolAssignment *ScriptParser::readSymbolAssignment(StringRef name) {
11821182
Expr ScriptParser::readExpr() {
11831183
// Our lexer is context-aware. Set the in-expression bit so that
11841184
// they apply different tokenization rules.
1185-
bool orig = inExpr;
1186-
inExpr = true;
1185+
SaveAndRestore saved(inExpr, true);
11871186
Expr e = readExpr1(readPrimary(), 0);
1188-
inExpr = orig;
11891187
return e;
11901188
}
11911189

@@ -1251,9 +1249,9 @@ Expr ScriptParser::readExpr1(Expr lhs, int minPrec) {
12511249
StringRef op1 = peek();
12521250
if (precedence(op1) < minPrec)
12531251
break;
1254-
if (consume("?"))
1255-
return readTernary(lhs);
12561252
skip();
1253+
if (op1 == "?")
1254+
return readTernary(lhs);
12571255
Expr rhs = readPrimary();
12581256

12591257
// Evaluate the remaining part of the expression first if the

0 commit comments

Comments
 (0)