use GetStructNames instead of collecting the names in GetStructs

This commit is contained in:
2020-02-04 21:44:04 +01:00
parent a79a2332a1
commit 19daaa63af
2 changed files with 8 additions and 11 deletions

View File

@@ -8,6 +8,7 @@ import java.io.*;
import java.util.Arrays;
import java.util.List;
import java.util.HashMap;
import java.util.HashSet;
import de.hsrm.compiler.Klang.nodes.Node;
import de.hsrm.compiler.Klang.nodes.StructDefinition;
@@ -91,9 +92,13 @@ public class Klang {
var functionDefinitions = new HashMap<String, FunctionInformation>();
new GetFunctions(functionDefinitions).visit(tree);
// Extract names of all structs
var structNames = new HashSet<String>();
new GetStructNames(structNames).visit(tree);
// Extract information about all structs
var structs = new HashMap<String, StructDefinition>();
new GetStructs(structs).visit(tree);
new GetStructs(structNames, structs).visit(tree);
// Create the DAST
ContextAnalysis ctxAnal = new ContextAnalysis(functionDefinitions, structs);