/// <summary> /// Returns the function pointer denoted by this expression. /// </summary> private IFunctionPointer Resolve(VccFunctionTypeExpression functionTypeExpression) { List<ParameterDefinition> parameters = new List<ParameterDefinition>(); foreach (ParameterDeclaration par in functionTypeExpression.Parameters) parameters.Add(par.ParameterDefinition); IEnumerable<IParameterTypeInformation> parameterTypes = IteratorHelper.GetConversionEnumerable<ParameterDefinition, IParameterTypeInformation>(parameters); //List<ICustomModifier> returnValueModifiers = new List<ICustomModifier>(1); //returnValueModifiers.Add(new CustomModifier(true, this.PlatformType.SystemRuntimeCompilerServicesCallConvCdecl)); //FunctionPointerType result = new FunctionPointerType(functionTypeExpression.CallingConvention, false, functionTypeExpression.ReturnType.ResolvedType, returnValueModifiers.AsReadOnly(), parameterTypes, null, this.Compilation.HostEnvironment.InternFactory); VccFunctionPointerType result = new VccFunctionPointerType(functionTypeExpression.Name, functionTypeExpression.CallingConvention, false, functionTypeExpression.ReturnType.ResolvedType, null, parameterTypes, null, this.Compilation.HostEnvironment.InternFactory); IMethodContract/*?*/ contract = this.Compilation.ContractProvider.GetMethodContractFor(this); if (contract != null) this.Compilation.ContractProvider.AssociateMethodWithContract(result, contract); return result; }
private VccFunctionTypeExpression(BlockStatement containingBlock, VccFunctionTypeExpression template) : base(containingBlock, template) { this.AcceptsExtraArguments = template.AcceptsExtraArguments; this.CallingConvention = template.CallingConvention; this.ReturnType = (TypeExpression)template.ReturnType.MakeCopyFor(containingBlock); this.Name = template.Name.MakeCopyFor(containingBlock.Compilation); this.parameters = new List<ParameterDeclaration>(template.parameters); this.declarator = template.declarator; }