protected void PopulateParameters() { var originalMethod = OriginalDefinition; IEnumerable <IParameterSymbol> parameters = Symbol.Parameters; IEnumerable <IParameterSymbol> originalParameters = originalMethod.Symbol.Parameters; if (IsReducedExtension) { if (this == originalMethod) { // Non-generic reduced extensions must be extracted exactly like the // non-reduced counterparts parameters = Symbol.ReducedFrom !.Parameters; } else { // Constructed reduced extensions are special because their non-reduced // counterparts are not constructed. Therefore, we need to manually add // the `this` parameter based on the type of the receiver var originalThisParamSymbol = originalMethod.Symbol.Parameters.First(); var originalThisParam = Parameter.Create(Context, originalThisParamSymbol, originalMethod); ConstructedExtensionParameter.Create(Context, this, originalThisParam); originalParameters = originalParameters.Skip(1); } } foreach (var p in parameters.Zip(originalParameters, (paramSymbol, originalParam) => new { paramSymbol, originalParam })) { var original = SymbolEqualityComparer.Default.Equals(p.paramSymbol, p.originalParam) ? null : Parameter.Create(Context, p.originalParam, originalMethod); Parameter.Create(Context, p.paramSymbol, this, original); } if (Symbol.IsVararg) { // Mono decided that "__arglist" should be an explicit parameter, // so now we need to populate it. VarargsParam.Create(Context, this); } }
protected void PopulateParameters() { var originalMethod = OriginalDefinition; IEnumerable <IParameterSymbol> parameters = Symbol.Parameters; IEnumerable <IParameterSymbol> originalParameters = originalMethod.Symbol.Parameters; foreach (var p in parameters.Zip(originalParameters, (paramSymbol, originalParam) => new { paramSymbol, originalParam })) { var original = SymbolEqualityComparer.Default.Equals(p.paramSymbol, p.originalParam) ? null : Parameter.Create(Context, p.originalParam, originalMethod); Parameter.Create(Context, p.paramSymbol, this, original); } if (Symbol.IsVararg) { // Mono decided that "__arglist" should be an explicit parameter, // so now we need to populate it. VarargsParam.Create(Context, this); } }