Beispiel #1
0
        public static Method CreateMethod(MethodInfo methodInfo, TsType parent)
        {
            var method = new Method(methodInfo.Name, parent)
            {
                IsStatic = methodInfo.IsStatic
            };

            var parameters = methodInfo.GetParameters();
            foreach (var parameterInfo in parameters)
            {
                method.Parameters.Add(MethodParameterFactory.Create(parameterInfo, method));
            }

            if (methodInfo.IsGenericMethod)
            {
                var genericArguments = methodInfo.GetGenericArguments();
                foreach (var argument in genericArguments)
                {
                    method.Generics.Add(new GenericDefinition(argument.Name));
                }
            }

            if (methodInfo.ReturnType != typeof(void))
            {
                method.Return = new TsUndefined { UnderlyingType = methodInfo.ReturnType };
            }

            return method;
        }
 public static MethodParameter Create(ParameterInfo parameterInfo, Method parent)
 {
     return new MethodParameter(parameterInfo.Name, parent)
     {
         Type = new TsUndefined { UnderlyingType = parameterInfo.ParameterType },
         Optional = parameterInfo.IsOptional,
     };
 }
Beispiel #3
0
 public bool Matches(Method method)
 {
     return Name == method.Name && Parameters.Count == method.Parameters.Count;
 }
Beispiel #4
0
 public MethodParameter(string name, Method method)
 {
     Name = name;
     Method = method;
 }