pascalabcnet/SyntaxVisitors/BaseSyntaxTreeConverter.cs
Александр Земляк 1f4b44c2c0
Исправление ошибок при перекомпиляции pcu файлов (#3398)
* Move yield string constants to StringConstants class

* Add GeneratedNamesManager class to store all generated names during unit compilation

* Make GeneratedNamesManager class non static

* Add Utils project to installer files

* Add GeneratedNamesManager usage in CapturedVariablesSubstitutionsManager

* Move GeneratedNamesManager initialization in CompilationUnit constructor

* More GeneratedNamesManager usage

* QuestionPointDesugarVisitor fix
2026-03-08 18:30:33 +03:00

41 lines
1.9 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Copyright (c) Ivan Bondarev, Stanislav Mikhalkovich (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using PascalABCCompiler.SyntaxTree;
namespace PascalABCCompiler.SyntaxTreeConverters
{
public abstract class BaseSyntaxTreeConverter : ISyntaxTreeConverter
{
public abstract string Name { get; }
public syntax_tree_node Convert(syntax_tree_node root, bool forIntellisense)
{
// Прошивание ссылками на Parent nodes. Должно идти первым
// FillParentNodeVisitor расположен в SyntaxTree/tree как базовый визитор, отвечающий за построение дерева
//FillParentNodeVisitor.New.ProcessNode(root); // почему-то перепрошивает не всё. А следующий вызов - всё
root.FillParentsInAllChilds();
return ApplyConversions(root, forIntellisense);
}
protected abstract syntax_tree_node ApplyConversions(syntax_tree_node root, bool forIntellisense);
public syntax_tree_node ConvertAfterUsedModulesCompilation(syntax_tree_node root, bool forIntellisense, in CompilationArtifactsUsedBySyntaxConverters compilationArtifacts) {
return ApplyConversionsAfterUsedModulesCompilation(root, forIntellisense, in compilationArtifacts);
}
protected virtual syntax_tree_node ApplyConversionsAfterUsedModulesCompilation(syntax_tree_node root, bool forIntellisense, in CompilationArtifactsUsedBySyntaxConverters compilationArtifacts) => root;
}
public class DefaultSyntaxTreeConverter : BaseSyntaxTreeConverter
{
public override string Name => "Default";
protected override syntax_tree_node ApplyConversions(syntax_tree_node root, bool forIntellisense) => root;
}
}