Skip to content

Commit

Permalink
Split declarationBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
CppCXY committed Jul 2, 2024
1 parent c13ba16 commit d348391
Show file tree
Hide file tree
Showing 13 changed files with 1,610 additions and 1,520 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class AnalyzeContext(List<LuaDocument> documents)

public List<UnResolved> UnResolves { get; } = [];

// TODO
public List<InferenceUsage> UseInfers { get; } = [];

public Dictionary<SyntaxElementId, ControlFlowGraph> ControlFlowGraphs { get; } = new();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
namespace EmmyLua.CodeAnalysis.Compilation.Analyzer.DeclarationAnalyzer;
using EmmyLua.CodeAnalysis.Compilation.Search;

namespace EmmyLua.CodeAnalysis.Compilation.Analyzer.DeclarationAnalyzer;

public class DeclarationAnalyzer(LuaCompilation compilation) : LuaAnalyzer(compilation, "Declaration")

Check warning on line 5 in EmmyLua/CodeAnalysis/Compilation/Analyzer/DeclarationAnalyzer/DeclarationAnalyzer.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, linux-x64, linux-x64)

Parameter 'LuaCompilation compilation' is captured into the state of the enclosing type and its value is also passed to the base constructor. The value might be captured by the base class as well.

Check warning on line 5 in EmmyLua/CodeAnalysis/Compilation/Analyzer/DeclarationAnalyzer/DeclarationAnalyzer.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest, osx-x64, darwin-x64)

Parameter 'LuaCompilation compilation' is captured into the state of the enclosing type and its value is also passed to the base constructor. The value might be captured by the base class as well.

Check warning on line 5 in EmmyLua/CodeAnalysis/Compilation/Analyzer/DeclarationAnalyzer/DeclarationAnalyzer.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest, osx-arm64, darwin-arm64)

Parameter 'LuaCompilation compilation' is captured into the state of the enclosing type and its value is also passed to the base constructor. The value might be captured by the base class as well.

Check warning on line 5 in EmmyLua/CodeAnalysis/Compilation/Analyzer/DeclarationAnalyzer/DeclarationAnalyzer.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest, win-x64, win32-x64)

Parameter 'LuaCompilation compilation' is captured into the state of the enclosing type and its value is also passed to the base constructor. The value might be captured by the base class as well.
{
public override void Analyze(AnalyzeContext analyzeContext)
{
var searchContext = new SearchContext(compilation, new SearchContextFeatures() { Cache = false });
foreach (var document in analyzeContext.LuaDocuments)
{
var builder = new DeclarationBuilder(document.Id, document.SyntaxTree, this, analyzeContext);
var tree = builder.Build();
var declarationContext = new DeclarationContext(document.Id, this, analyzeContext);
var walker = new DeclarationWalker.DeclarationWalker(declarationContext, searchContext);
document.SyntaxTree.SyntaxRoot.Accept(walker);

var tree = declarationContext.GetDeclarationTree();
if (tree is not null)
{
Compilation.Db.AddDeclarationTree(document.Id, tree);
Expand Down
Loading

0 comments on commit d348391

Please sign in to comment.