void InitializeObjectIfRequired (bool waitForParameters)
{
var state = object_states.Peek ();
if (state.IsInstantiated)
return;
if (waitForParameters && (state.Type.ConstructionRequiresArguments || state.Type.HasPositionalParameters (service_provider)))
return;
// FIXME: "The default techniques in absence of a factory method are to attempt to find a default constructor, then attempt to find an identified type converter on type, member, or destination type."
// http://msdn.microsoft.com/en-us/library/system.xaml.xamllanguage.factorymethod%28VS.100%29.aspx
object obj;
if (state.FactoryMethod != null) // FIXME: it must be implemented and verified with tests.
throw new NotImplementedException ();
else
obj = state.Type.Invoker.CreateInstance (null);
state.Value = obj;
state.IsInstantiated = true;
}