@@ -2208,20 +2208,23 @@ Expr *Parser::parseExprIdentifier() {
2208
2208
// lookups, so disable this check when parsing for SwiftSyntax.
2209
2209
if (!InPoundIfEnvironment && !Context.LangOpts .ParseForSyntaxTreeOnly ) {
2210
2210
D = lookupInScope (name);
2211
- // FIXME: We want this to work: "var x = { x() }", but for now it's better
2212
- // to disallow it than to crash.
2213
- if (D) {
2214
- for (auto activeVar : DisabledVars) {
2215
- if (activeVar == D) {
2216
- diagnose (loc.getBaseNameLoc (), DisabledVarReason);
2217
- return new (Context) ErrorExpr (loc.getSourceRange ());
2211
+
2212
+ if (!Context.LangOpts .DisableParserLookup ) {
2213
+ // FIXME: We want this to work: "var x = { x() }", but for now it's better
2214
+ // to disallow it than to crash.
2215
+ if (D) {
2216
+ for (auto activeVar : DisabledVars) {
2217
+ if (activeVar == D) {
2218
+ diagnose (loc.getBaseNameLoc (), DisabledVarReason);
2219
+ return new (Context) ErrorExpr (loc.getSourceRange ());
2220
+ }
2218
2221
}
2219
- }
2220
- } else {
2221
- for ( auto activeVar : DisabledVars ) {
2222
- if (activeVar-> getName () == name. getFullName ()) {
2223
- diagnose ( loc.getBaseNameLoc (), DisabledVarReason );
2224
- return new (Context) ErrorExpr (loc. getSourceRange ());
2222
+ } else {
2223
+ for ( auto activeVar : DisabledVars) {
2224
+ if ( activeVar-> getName () == name. getFullName () ) {
2225
+ diagnose (loc. getBaseNameLoc (), DisabledVarReason);
2226
+ return new (Context) ErrorExpr ( loc.getSourceRange () );
2227
+ }
2225
2228
}
2226
2229
}
2227
2230
}
0 commit comments