internal AnonymousTypeConstructorSymbol(NamedTypeSymbol container, ImmutableArray<AnonymousTypePropertySymbol> properties) : base(container, WellKnownMemberNames.InstanceConstructorName) { // Create constructor parameters int fieldsCount = properties.Length; if (fieldsCount > 0) { ParameterSymbol[] paramsArr = new ParameterSymbol[fieldsCount]; for (int index = 0; index < fieldsCount; index++) { PropertySymbol property = properties[index]; paramsArr[index] = new SynthesizedParameterSymbol(this, property.Type, index, RefKind.None, property.Name); } _parameters = paramsArr.AsImmutableOrNull(); } else { _parameters = ImmutableArray<ParameterSymbol>.Empty; } }
private ImmutableArray <ParameterSymbol> MakeParameters() { var reducedFromParameters = _reducedFrom.Parameters; int count = reducedFromParameters.Length; if (count <= 1) { Debug.Assert(count == 1); return(ImmutableArray <ParameterSymbol> .Empty); } else { var parameters = new ParameterSymbol[count - 1]; for (int i = 0; i < count - 1; i++) { parameters[i] = new ReducedExtensionMethodParameterSymbol(this, reducedFromParameters[i + 1]); } return(parameters.AsImmutableOrNull()); } }
internal AnonymousTypeConstructorSymbol(NamedTypeSymbol container, ImmutableArray <AnonymousTypePropertySymbol> properties) : base(container, WellKnownMemberNames.InstanceConstructorName) { // Create constructor parameters int fieldsCount = properties.Length; if (fieldsCount > 0) { ParameterSymbol[] paramsArr = new ParameterSymbol[fieldsCount]; for (int index = 0; index < fieldsCount; index++) { PropertySymbol property = properties[index]; paramsArr[index] = SynthesizedParameterSymbol.Create(this, property.Type, index, RefKind.None, property.Name); } _parameters = paramsArr.AsImmutableOrNull(); } else { _parameters = ImmutableArray <ParameterSymbol> .Empty; } }
internal InvokeMethod(SynthesizedDelegateSymbol containingType, BitVector byRefParameters, TypeSymbol voidReturnTypeOpt) { var typeParams = containingType.TypeParameters; _containingType = containingType; // if we are given Void type the method returns Void, otherwise its return type is the last type parameter of the delegate: _returnType = voidReturnTypeOpt ?? typeParams.Last(); var parameters = new ParameterSymbol[typeParams.Length - ((object)voidReturnTypeOpt != null ? 0 : 1)]; for (int i = 0; i < parameters.Length; i++) { // we don't need to distinguish between out and ref since this is an internal synthesized symbol: var refKind = !byRefParameters.IsNull && byRefParameters[i] ? RefKind.Ref : RefKind.None; parameters[i] = SynthesizedParameterSymbol.Create(this, typeParams[i], i, refKind); } _parameters = parameters.AsImmutableOrNull(); }
private ImmutableArray <ParameterSymbol> SubstituteParameters() { var unsubstitutedParameters = OriginalDefinition.Parameters; if (unsubstitutedParameters.IsEmpty) { return(unsubstitutedParameters); } else { int count = unsubstitutedParameters.Length; var substituted = new ParameterSymbol[count]; for (int i = 0; i < count; i++) { substituted[i] = new SubstitutedParameterSymbol( this, _containingType.TypeSubstitution, unsubstitutedParameters[i] ); } return(substituted.AsImmutableOrNull()); } }
internal InvokeMethod(SynthesizedDelegateSymbol containingType, BitVector byRefParameters, TypeSymbol voidReturnTypeOpt) { var typeParams = containingType.TypeParameters; _containingType = containingType; // if we are given Void type the method returns Void, otherwise its return type is the last type parameter of the delegate: _returnType = voidReturnTypeOpt ?? typeParams.Last(); var parameters = new ParameterSymbol[typeParams.Length - ((object)voidReturnTypeOpt != null ? 0 : 1)]; for (int i = 0; i < parameters.Length; i++) { // we don't need to distinguish between out and ref since this is an internal synthesized symbol: var refKind = !byRefParameters.IsNull && byRefParameters[i] ? RefKind.Ref : RefKind.None; parameters[i] = SynthesizedParameterSymbol.Create(this, typeParams[i], i, refKind); } _parameters = parameters.AsImmutableOrNull(); }
private ImmutableArray<ParameterSymbol> RetargetParameters() { var list = this.underlyingMethod.Parameters; int count = list.Length; if (count == 0) { return ImmutableArray<ParameterSymbol>.Empty; } else { ParameterSymbol[] parameters = new ParameterSymbol[count]; for (int i = 0; i < count; i++) { parameters[i] = new RetargetingMethodParameterSymbol(this, list[i]); } return parameters.AsImmutableOrNull(); } }
private ImmutableArray<ParameterSymbol> MakeParameters() { var reducedFromParameters = this.reducedFrom.Parameters; int count = reducedFromParameters.Length; if (count <= 1) { Debug.Assert(count == 1); return ImmutableArray<ParameterSymbol>.Empty; } else { var parameters = new ParameterSymbol[count - 1]; for (int i = 0; i < count - 1; i++) { parameters[i] = new ReducedExtensionMethodParameterSymbol(this, reducedFromParameters[i + 1]); } return parameters.AsImmutableOrNull(); } }
private ImmutableArray<ParameterSymbol> SubstituteParameters() { var unsubstitutedParameters = OriginalDefinition.Parameters; if (unsubstitutedParameters.IsEmpty) { return unsubstitutedParameters; } else { int count = unsubstitutedParameters.Length; var substituted = new ParameterSymbol[count]; for (int i = 0; i < count; i++) { substituted[i] = new SubstitutedParameterSymbol(this, _containingType.TypeSubstitution, unsubstitutedParameters[i]); } return substituted.AsImmutableOrNull(); } }