|
|
|
@ -4,11 +4,9 @@ import chocopy.common.analysis.AbstractNodeAnalyzer;
|
|
|
|
|
import chocopy.common.analysis.SymbolTable;
|
|
|
|
|
import chocopy.common.analysis.types.*;
|
|
|
|
|
import chocopy.common.astnodes.*;
|
|
|
|
|
import java_cup.runtime.Symbol;
|
|
|
|
|
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.annotation.JacksonInject.Value;
|
|
|
|
|
/** Analyzes declarations to create a top-level symbol table. */
|
|
|
|
|
public class DeclarationAnalyzer extends AbstractNodeAnalyzer<Type>
|
|
|
|
|
{
|
|
|
|
@ -65,6 +63,7 @@ public class DeclarationAnalyzer extends AbstractNodeAnalyzer<Type>
|
|
|
|
|
initScope(newScope);
|
|
|
|
|
return newScope;
|
|
|
|
|
}
|
|
|
|
|
//Initializer for the first pass.
|
|
|
|
|
public DeclarationAnalyzer(Errors errors0)
|
|
|
|
|
{
|
|
|
|
|
firstPass = true;
|
|
|
|
@ -73,7 +72,7 @@ public class DeclarationAnalyzer extends AbstractNodeAnalyzer<Type>
|
|
|
|
|
initScope(sym);
|
|
|
|
|
typeChecker = new TypeChecker(globals, errors);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Initializer for the second pass.
|
|
|
|
|
public DeclarationAnalyzer(Errors errors0, TypeChecker typeChecker, SymbolTable<Type> globals)
|
|
|
|
|
{
|
|
|
|
|
firstPass = false;
|
|
|
|
|