Exemplo n.º 1
0
        private void Initialize(CILConverter CILConverter, string Name, Lazy<MethodInfo> MethodInfoLazy, SafeMethodTypeInfo SafeMethodTypeInfo = null)
        {
            this.Name = Name;
            this._MethodInfoLazy = MethodInfoLazy;
            this.SafeMethodTypeInfo = SafeMethodTypeInfo;

            Type ReturnType;
            Type[] ParametersType;

            BodyFinalized = MethodInfoLazy.IsValueCreated;

            if (SafeMethodTypeInfo != null)
            {
                ReturnType = SafeMethodTypeInfo.ReturnType;
                ParametersType = SafeMethodTypeInfo.Parameters;
            }
            else
            {
                ReturnType = this.MethodInfo.ReturnType;
                ParametersType = this.MethodInfo.GetParameters().Select(Item => Item.ParameterType).ToArray();
            }

            var ReturnCType = CILConverter.ConvertTypeToCType(ReturnType);
            var ParametersCType = new List<CType>();

            foreach (var ParameterType in ParametersType)
            {
                ParametersCType.Add(CILConverter.ConvertTypeToCType(ParameterType));
            }

            this.CFunctionType = new CFunctionType(
                ReturnCType,
                Name,
                ParametersCType.Select(Item => new CSymbol() { CType = Item }).ToArray()
            );
        }
Exemplo n.º 2
0
        private void Initialize(CILConverter CILConverter, string Name, Lazy <MethodInfo> MethodInfoLazy, SafeMethodTypeInfo SafeMethodTypeInfo = null)
        {
            this.Name               = Name;
            this._MethodInfoLazy    = MethodInfoLazy;
            this.SafeMethodTypeInfo = SafeMethodTypeInfo;

            Type ReturnType;

            Type[] ParametersType;

            BodyFinalized = MethodInfoLazy.IsValueCreated;

            if (SafeMethodTypeInfo != null)
            {
                ReturnType     = SafeMethodTypeInfo.ReturnType;
                ParametersType = SafeMethodTypeInfo.Parameters;
            }
            else
            {
                ReturnType     = this.MethodInfo.ReturnType;
                ParametersType = this.MethodInfo.GetParameters().Select(Item => Item.ParameterType).ToArray();
            }

            var ReturnCType     = CILConverter.ConvertTypeToCType(ReturnType);
            var ParametersCType = new List <CType>();

            foreach (var ParameterType in ParametersType)
            {
                ParametersCType.Add(CILConverter.ConvertTypeToCType(ParameterType));
            }

            this.CFunctionType = new CFunctionType(
                ReturnCType,
                Name,
                ParametersCType.Select(Item => new CSymbol()
            {
                CType = Item
            }).ToArray()
                );
        }
Exemplo n.º 3
0
        public FunctionReference(CILConverter CILConverter, string Name, MethodInfo MethodInfo, SafeMethodTypeInfo SafeMethodTypeInfo = null)
        {
            var MethodInfoLazy    = new Lazy <MethodInfo>(() => { return(MethodInfo); });
            var MethodInfoCreated = MethodInfoLazy.Value;

            Initialize(CILConverter, Name, MethodInfoLazy, SafeMethodTypeInfo);
        }
Exemplo n.º 4
0
 public FunctionReference(CILConverter CILConverter, string Name, Lazy <MethodInfo> MethodInfoLazy, SafeMethodTypeInfo SafeMethodTypeInfo = null)
 {
     Initialize(CILConverter, Name, MethodInfoLazy, SafeMethodTypeInfo);
 }
Exemplo n.º 5
0
 public FunctionReference(CILConverter CILConverter, string Name, MethodInfo MethodInfo, SafeMethodTypeInfo SafeMethodTypeInfo = null)
 {
     var MethodInfoLazy = new Lazy<MethodInfo>(() => { return MethodInfo; });
     var MethodInfoCreated = MethodInfoLazy.Value;
     Initialize(CILConverter, Name, MethodInfoLazy, SafeMethodTypeInfo);
 }
Exemplo n.º 6
0
 public FunctionReference(CILConverter CILConverter, string Name, Lazy<MethodInfo> MethodInfoLazy, SafeMethodTypeInfo SafeMethodTypeInfo = null)
 {
     Initialize(CILConverter, Name, MethodInfoLazy, SafeMethodTypeInfo);
 }