Inference/src/Semantic/SSAAlgorithm/SSAHelper.cs
/// <summary>
/// Simplifies the set of used references in a body
/// <param name="references">The set of references to be simplied</param>
/// </summary>
Simplifies the set of used references in a body
The set of references to be simplied
Simplifies the set of used references in a body The set of references to be simplied
public static void SimplifyReferences(IList<SingleIdentifierExpression> references) {
            for (int i = references.Count - 1; i >= 0; i--) {
                if (references[i].ExpressionType is ClassType || references[i].ExpressionType is NameSpaceType) {
                    references.RemoveAt(i);
                    continue;
                }
                TypeExpression symbolType;
                if (references[i].IdSymbol!=null && (symbolType = references[i].IdSymbol.SymbolType) != null)
                    if (!symbolType.HasTypeVariables() || 
                          symbolType is FieldType || 
                          symbolType is MethodType || 
                          symbolType is ArrayType || 
                          symbolType is PropertyType  
                        )
                        references.RemoveAt(i);
            }
        }
public static void SimplifyReferences ( IList < SingleIdentifierExpression > references ) { for ( int i = references . Count - 1 ; i >= 0 ; i -- ) { if ( references [ i ] . ExpressionType is ClassType || references [ i ] . ExpressionType is NameSpaceType ) { references . RemoveAt ( i ) ; continue ; } TypeExpression symbolType ; if ( references [ i ] . IdSymbol != null && ( symbolType = references [ i ] . IdSymbol . SymbolType ) != null ) if ( ! symbolType . HasTypeVariables ( ) || symbolType is FieldType || symbolType is MethodType || symbolType is ArrayType || symbolType is PropertyType ) references . RemoveAt ( i ) ; } }
Simplifies the set of used references in a body
The set of references to be simplied
Simplifies the set of used references in a body The set of references to be simplied
// * If it is a class or namespace, we can erase it // * We can erase it if... // it doesn't have free variables // it is a field // it is a method // it is an array // it is a property
references
IList<SingleIdentifierExpression>