Rename UnitsLogicallySortedList (#3046)

This commit is contained in:
AlexanderZemlyak 2024-02-16 23:13:31 +03:00 committed by GitHub
parent 7eb8e40fdd
commit eace530ed4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 22 additions and 22 deletions

View file

@ -931,7 +931,7 @@ namespace PascalABCCompiler
private CompilationUnitHashTable unitTable = new CompilationUnitHashTable();
public CompilationUnitHashTable UnitTable { get { return unitTable; } }
public List<CompilationUnit> UnitsLogicallySortedList = new List<CompilationUnit>();
public List<CompilationUnit> UnitsTopologicallySortedList = new List<CompilationUnit>();
private List<string> StandardModules = new List<string>();
public CompilerOptions CompilerOptions { get; set; } = new CompilerOptions();
@ -1285,7 +1285,7 @@ namespace PascalABCCompiler
return;
CompilationUnit system_unit = null;
foreach (CompilationUnit unit in UnitsLogicallySortedList)
foreach (CompilationUnit unit in UnitsTopologicallySortedList)
{
if (unit.SemanticTree != null && unit.SemanticTree is common_unit_node)
{
@ -1297,10 +1297,10 @@ namespace PascalABCCompiler
}
}
if (system_unit != null && system_unit != UnitsLogicallySortedList[0])
if (system_unit != null && system_unit != UnitsTopologicallySortedList[0])
{
UnitsLogicallySortedList.Remove(system_unit);
UnitsLogicallySortedList.Insert(0, system_unit);
UnitsTopologicallySortedList.Remove(system_unit);
UnitsTopologicallySortedList.Insert(0, system_unit);
}
}
@ -2311,7 +2311,7 @@ namespace PascalABCCompiler
SaveDocumentationsForUnits();
}
compilerDirectives = GetCompilerDirectives(UnitsLogicallySortedList);
compilerDirectives = GetCompilerDirectives(UnitsTopologicallySortedList);
// выяснение типа выходного файла по соотв. директиве компилятора
SetOutputFileTypeOption();
@ -2320,10 +2320,10 @@ namespace PascalABCCompiler
MoveSystemUnitForwardInUnitLogicallySortedList();
// передача информации о типе выходного файла системному юниту
if (UnitsLogicallySortedList.Count > 0)
if (UnitsTopologicallySortedList.Count > 0)
{
bool isConsoleApplication = CompilerOptions.OutputFileType == CompilerOptions.OutputType.ConsoleApplicaton;
common_unit_node systemUnit = UnitsLogicallySortedList[0].SemanticTree as common_unit_node;
common_unit_node systemUnit = UnitsTopologicallySortedList[0].SemanticTree as common_unit_node;
systemUnit.IsConsoleApplicationVariable = isConsoleApplication;
}
@ -2348,15 +2348,15 @@ namespace PascalABCCompiler
{
program_node mainSemanticTree = new program_node(null, null);
for (int i = 0; i < UnitsLogicallySortedList.Count; i++)
mainSemanticTree.units.AddElement(UnitsLogicallySortedList[i].SemanticTree as common_unit_node);
for (int i = 0; i < UnitsTopologicallySortedList.Count; i++)
mainSemanticTree.units.AddElement(UnitsTopologicallySortedList[i].SemanticTree as common_unit_node);
bool targetTypeIsExe = compilerOptions.target == NETGenerator.TargetType.Exe || compilerOptions.target == NETGenerator.TargetType.WinExe;
// если компилируем exe или WinExe (первый модуль - основная программа)
if (firstCompilationUnit.SyntaxTree is SyntaxTree.program_module && targetTypeIsExe && UnitsLogicallySortedList.Count > 0)
if (firstCompilationUnit.SyntaxTree is SyntaxTree.program_module && targetTypeIsExe && UnitsTopologicallySortedList.Count > 0)
{
mainSemanticTree.main_function = ((common_unit_node)UnitsLogicallySortedList.Last().SemanticTree).main_function;
mainSemanticTree.main_function = ((common_unit_node)UnitsTopologicallySortedList.Last().SemanticTree).main_function;
PrepareFinalMainFunctionForExe(mainSemanticTree);
}
@ -2572,7 +2572,7 @@ namespace PascalABCCompiler
private void SaveDocumentationsForUnits()
{
DocXmlManager dxm = new DocXmlManager();
foreach (CompilationUnit cu in UnitsLogicallySortedList)
foreach (CompilationUnit cu in UnitsTopologicallySortedList)
{
if (cu.Documented)
dxm.SaveXml(cu);
@ -2625,7 +2625,7 @@ namespace PascalABCCompiler
private void ClosePCUWriters()
{
foreach (CompilationUnit cu in UnitsLogicallySortedList)
foreach (CompilationUnit cu in UnitsTopologicallySortedList)
{
SavePCU(cu);
}
@ -3707,8 +3707,8 @@ namespace PascalABCCompiler
if (semanticTreeAsCommonNode != null)
{
if (!UnitsLogicallySortedList.Contains(currentUnit))//vnimanie zdes inogda pri silnoj zavisimosti modulej moduli popadajut neskolko raz
UnitsLogicallySortedList.Add(currentUnit);
if (!UnitsTopologicallySortedList.Contains(currentUnit))//vnimanie zdes inogda pri silnoj zavisimosti modulej moduli popadajut neskolko raz
UnitsTopologicallySortedList.Add(currentUnit);
}
OnChangeCompilerState(this, CompilerState.EndCompileFile, unitFileName);
@ -3862,8 +3862,8 @@ namespace PascalABCCompiler
if (commonUnitNode != null)
{
if (!UnitsLogicallySortedList.Contains(currentUnit))//vnimanie zdes inogda pri silnoj zavisimosti modulej moduli popadajut neskolko raz
UnitsLogicallySortedList.Add(currentUnit);
if (!UnitsTopologicallySortedList.Contains(currentUnit))//vnimanie zdes inogda pri silnoj zavisimosti modulej moduli popadajut neskolko raz
UnitsTopologicallySortedList.Add(currentUnit);
}
//Console.WriteLine("Send compile to end "+unitFileName);//DEBUG
}
@ -4345,7 +4345,7 @@ namespace PascalABCCompiler
CompilationUnit cu = obj as CompilationUnit;
cu.State = UnitState.Compiled;
unitTable[(Sender as PCUReader).FileName] = cu;
UnitsLogicallySortedList.Add(cu);
UnitsTopologicallySortedList.Add(cu);
GetReferences(cu);
break;
case PCUReaderWriterState.EndSaveTree:
@ -4598,7 +4598,7 @@ namespace PascalABCCompiler
RecompileList.Clear();
CycleUnits.Clear();
UnitTable.Clear();
UnitsLogicallySortedList.Clear();
UnitsTopologicallySortedList.Clear();
//TreeRealization.PCUReturner.Clear();
BadNodesInSyntaxTree.Clear();
if (close_pcu)

View file

@ -905,7 +905,7 @@ namespace PascalABCCompiler.PCU
comp_cnn = (tn as common_generic_instance_type_node).common_original_generic.comprehensive_namespace;
if (comp_cnn != null && !ns_dict.ContainsKey(comp_cnn) && unit.SemanticTree != comp_cnn.cont_unit)
{
var path = Compiler.GetUnitPath(unit, compiler.UnitsLogicallySortedList.Find(u => u.SemanticTree == comp_cnn.cont_unit));
var path = Compiler.GetUnitPath(unit, compiler.UnitsTopologicallySortedList.Find(u => u.SemanticTree == comp_cnn.cont_unit));
if (interf)
unit.InterfaceUsedUnits.AddElement(comp_cnn.cont_unit, path);
@ -924,7 +924,7 @@ namespace PascalABCCompiler.PCU
common_namespace_node comp_cnn = cnfn.namespace_node;
if (comp_cnn != null && !ns_dict.ContainsKey(comp_cnn) && unit.SemanticTree != comp_cnn.cont_unit)
{
var path = Compiler.GetUnitPath(unit, compiler.UnitsLogicallySortedList.Find(u => u.SemanticTree == comp_cnn.cont_unit));
var path = Compiler.GetUnitPath(unit, compiler.UnitsTopologicallySortedList.Find(u => u.SemanticTree == comp_cnn.cont_unit));
if (interf)
unit.InterfaceUsedUnits.AddElement(comp_cnn.cont_unit, path);