public bool TryGetBoundedLifetimeWithLiveVariables(out BoundedLifetimeLiveVariableSet boundedLifetimeLiveVariableSet)
 {
     foreach (var kvp in _variableStatuses)
     {
         if (kvp.Value.Kind != VariableStatusKind.Live)
         {
             continue;
         }
         VariableReference liveVariable     = kvp.Key;
         Lifetime          variableLifetime = liveVariable.Lifetime;
         if (!variableLifetime.IsBounded)
         {
             continue;
         }
         VariableSet variableSet         = kvp.Value.Terminal.GetVariableSet();
         var         variablesInLifetime = variableSet.GetUniqueVariableReferences().Where(v => v.Lifetime == variableLifetime);
         if (variablesInLifetime.Any(IsVariableInterrupted))
         {
             continue;
         }
         var            liveVariablesInLifetime = variablesInLifetime.Where(IsLive);
         LiveVariable[] liveVariables           = liveVariablesInLifetime.Select(v => new LiveVariable(v, _variableStatuses[v].Terminal)).ToArray();
         boundedLifetimeLiveVariableSet = new BoundedLifetimeLiveVariableSet(variableLifetime, liveVariables);
         return(true);
     }
     boundedLifetimeLiveVariableSet = null;
     return(false);
 }
Esempio n. 2
0
 internal VariableReference(VariableSet variableSet, int referenceIndex)
 {
     _variableSet   = variableSet;
     ReferenceIndex = referenceIndex;
 }