Now all containers set their children Statements to be parented to them (container a reference to them)
This commit is contained in:
parent
afcf1609b6
commit
74fb188d82
|
@ -852,6 +852,9 @@ public final class Parser
|
|||
Statement[] statements = parseBody();
|
||||
generated.addStatements(statements);
|
||||
|
||||
/* Parent each Statement to the container */
|
||||
parentToContainer(generated, statements);
|
||||
|
||||
/* Pop off the ending `}` */
|
||||
nextToken();
|
||||
|
||||
|
@ -860,6 +863,17 @@ public final class Parser
|
|||
return generated;
|
||||
}
|
||||
|
||||
private void parentToContainer(Container container, Statement[] statements)
|
||||
{
|
||||
foreach(Statement statement; statements)
|
||||
{
|
||||
if(statement !is null)
|
||||
{
|
||||
statement.parentTo(container);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void parseStatement()
|
||||
{
|
||||
gprintln("parseStatement(): Enter", DebugType.WARNING);
|
||||
|
@ -997,6 +1011,9 @@ public final class Parser
|
|||
|
||||
gprintln("parse(): Leave", DebugType.WARNING);
|
||||
|
||||
/* Parent each Statement to the container (the module) */
|
||||
parentToContainer(modulle, modulle.getStatements());
|
||||
|
||||
return modulle;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -780,6 +780,8 @@ public class VariableExpression : IdentExpression
|
|||
{
|
||||
string type;
|
||||
|
||||
/* Get Statement[] at level path */
|
||||
|
||||
/* Variables can't get look ahead sort of */
|
||||
|
||||
/* Get all names and see if i am in it firstly */
|
||||
|
|
|
@ -195,6 +195,13 @@ public final class TypeChecker
|
|||
|
||||
/* TODO: We need a duplicate detector, maybe do this in Parser, in `parseBody` */
|
||||
|
||||
|
||||
// public Entity isValidEntityTop(string path)
|
||||
// {
|
||||
// /* module.x same as x */
|
||||
// if(cmp(path, "") == 0)
|
||||
// }
|
||||
|
||||
/* Path: clazz_2_1.class_2_2 */
|
||||
public Entity isValidEntity(Statement[] startingPoint, string path)
|
||||
{ /* The entity found with the matching name at the end of the path */
|
||||
|
|
Loading…
Reference in New Issue