Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ExpressionParserCore"/> class.
        /// </summary>
        /// <param name="spResult">The sp result.</param>
        /// <param name="delegateType">Type of the delegate.</param>
        /// <param name="namespaces">The namespaces.</param>
        public ExpressionParserCore(SymbolParseResult spResult, Type delegateType, IEnumerable <string> namespaces = null, IEnumerable <Assembly> assemblies = null)
        {
            this.spResult = spResult;

            this.typeParser = new TypeParser(ref this.spResult);
            typeParser.SetNamespaces(namespaces);
            typeParser.SetAssemblies(assemblies);

            var method = delegateType.GetMethod("Invoke");

            parameterTypes = method.GetParameters().Select(p => p.ParameterType).ToArray();
            returnType     = method.ReturnType;
        }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TypeParser"/> class.
 /// </summary>
 /// <param name="spResult">The symbol parse result.</param>
 internal TypeParser(ref SymbolParseResult spResult)
 {
     this.spResult = spResult;
 }
Пример #3
0
        /// <summary>
        /// 解析字符串为类型
        /// </summary>
        /// <returns>读取的类型</returns>
        public Type Resolve(string typeString)
        {
            spResult = SymbolParser.Build(typeString);

            return(ReadType());
        }