internal override TypeSymbol SetUnknownNullabilityForReferenceTypes() { TypeSymbolWithAnnotations oldPointedAtType = PointedAtType; TypeSymbolWithAnnotations newPointedAtType = oldPointedAtType.SetUnknownNullabilityForReferenceTypes(); if (oldPointedAtType.IsSameAs(newPointedAtType)) { return(this); } else { return(new PointerTypeSymbol(newPointedAtType)); } }
public SignatureOnlyParameterSymbol( TypeSymbolWithAnnotations type, ImmutableArray <CustomModifier> refCustomModifiers, bool isParams, RefKind refKind) { Debug.Assert(type.TypeSymbol != null); Debug.Assert(!refCustomModifiers.IsDefault); _type = type; _refCustomModifiers = refCustomModifiers; _isParams = isParams; _refKind = refKind; }
internal override bool ApplyNullableTransforms(ImmutableArray <bool> transforms, INonNullTypesContext nonNullTypesContext, ref int position, out TypeSymbol result) { TypeSymbolWithAnnotations oldElementType = ElementType; TypeSymbolWithAnnotations newElementType; if (!oldElementType.ApplyNullableTransforms(transforms, nonNullTypesContext, ref position, out newElementType)) { result = this; return(false); } result = WithElementType(newElementType); return(true); }
internal override bool ApplyNullableTransforms(byte defaultTransformFlag, ImmutableArray <byte> transforms, ref int position, out TypeSymbol result) { TypeSymbolWithAnnotations oldPointedAtType = PointedAtType; TypeSymbolWithAnnotations newPointedAtType; if (!oldPointedAtType.ApplyNullableTransforms(defaultTransformFlag, transforms, ref position, out newPointedAtType)) { result = this; return(false); } result = WithPointedAtType(newPointedAtType); return(true); }
private TypeSymbolWithAnnotations GetTypeSymbol() { var diagnostics = DiagnosticBag.GetInstance(); Binder typeBinder = this.TypeSyntaxBinder; bool isVar; TypeSymbolWithAnnotations declType; if (_typeSyntax == null) // In recursive patterns the type may be omitted. { isVar = true; declType = default; } else { declType = typeBinder.BindTypeOrVarKeyword(_typeSyntax.SkipRef(out _), diagnostics, out isVar); } if (isVar) { var inferredType = InferTypeOfVarVariable(diagnostics); // If we got a valid result that was not void then use the inferred type // else create an error type. if (inferredType.HasType && inferredType.SpecialType != SpecialType.System_Void) { declType = inferredType; } else { declType = TypeSymbolWithAnnotations.Create(typeBinder.CreateErrorType("var")); } } Debug.Assert(declType.HasType); // // Note that we drop the diagnostics on the floor! That is because this code is invoked mainly in // IDE scenarios where we are attempting to use the types of a variable before we have processed // the code which causes the variable's type to be inferred. In batch compilation, on the // other hand, local variables have their type inferred, if necessary, in the course of binding // the statements of a method from top to bottom, and an inferred type is given to a variable // before the variable's type is used by the compiler. // diagnostics.Free(); return(declType); }
internal void ComputeReturnType() { if (!_lazyReturnType.IsNull) { return; } var diagnostics = DiagnosticBag.GetInstance(); TypeSyntax returnTypeSyntax = _syntax.ReturnType.SkipRef(); TypeSymbolWithAnnotations returnType = _binder.BindType(returnTypeSyntax, diagnostics); if (IsAsync && returnType.SpecialType != SpecialType.System_Void && !returnType.TypeSymbol.IsNonGenericTaskType(_binder.Compilation) && !returnType.TypeSymbol.IsGenericTaskType(_binder.Compilation)) { // The return type of an async method must be void, Task or Task<T> diagnostics.Add(ErrorCode.ERR_BadAsyncReturn, this.Locations[0]); } var location = _syntax.ReturnType.Location; if (_refKind == RefKind.RefReadOnly) { DeclaringCompilation.EnsureIsReadOnlyAttributeExists(diagnostics, location, modifyCompilation: false); } if (returnType.ContainsNullableReferenceTypes()) { DeclaringCompilation.EnsureNullableAttributeExists(diagnostics, location, modifyCompilation: false); // Note: we don't need to warn on annotations used without NonNullTypes context for local functions, as this is handled in binding already } Debug.Assert(_refKind == RefKind.None || returnType.SpecialType != SpecialType.System_Void || returnTypeSyntax.HasErrors); lock (_declarationDiagnostics) { if (!_lazyReturnType.IsNull) { diagnostics.Free(); return; } _declarationDiagnostics.AddRangeAndFree(diagnostics); _lazyReturnType = returnType; } }
internal static ArrayTypeSymbol CreateMDArray( TypeSymbolWithAnnotations elementType, int rank, ImmutableArray <int> sizes, ImmutableArray <int> lowerBounds, NamedTypeSymbol array) { // Optimize for most common case - no sizes and all dimensions are zero lower bound. if (sizes.IsDefaultOrEmpty && lowerBounds.IsDefault) { return(new MDArrayNoSizesOrBounds(elementType, rank, array)); } return(new MDArrayWithSizesAndBounds(elementType, rank, sizes, lowerBounds, array)); }
public static ParameterSymbol Create( MethodSymbol container, TypeSymbolWithAnnotations type, int ordinal, RefKind refKind, string name = "", ImmutableArray <CustomModifier> refCustomModifiers = default(ImmutableArray <CustomModifier>)) { if (refCustomModifiers.IsDefaultOrEmpty) { return(new SynthesizedParameterSymbol(container, type, ordinal, refKind, name)); } return(new SynthesizedParameterSymbolWithCustomModifiers(container, type, ordinal, refKind, name, refCustomModifiers)); }
internal void SetType(TypeSymbolWithAnnotations newType) { TypeSymbol originalType = _type.DefaultType; // In the event that we race to set the type of a local, we should // always deduce the same type, or deduce that the type is an error. Debug.Assert((object)originalType == null || originalType.IsErrorType() && newType.IsErrorType() || originalType == newType.TypeSymbol); if ((object)originalType == null) { _type.InterlockedInitialize(newType); } }
Cci.ITypeReference Cci.IArrayTypeReference.GetElementType(EmitContext context) { PEModuleBuilder moduleBeingBuilt = (PEModuleBuilder)context.Module; TypeSymbolWithAnnotations elementType = this.ElementType; var type = moduleBeingBuilt.Translate(elementType.TypeSymbol, syntaxNodeOpt: (CSharpSyntaxNode)context.SyntaxNodeOpt, diagnostics: context.Diagnostics); if (elementType.CustomModifiers.Length == 0) { return(type); } else { return(new Cci.ModifiedTypeReference(type, elementType.CustomModifiers.As <Cci.ICustomModifier>())); } }
internal override TypeSymbol SetUnknownNullabilityForReferenceTypes() { TypeSymbolWithAnnotations oldElementType = ElementType; TypeSymbolWithAnnotations newElementType = oldElementType.SetUnknownNullabilityForReferenceTypes(); if (oldElementType.IsSameAs(newElementType)) { return(this); } else { return(IsSZArray ? ArrayTypeSymbol.CreateSZArray(newElementType, _baseType) : ArrayTypeSymbol.CreateMDArray(newElementType, Rank, Sizes, LowerBounds, _baseType)); } }
public SynthesizedParameterSymbolBase( MethodSymbol container, TypeSymbolWithAnnotations type, int ordinal, RefKind refKind, string name = "") { Debug.Assert(!type.IsNull); Debug.Assert(name != null); Debug.Assert(ordinal >= 0); _container = container; _type = type; _ordinal = ordinal; _refKind = refKind; _name = name; }
internal void SetType(TypeSymbolWithAnnotations newType) { Debug.Assert(!(newType.TypeSymbol is null)); TypeSymbol originalType = _type.DefaultType; // In the event that we race to set the type of a local, we should // always deduce the same type, or deduce that the type is an error. Debug.Assert((object)originalType == null || originalType.IsErrorType() && newType.IsErrorType() || TypeSymbol.Equals(originalType, newType.TypeSymbol, TypeCompareKind.ConsiderEverything2)); if ((object)originalType == null) { _type.InterlockedInitialize(newType); } }
protected override TypeSymbolWithAnnotations InferTypeOfVarVariable(DiagnosticBag diagnostics) { switch (_nodeToBind.Kind()) { case SyntaxKind.ThisConstructorInitializer: case SyntaxKind.BaseConstructorInitializer: var initializer = (ConstructorInitializerSyntax)_nodeToBind; _nodeBinder.BindConstructorInitializer(initializer, diagnostics); break; case SyntaxKind.ArgumentList: var invocation = (ConstructorInitializerSyntax)_nodeToBind.Parent; _nodeBinder.BindConstructorInitializer(invocation, diagnostics); break; case SyntaxKind.CasePatternSwitchLabel: _nodeBinder.BindPatternSwitchLabelForInference((CasePatternSwitchLabelSyntax)_nodeToBind, diagnostics); break; case SyntaxKind.VariableDeclarator: // This occurs, for example, in // int x, y[out var Z, 1 is int I]; // for (int x, y[out var Z, 1 is int I]; ;) {} _nodeBinder.BindDeclaratorArguments((VariableDeclaratorSyntax)_nodeToBind, diagnostics); break; case SyntaxKind.SwitchExpressionArm: var arm = (SwitchExpressionArmSyntax)_nodeToBind; var armBinder = (SwitchExpressionArmBinder)_nodeBinder; armBinder.BindSwitchExpressionArm(arm, diagnostics); break; default: _nodeBinder.BindExpression((ExpressionSyntax)_nodeToBind, diagnostics); break; } if (this._type.IsDefault) { Debug.Assert(this.DeclarationKind == LocalDeclarationKind.DeclarationExpressionVariable); SetType(TypeSymbolWithAnnotations.Create(_nodeBinder.CreateErrorType("var"))); } return(_type.ToType()); }
private static SmallDictionary <TypeParameterSymbol, TypeSymbolWithAnnotations> ConstructMapping(ImmutableArray <TypeParameterSymbol> from, ImmutableArray <TypeSymbolWithAnnotations> to) { var mapping = new SmallDictionary <TypeParameterSymbol, TypeSymbolWithAnnotations>(ReferenceEqualityComparer.Instance); Debug.Assert(from.Length == to.Length); for (int i = 0; i < from.Length; i++) { TypeParameterSymbol tp = from[i]; TypeSymbolWithAnnotations ta = to[i]; if (!ta.Is(tp)) { mapping.Add(tp, ta); } } return(mapping); }
protected override void MethodChecks(DiagnosticBag diagnostics) { var syntax = GetSyntax(); var binderFactory = this.DeclaringCompilation.GetBinderFactory(syntax.SyntaxTree); ParameterListSyntax parameterList = syntax.ParameterList; // NOTE: if we asked for the binder for the body of the constructor, we'd risk a stack overflow because // we might still be constructing the member list of the containing type. However, getting the binder // for the parameters should be safe. var bodyBinder = binderFactory.GetBinder(parameterList, syntax, this).WithContainingMemberOrLambda(this); // Constraint checking for parameter and return types must be delayed until // the method has been added to the containing type member list since // evaluating the constraints may depend on accessing this method from // the container (comparing this method to others to find overrides for // instance). Constraints are checked in AfterAddingTypeMembersChecks. var signatureBinder = bodyBinder.WithAdditionalFlagsAndContainingMemberOrLambda(BinderFlags.SuppressConstraintChecks, this); SyntaxToken arglistToken; _lazyParameters = ParameterHelpers.MakeParameters( signatureBinder, this, parameterList, out arglistToken, allowRefOrOut: true, allowThis: false, addRefReadOnlyModifier: false, diagnostics: diagnostics); _lazyIsVararg = (arglistToken.Kind() == SyntaxKind.ArgListKeyword); _lazyReturnType = TypeSymbolWithAnnotations.Create(bodyBinder.GetSpecialType(SpecialType.System_Void, diagnostics, syntax)); var location = this.Locations[0]; if (MethodKind == MethodKind.StaticConstructor && (_lazyParameters.Length != 0)) { diagnostics.Add(ErrorCode.ERR_StaticConstParam, location, this); } this.CheckEffectiveAccessibility(_lazyReturnType, _lazyParameters, diagnostics); if (_lazyIsVararg && (IsGenericMethod || ContainingType.IsGenericType || _lazyParameters.Length > 0 && _lazyParameters[_lazyParameters.Length - 1].IsParams)) { diagnostics.Add(ErrorCode.ERR_BadVarargs, location); } }
internal SynthesizedSubmissionConstructor(NamedTypeSymbol containingType, DiagnosticBag diagnostics) : base(containingType) { Debug.Assert(containingType.TypeKind == TypeKind.Submission); Debug.Assert(diagnostics != null); var compilation = containingType.DeclaringCompilation; var submissionArrayType = compilation.CreateArrayTypeSymbol(compilation.GetSpecialType(SpecialType.System_Object)); var useSiteError = submissionArrayType.GetUseSiteDiagnostic(); if (useSiteError != null) { diagnostics.Add(useSiteError, NoLocation.Singleton); } _parameters = ImmutableArray.Create <ParameterSymbol>( SynthesizedParameterSymbol.Create(this, TypeSymbolWithAnnotations.Create(submissionArrayType), 0, RefKind.None, "submissionArray")); }
private ArrayTypeSymbol SubstituteArrayType(ArrayTypeSymbol t) { var oldElement = t.ElementType; TypeSymbolWithAnnotations element = oldElement.SubstituteTypeWithTupleUnification(this); if (element.IsSameAs(oldElement)) { return(t); } if (t.IsSZArray) { ImmutableArray <NamedTypeSymbol> interfaces = t.InterfacesNoUseSiteDiagnostics(); Debug.Assert(0 <= interfaces.Length && interfaces.Length <= 2); if (interfaces.Length == 1) { Debug.Assert(interfaces[0] is NamedTypeSymbol); // IList<T> interfaces = ImmutableArray.Create <NamedTypeSymbol>(SubstituteNamedType(interfaces[0])); } else if (interfaces.Length == 2) { Debug.Assert(interfaces[0] is NamedTypeSymbol); // IList<T> interfaces = ImmutableArray.Create <NamedTypeSymbol>(SubstituteNamedType(interfaces[0]), SubstituteNamedType(interfaces[1])); } else if (interfaces.Length != 0) { throw ExceptionUtilities.Unreachable; } return(ArrayTypeSymbol.CreateSZArray( element, t.BaseTypeNoUseSiteDiagnostics, interfaces)); } return(ArrayTypeSymbol.CreateMDArray( element, t.Rank, t.Sizes, t.LowerBounds, t.BaseTypeNoUseSiteDiagnostics)); }
private TypeSymbolWithAnnotations ComputeReturnType(DiagnosticBag diagnostics) { if (this.MethodKind == MethodKind.PropertyGet) { var type = _property.Type; if (!ContainingType.IsInterfaceType() && type.TypeSymbol.IsStatic) { // '{0}': static types cannot be used as return types diagnostics.Add(ErrorCode.ERR_ReturnTypeIsStaticClass, this.locations[0], type.TypeSymbol); } return(type); } else { var binder = GetBinder(); return(TypeSymbolWithAnnotations.Create(binder.GetSpecialType(SpecialType.System_Void, diagnostics, this.GetSyntax()))); } }
/// <remarks> /// Out params are updated by assignment. If you require thread-safety, pass temps and then /// CompareExchange them back into shared memory. /// </remarks> internal static void CopyMethodCustomModifiers( MethodSymbol sourceMethod, MethodSymbol destinationMethod, out TypeSymbolWithAnnotations returnType, out ImmutableArray <CustomModifier> customModifiers, out ImmutableArray <ParameterSymbol> parameters, bool alsoCopyParamsModifier) // Last since always named. { Debug.Assert((object)sourceMethod != null); // Assert: none of the method's type parameters have been substituted Debug.Assert((object)sourceMethod == sourceMethod.ConstructedFrom); // For the most part, we will copy custom modifiers by copying types. // The only time when this fails is when the type refers to a type parameter // owned by the overridden method. We need to replace all such references // with (equivalent) type parameters owned by this method. We know that // we can perform this mapping positionally, because the method signatures // have already been compared. MethodSymbol constructedSourceMethod = sourceMethod.ConstructIfGeneric(destinationMethod.TypeArguments); customModifiers = destinationMethod.RefKind != RefKind.None ? constructedSourceMethod.RefCustomModifiers : ImmutableArray <CustomModifier> .Empty; parameters = CopyParameterCustomModifiers(constructedSourceMethod.Parameters, destinationMethod.Parameters, alsoCopyParamsModifier); returnType = destinationMethod.ReturnType; // Default value - in case we don't copy the custom modifiers. TypeSymbol returnTypeSymbol = returnType.TypeSymbol; var sourceMethodReturnType = constructedSourceMethod.ReturnType; // We do an extra check before copying the return type to handle the case where the overriding // method (incorrectly) has a different return type than the overridden method. In such cases, // we want to retain the original (incorrect) return type to avoid hiding the return type // given in source. TypeSymbol returnTypeWithCustomModifiers = sourceMethodReturnType.TypeSymbol; if (returnTypeSymbol.Equals(returnTypeWithCustomModifiers, TypeCompareKind.AllIgnoreOptions)) { returnType = returnType.WithTypeAndModifiers(CopyTypeCustomModifiers(returnTypeWithCustomModifiers, returnTypeSymbol, destinationMethod.ContainingAssembly, nonNullTypesContext: destinationMethod), sourceMethodReturnType.CustomModifiers); } }
public SignatureOnlyPropertySymbol( string name, TypeSymbol containingType, ImmutableArray <ParameterSymbol> parameters, RefKind refKind, TypeSymbolWithAnnotations type, ImmutableArray <CustomModifier> refCustomModifiers, bool isStatic, ImmutableArray <PropertySymbol> explicitInterfaceImplementations) { _refKind = refKind; _type = type; _refCustomModifiers = refCustomModifiers; _isStatic = isStatic; _parameters = parameters; _explicitInterfaceImplementations = explicitInterfaceImplementations.NullToEmpty(); _containingType = containingType; _name = name; }
public static InjectedNonNullTypesAttributeSymbol Create(NamespaceSymbol containingNamespace) { return(new InjectedNonNullTypesAttributeSymbol(AttributeDescription.NonNullTypesAttribute, containingNamespace, containingNamespace.DeclaringCompilation, makeConstructor)); ImmutableArray <MethodSymbol> makeConstructor(CSharpCompilation compilation, NamedTypeSymbol containingType, DiagnosticBag diagnostics) { var boolType = compilation.GetSpecialType(SpecialType.System_Boolean); Binder.ReportUseSiteDiagnostics(boolType, diagnostics, Location.None); var boolWithAnnotations = TypeSymbolWithAnnotations.Create(boolType); // https://github.com/dotnet/roslyn/issues/30143: Constructor should save the parameter into a field (for users of reflection) return(ImmutableArray.Create <MethodSymbol>( new NonNullTypesAttributeConstructorSymbol( containingType, m => ImmutableArray.Create(SynthesizedParameterSymbol.Create(m, boolWithAnnotations, 0, ConstantValue.True, name: "flag"))))); } }
internal override TypeSymbolWithAnnotations GetFieldType(ConsList <FieldSymbol> fieldsBeingBound) { Debug.Assert(fieldsBeingBound != null); if (!_lazyType.IsNull) { return(_lazyType.ToType()); } var typeSyntax = TypeSyntax; var compilation = this.DeclaringCompilation; var diagnostics = DiagnosticBag.GetInstance(); var binderFactory = compilation.GetBinderFactory(SyntaxTree); var binder = binderFactory.GetBinder(typeSyntax); bool isVar; TypeSymbolWithAnnotations type = binder.BindTypeOrVarKeyword(typeSyntax, diagnostics, out isVar); Debug.Assert(!type.IsNull || isVar); if (isVar && !fieldsBeingBound.ContainsReference(this)) { InferFieldType(fieldsBeingBound, binder); Debug.Assert(!_lazyType.IsNull); } else { if (isVar) { diagnostics.Add(ErrorCode.ERR_RecursivelyTypedVariable, this.ErrorLocation, this); type = TypeSymbolWithAnnotations.Create(binder.NonNullTypesContext, binder.CreateErrorType("var")); } SetType(compilation, diagnostics, type); } diagnostics.Free(); return(_lazyType.ToType()); }
public LambdaSymbol( CSharpCompilation compilation, Symbol containingSymbol, UnboundLambda unboundLambda, ImmutableArray <TypeSymbolWithAnnotations> parameterTypes, ImmutableArray <RefKind> parameterRefKinds, RefKind refKind, TypeSymbolWithAnnotations returnType, DiagnosticBag diagnostics) { _containingSymbol = containingSymbol; _messageID = unboundLambda.Data.MessageID; _syntax = unboundLambda.Syntax; _refKind = refKind; _returnType = !returnType.HasType ? TypeSymbolWithAnnotations.Create(ReturnTypeIsBeingInferred) : returnType; _isSynthesized = unboundLambda.WasCompilerGenerated; _isAsync = unboundLambda.IsAsync; // No point in making this lazy. We are always going to need these soon after creation of the symbol. _parameters = MakeParameters(compilation, unboundLambda, parameterTypes, parameterRefKinds, diagnostics); }
/// <summary> /// Perform the substitution on the given type. Each occurrence of the type parameter is /// replaced with its corresponding type argument from the map. /// </summary> /// <param name="previous">The type to be rewritten.</param> /// <returns>The type with type parameters replaced with the type arguments.</returns> internal TypeSymbolWithAnnotations SubstituteType(TypeSymbol previous) { if (ReferenceEquals(previous, null)) { return(default(TypeSymbolWithAnnotations)); } TypeSymbol result; switch (previous.Kind) { case SymbolKind.NamedType: result = SubstituteNamedType((NamedTypeSymbol)previous); break; case SymbolKind.TypeParameter: return(SubstituteTypeParameter((TypeParameterSymbol)previous)); case SymbolKind.ArrayType: result = SubstituteArrayType((ArrayTypeSymbol)previous); break; case SymbolKind.PointerType: result = SubstitutePointerType((PointerTypeSymbol)previous); break; case SymbolKind.DynamicType: result = SubstituteDynamicType(); break; case SymbolKind.ErrorType: return(((ErrorTypeSymbol)previous).Substitute(this)); default: result = previous; break; } // https://github.com/dotnet/roslyn/issues/30072: we're dropping annotation and context return(TypeSymbolWithAnnotations.Create(result)); }
Cci.ITypeReference Cci.IFieldReference.GetType(EmitContext context) { PEModuleBuilder moduleBeingBuilt = (PEModuleBuilder)context.Module; TypeSymbolWithAnnotations fieldType = this.Type; var customModifiers = fieldType.CustomModifiers; var isFixed = this.IsFixed; var implType = isFixed ? this.FixedImplementationType(moduleBeingBuilt) : fieldType.TypeSymbol; var type = moduleBeingBuilt.Translate(implType, syntaxNodeOpt: (CSharpSyntaxNode)context.SyntaxNodeOpt, diagnostics: context.Diagnostics); if (isFixed || customModifiers.Length == 0) { return(type); } else { return(new Cci.ModifiedTypeReference(type, customModifiers.As <Cci.ICustomModifier>())); } }
protected SourceParameterSymbol( Symbol owner, TypeSymbolWithAnnotations parameterType, int ordinal, RefKind refKind, string name, ImmutableArray <Location> locations) : base(owner, ordinal) { #if DEBUG foreach (var location in locations) { Debug.Assert(location != null); } #endif Debug.Assert((owner.Kind == SymbolKind.Method) || (owner.Kind == SymbolKind.Property)); this.parameterType = parameterType; _refKind = refKind; _name = name; _locations = locations; }
IEnumerable <Cci.TypeReferenceWithAttributes> Cci.ITypeDefinition.Interfaces(EmitContext context) { Debug.Assert(((Cci.ITypeReference) this).AsTypeDefinition(context) != null); PEModuleBuilder moduleBeingBuilt = (PEModuleBuilder)context.Module; foreach (NamedTypeSymbol @interface in this.GetInterfacesToEmit()) { var typeRef = moduleBeingBuilt.Translate( @interface, syntaxNodeOpt: (CSharpSyntaxNode)context.SyntaxNodeOpt, diagnostics: context.Diagnostics, fromImplements: true); var type = TypeSymbolWithAnnotations.Create(@interface); yield return(type.GetTypeRefWithAttributes( moduleBeingBuilt, declaringSymbol: this, typeRef)); } }
internal static SynthesizedEntryPointSymbol Create(SynthesizedInteractiveInitializerMethod initializerMethod, DiagnosticBag diagnostics) { var containingType = initializerMethod.ContainingType; var compilation = containingType.DeclaringCompilation; if (compilation.IsSubmission) { var systemObject = Binder.GetSpecialType(compilation, SpecialType.System_Object, DummySyntax(), diagnostics); var submissionArrayType = compilation.CreateArrayTypeSymbol(systemObject); ReportUseSiteDiagnostics(submissionArrayType, diagnostics); return(new SubmissionEntryPoint( containingType, initializerMethod.ReturnType, submissionArrayType)); } else { var systemVoid = Binder.GetSpecialType(compilation, SpecialType.System_Void, DummySyntax(), diagnostics); return(new ScriptEntryPoint(containingType, TypeSymbolWithAnnotations.Create(nonNullTypesContext: containingType, systemVoid))); } }
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, TypeSymbolWithAnnotations.Create(typeParams[i]), i, refKind); } _parameters = parameters.AsImmutableOrNull(); }