Skip to content

Commit 4610797

Browse files
committed
chore: remove unuse firstCompileFile logic
1 parent 32b78a4 commit 4610797

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

compile_database.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77

88
globalStore = {}
9-
# inherit compile file, for situation crossing root dir
10-
firstCompileFile = None
119

1210
cmd_split_pattern = re.compile(
1311
r"""
@@ -214,29 +212,20 @@ def GetFlags(filename: str, compileFile=None, **kwargs):
214212
# see store.setdefault to get child attributes
215213
store = kwargs.get("store", globalStore)
216214
filename = os.path.realpath(filename)
217-
global firstCompileFile
215+
218216
if compileFile:
219-
if firstCompileFile is None:
220-
firstCompileFile = compileFile
221217
if final_flags := GetFlagsInCompile(filename, compileFile, store):
222218
return {"flags": final_flags, "do_cache": True}
223219

224-
if firstCompileFile and firstCompileFile != compileFile:
225-
if final_flags := GetFlagsInCompile(filename, firstCompileFile, store):
226-
return {"flags": final_flags, "do_cache": True}
227-
228220
if filename.endswith(".swift"):
229-
return InferFlagsForSwift(filename, store)
221+
return InferFlagsForSwift(filename, compileFile, store)
230222
return {"flags": [], "do_cache": False}
231223

232224

233-
def InferFlagsForSwift(filename, store):
225+
def InferFlagsForSwift(filename, compileFile, store):
234226
"""try infer flags by convention and workspace files"""
235-
global firstCompileFile
236227
project_root, flagFile, compileFile = findSwiftModuleRoot(filename)
237228
logging.debug(f"infer root: {project_root}, {compileFile}")
238-
if firstCompileFile is None:
239-
firstCompileFile = compileFile
240229
final_flags = GetFlagsInCompile(filename, compileFile, store)
241230

242231
if not final_flags and flagFile:

0 commit comments

Comments
 (0)