public SynthesizedImplementationMethod( MethodSymbol interfaceMethod, NamedTypeSymbol implementingType, string name = null, bool generateDebugInfo = true, PropertySymbol associatedProperty = null ) { //it does not make sense to add methods to substituted types Debug.Assert(implementingType.IsDefinition); _name = name ?? ExplicitInterfaceHelpers.GetMemberName( interfaceMethod.Name, interfaceMethod.ContainingType, aliasQualifierOpt: null ); _implementingType = implementingType; _generateDebugInfo = generateDebugInfo; _associatedProperty = associatedProperty; _explicitInterfaceImplementations = ImmutableArray.Create <MethodSymbol>( interfaceMethod ); // alpha-rename to get the implementation's type parameters var typeMap = interfaceMethod.ContainingType.TypeSubstitution ?? TypeMap.Empty; typeMap.WithAlphaRename(interfaceMethod, this, out _typeParameters); _interfaceMethod = interfaceMethod.ConstructIfGeneric(TypeArgumentsWithAnnotations); _parameters = SynthesizedParameterSymbol.DeriveParameters(_interfaceMethod, this); }
public SynthesizedImplementationMethod( MethodSymbol interfaceMethod, NamedTypeSymbol implementingType, string name = null, bool debuggerHidden = false, bool generateDebugInfo = true, PropertySymbol associatedProperty = null, MethodSymbol asyncKickoffMethod = null) { //it does not make sense to add methods to substituted types Debug.Assert(implementingType.IsDefinition); this.name = name ?? ExplicitInterfaceHelpers.GetMemberName(interfaceMethod.Name, interfaceMethod.ContainingType, aliasQualifierOpt: null); this.interfaceMethod = interfaceMethod; this.implementingType = implementingType; this.debuggerHidden = debuggerHidden; this.generateDebugInfo = generateDebugInfo; this.associatedProperty = associatedProperty; this.explicitInterfaceImplementations = ImmutableArray.Create <MethodSymbol>(interfaceMethod); this.asyncKickoffMethod = asyncKickoffMethod; // alpha-rename to get the implementation's type parameters var typeMap = interfaceMethod.ContainingType.TypeSubstitution ?? TypeMap.Empty; typeMap.WithAlphaRename(interfaceMethod, this, out this.typeParameters); var substitutedInterfaceMethod = interfaceMethod.ConstructIfGeneric(this.typeParameters.Cast <TypeParameterSymbol, TypeSymbol>()); this.returnType = substitutedInterfaceMethod.ReturnType; this.parameters = SynthesizedParameterSymbol.DeriveParameters(substitutedInterfaceMethod, this); }
public SynthesizedSealedPropertyAccessor(PropertySymbol property, MethodSymbol overriddenAccessor) { Debug.Assert((object)property != null); Debug.Assert(property.IsSealed); Debug.Assert((object)overriddenAccessor != null); _property = property; _overriddenAccessor = overriddenAccessor; _parameters = SynthesizedParameterSymbol.DeriveParameters(overriddenAccessor, this); }
internal AsyncForwardEntryPoint( CSharpCompilation compilation, NamedTypeSymbol containingType, MethodSymbol userMain ) : base(containingType) { // There should be no way for a userMain to be passed in unless it already passed the // parameter checks for determining entrypoint validity. Debug.Assert(userMain.ParameterCount == 0 || userMain.ParameterCount == 1); UserMain = userMain; _userMainReturnTypeSyntax = userMain.ExtractReturnTypeSyntax(); var binder = compilation.GetBinder(_userMainReturnTypeSyntax); _parameters = SynthesizedParameterSymbol.DeriveParameters(userMain, this); var arguments = Parameters.SelectAsArray( (p, s) => (BoundExpression) new BoundParameter(s, p, p.Type), _userMainReturnTypeSyntax ); // Main(args) or Main() BoundCall userMainInvocation = new BoundCall( syntax: _userMainReturnTypeSyntax, receiverOpt: null, method: userMain, arguments: arguments, argumentNamesOpt: default(ImmutableArray <string>), argumentRefKindsOpt: default(ImmutableArray <RefKind>), isDelegateCall: false, expanded: false, invokedAsExtensionMethod: false, argsToParamsOpt: default(ImmutableArray <int>), defaultArguments: default(BitVector), resultKind: LookupResultKind.Viable, type: userMain.ReturnType ) { WasCompilerGenerated = true }; // The diagnostics that would be produced here will already have been captured and returned. var success = binder.GetAwaitableExpressionInfo( userMainInvocation, out _getAwaiterGetResultCall !, _userMainReturnTypeSyntax, BindingDiagnosticBag.Discarded ); Debug.Assert( ReturnType.IsVoidType() || ReturnType.SpecialType == SpecialType.System_Int32 ); }