Change over

entity_declaration_type_checking
Tristan B. V. Kildaire 2021-04-21 20:50:38 +02:00
parent 9732815f77
commit 2cf9c07c1d
2 changed files with 40 additions and 13 deletions

View File

@ -2,15 +2,26 @@ module compiler.symbols.containers;
import compiler.symbols.data;
import std.conv : to;
import compiler.symbols.typing;
public class Container : Entity
public interface Container
{
public void addStatement(Statement statement);
public void addStatements(Statement[] statements);
public Statement[] getStatements();
}
public class Module : Entity, Container
{
this(string moduleName)
{
super(moduleName);
}
private Statement[] statements;
this(string name)
{
super(name);
}
public void addStatement(Statement statement)
{
@ -28,16 +39,10 @@ public class Container : Entity
}
}
public class Module : Container
public class Clazz : Type, Container
{
this(string moduleName)
{
super(moduleName);
}
}
private Statement[] statements;
public class Clazz : Container
{
private string[] interfacesClasses;
this(string name)
@ -59,5 +64,20 @@ public class Clazz : Container
{
return "Class (Name: "~name~", Parents (Class/Interfaces): "~to!(string)(interfacesClasses)~")";
}
public void addStatement(Statement statement)
{
this.statements ~= statement;
}
public void addStatements(Statement[] statements)
{
this.statements ~= statements;
}
public Statement[] getStatements()
{
return statements;
}
}

View File

@ -124,6 +124,13 @@ public final class TypeChecker
public void beginCheck()
{
/**
* Make sure there are no name collisions anywhere
* in the Module with an order of precedence of