mirror of
https://github.com/Ragora/TSScraper.git
synced 2026-07-14 11:04:33 +00:00
Fixed datablock redeclaration checking
This commit is contained in:
parent
354831b5ae
commit
79a32b3df9
1 changed files with 9 additions and 13 deletions
22
tsscraper.py
22
tsscraper.py
|
|
@ -638,6 +638,7 @@ class TSScraper(object):
|
||||||
|
|
||||||
# For each file entry
|
# For each file entry
|
||||||
known_datablocks = { }
|
known_datablocks = { }
|
||||||
|
|
||||||
for file in parse_results:
|
for file in parse_results:
|
||||||
# For each global function
|
# For each global function
|
||||||
for global_function in file.global_functions:
|
for global_function in file.global_functions:
|
||||||
|
|
@ -690,20 +691,15 @@ class TSScraper(object):
|
||||||
known_datablocks.setdefault(datablock.name, [])
|
known_datablocks.setdefault(datablock.name, [])
|
||||||
known_datablocks[datablock.name].append(datablock)
|
known_datablocks[datablock.name].append(datablock)
|
||||||
|
|
||||||
# Check for declarations
|
|
||||||
if (processed_entries[datablock.name] is not datablock):
|
|
||||||
known_entry = processed_entries[datablock.name]
|
|
||||||
|
|
||||||
# Redeclaration with different parent
|
# Check for datablock declarations
|
||||||
if (known_entry.derived != datablock.derived):
|
for datablock in known_datablocks:
|
||||||
known_entry.aliases.append(datablock)
|
occurrence_count = len(known_datablocks[datablock])
|
||||||
datablock.aliases.append(known_entry)
|
if (occurrence_count != 1):
|
||||||
print("Warning: Datablock '%s' redeclared in %s, line %u with parent '%s'! (Original declaration in %s, line %u with parent '%s')" % (datablock.name, datablock.filepath, datablock.line, datablock.derived, known_entry.filepath, known_entry.line, known_entry.derived))
|
print("Warning: Datablock '%s' redeclared %u times!" % (datablock, occurrence_count))
|
||||||
# Regular Redeclaration
|
|
||||||
else:
|
for occurrence in known_datablocks[datablock]:
|
||||||
known_entry.aliases.append(datablock)
|
print(" In %s:%u" % (occurrence.filepath, occurrence.line))
|
||||||
datablock.aliases.append(known_entry)
|
|
||||||
print("Warning: Datablock '%s' redeclared in %s, line %u! (Original declaration in %s, line %u" % (datablock.name, datablock.filepath, datablock.line, known_entry.filepath, known_entry.line))
|
|
||||||
|
|
||||||
return known_datablocks
|
return known_datablocks
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue