internal Microsoft.Cci.IParameterTypeInformation Translate(ParameterSymbol param, bool needDeclaration) { System.Diagnostics.Debug.Assert(ReferenceEquals(param, param.OriginalDefinition) || !param.Equals(param.OriginalDefinition)); if (!ReferenceEquals(param, param.OriginalDefinition)) { return(param); } else if (!needDeclaration) { Symbol container = param.ContainingSymbol; bool containerIsGeneric = false; if (container.Kind == SymbolKind.Method) { if (((MethodSymbol)container).IsGeneric) { containerIsGeneric = true; } else { containerIsGeneric = IsGenericType(container.ContainingType); } } else { containerIsGeneric = IsGenericType(container.ContainingType); } if (containerIsGeneric) { object reference; Microsoft.Cci.IParameterTypeInformation paramRef; if (genericInstanceMap.TryGetValue(param, out reference)) { return((Microsoft.Cci.IParameterTypeInformation)reference); } paramRef = new ParameterTypeInformation(param); genericInstanceMap.Add(param, paramRef); return(paramRef); } } return(param); }
public override SyntaxNode VisitParameter(ParameterSyntax node) { // Considers: // foo(int a, int b){} -> foo(int b){} // If this is the parameter we are looking for, simply remove it ParameterSymbol visitedParameter = this.model.GetDeclaredSymbol(node) as ParameterSymbol; if (visitedParameter != null && visitedParameter.Equals(this.parameterSymbol)) { // Performs removal return(null); } return(base.VisitParameter(node)); }
internal Microsoft.Cci.IParameterTypeInformation Translate(ParameterSymbol param, bool needDeclaration) { System.Diagnostics.Debug.Assert(ReferenceEquals(param, param.OriginalDefinition) || !param.Equals(param.OriginalDefinition)); if (!ReferenceEquals(param, param.OriginalDefinition)) { return param; } else if (!needDeclaration) { Symbol container = param.ContainingSymbol; bool containerIsGeneric = false; if (container.Kind == SymbolKind.Method) { if (((MethodSymbol)container).IsGeneric) { containerIsGeneric = true; } else { containerIsGeneric = IsGenericType(container.ContainingType); } } else { containerIsGeneric = IsGenericType(container.ContainingType); } if (containerIsGeneric) { object reference; Microsoft.Cci.IParameterTypeInformation paramRef; if (genericInstanceMap.TryGetValue(param, out reference)) { return (Microsoft.Cci.IParameterTypeInformation)reference; } paramRef = new ParameterTypeInformation(param); genericInstanceMap.Add(param, paramRef); return paramRef; } } return param; }