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