Ejemplo n.º 1
0
        /// <summary>
        /// Reads the type, which can either be a method return/parameter type or a field type, and skips it.
        /// </summary>
        public TypeOf? ReadTypeOf(bool isMethodParameter)
        {
            while(ReadAnnotation().HasValue){} // skip type annotations

            if (isMethodParameter)SkipIfMatch("final^s"); // skip final keyword in method parameters
            else SkipGenerics(); // skip method return type generics

            // void
            if (SkipIfMatch("void^s"))return TypeOf.Void();

            // primitive
            Primitives? primitive = ReadPrimitive();

            if (primitive.HasValue){
                SkipTypeArrayAndGenerics();
                return TypeOf.Primitive(primitive.Value);
            }

            // object name
            string typeName = ReadFullTypeName();

            if (typeName.Length > 0){
                SkipTypeArrayAndGenerics();
                return TypeOf.Object(JavaParseUtils.FullToSimpleName(typeName));
            }

            // nothing
            return null;
        }