private void _processObjects( ref IList<AbstractNode> nodes, IList<AbstractNode> top )
{
foreach ( AbstractNode node in nodes )
{
if ( node is ObjectAbstractNode )
{
ObjectAbstractNode obj = (ObjectAbstractNode)node;
// Overlay base classes in order.
foreach ( string currentBase in obj.Bases )
{
// Check the top level first, then check the import table
List<AbstractNode> newNodes = _locateTarget( top, currentBase );
if ( newNodes.Count == 0 )
newNodes = _locateTarget( _importTable, currentBase );
if ( newNodes.Count != 0 )
{
foreach ( AbstractNode j in newNodes )
_overlayObject( j, obj );
}
else
{
AddError( CompileErrorCode.ObjectBaseNotFound, obj.File, obj.Line );
}
}
// Recurse into children
_processObjects( ref obj.Children, top );
// Overrides now exist in obj's overrides list. These are non-object nodes which must now
// Be placed in the children section of the object node such that overriding from parents
// into children works properly.
for ( int i = 0; i < obj.Overrides.Count; i++ )
obj.Children.Insert( i, obj.Overrides[ i ] );
}
}
}