mirror of
http://deavmi.assigned.network/git/tlang/tlang
synced 2025-01-02 22:42:03 +00:00
I wonder if that worked
This commit is contained in:
parent
00920ad43b
commit
8da6d94212
@ -276,8 +276,61 @@ public final class StructuralOrganizer
|
||||
{
|
||||
gprintln(node, DebugType.WARNING);
|
||||
}
|
||||
|
||||
foreach(TreeNode node; nodePool)
|
||||
{
|
||||
figureOut(node);
|
||||
}
|
||||
|
||||
|
||||
gprintln("InitQueue: "~to!(string)(initQueue));
|
||||
}
|
||||
|
||||
public Entity[] initQueue;
|
||||
|
||||
public void figureOut(TreeNode node)
|
||||
{
|
||||
/**
|
||||
* If there are no dependencies then
|
||||
* initialize it now (mark as completed)
|
||||
* and add to init queue
|
||||
*/
|
||||
if(!hasDeps(node))
|
||||
{
|
||||
node.markCompleted();
|
||||
initQueue ~= node.getEntity();
|
||||
}
|
||||
/**
|
||||
* If there are dependencies then mark it
|
||||
* as busy
|
||||
*/
|
||||
else
|
||||
{
|
||||
node.markBusy();
|
||||
|
||||
/* Get the dependencies */
|
||||
TreeNode[] nodeDeps = node.getDeps();
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
foreach(TreeNode nodeDep; nodeDeps)
|
||||
{
|
||||
/* Initialize any non-busy node */
|
||||
if(!nodeDep.isBusy())
|
||||
{
|
||||
figureOut(nodeDep);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool hasDeps(TreeNode node)
|
||||
{
|
||||
return cast(bool)node.getDeps().length;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Given a path determine if it is accessible (in a static context)
|
||||
*
|
||||
@ -293,6 +346,28 @@ public class TreeNode
|
||||
private Entity entity;
|
||||
private TreeNode[] deps;
|
||||
private TypeChecker tc;
|
||||
private bool isBusyB;
|
||||
private bool isCompletedB;
|
||||
|
||||
public bool isCompleted()
|
||||
{
|
||||
return isCompletedB;
|
||||
}
|
||||
|
||||
public void markCompleted()
|
||||
{
|
||||
isCompletedB = true;
|
||||
}
|
||||
|
||||
public bool isBusy()
|
||||
{
|
||||
return isBusyB;
|
||||
}
|
||||
|
||||
public void markBusy()
|
||||
{
|
||||
isBusyB = true;
|
||||
}
|
||||
|
||||
this(TypeChecker tc, Entity entity)
|
||||
{
|
||||
@ -332,6 +407,11 @@ public class TreeNode
|
||||
return entity;
|
||||
}
|
||||
|
||||
public TreeNode[] getDeps()
|
||||
{
|
||||
return deps;
|
||||
}
|
||||
|
||||
public override string toString()
|
||||
{
|
||||
string[] names;
|
||||
|
3
todo1.md
3
todo1.md
@ -25,7 +25,8 @@ TODO List
|
||||
## Typechecking
|
||||
|
||||
- [ ] Dependency generation
|
||||
- [ ] Classes declared at the module level should be ~~marked~~ seen as static in `parse()` (not in `parseBody()` <- this is a note we don't do this)
|
||||
- [ ] Classes declared at the module level should be marked as static in `parse()`
|
||||
- [ ] `parseClass()` should not use
|
||||
- [ ] Structs declared at the module level should be marked as ~~marked~~ seen in `parse()` (not in `parseBody()` <- this is a note we don't do this)
|
||||
- [ ] Functions (?) declared at the module level should be ~~marked~~ seen as static in `parse()` (not in `parseBody()` <- this is a note we don't do this)
|
||||
- [ ] Variables declared at the module level should be marked as ~~marked~~ seen in `parse()` (not in `parseBody()` <- this is a note we don't do this)
|
||||
|
Loading…
Reference in New Issue
Block a user