Exemplo n.º 1
0
Arquivo: doc.cs Projeto: mdae/MonoRT
        private static Type FindDocumentedTypeNonArray(MemberCore mc,
                                                       string identifier, DeclSpace ds, string cref, Report r)
        {
            switch (identifier)
            {
            case "int":
                return(TypeManager.int32_type);

            case "uint":
                return(TypeManager.uint32_type);

            case "short":
                return(TypeManager.short_type);;

            case "ushort":
                return(TypeManager.ushort_type);

            case "long":
                return(TypeManager.int64_type);

            case "ulong":
                return(TypeManager.uint64_type);;

            case "float":
                return(TypeManager.float_type);;

            case "double":
                return(TypeManager.double_type);

            case "char":
                return(TypeManager.char_type);;

            case "decimal":
                return(TypeManager.decimal_type);;

            case "byte":
                return(TypeManager.byte_type);;

            case "sbyte":
                return(TypeManager.sbyte_type);;

            case "object":
                return(TypeManager.object_type);;

            case "bool":
                return(TypeManager.bool_type);;

            case "string":
                return(TypeManager.string_type);;

            case "void":
                return(TypeManager.void_type);;
            }
            FullNamedExpression e = ds.LookupNamespaceOrType(identifier, mc.Location, false);

            if (e != null)
            {
                if (!(e is TypeExpr))
                {
                    return(null);
                }
                return(e.Type);
            }
            int index = identifier.LastIndexOf('.');

            if (index < 0)
            {
                return(null);
            }
            int  warn;
            Type parent = FindDocumentedType(mc, identifier.Substring(0, index), ds, cref, r);

            if (parent == null)
            {
                return(null);
            }
            // no need to detect warning 419 here
            return(FindDocumentedMember(mc, parent,
                                        identifier.Substring(index + 1),
                                        null, ds, out warn, cref, false, null, r).Member as Type);
        }
Exemplo n.º 2
0
        private static TypeSpec FindDocumentedTypeNonArray(MemberCore mc,
                                                           string identifier, DeclSpace ds, string cref, Report r)
        {
            switch (identifier)
            {
            case "int":
                return(TypeManager.int32_type);

            case "uint":
                return(TypeManager.uint32_type);

            case "short":
                return(TypeManager.short_type);;

            case "ushort":
                return(TypeManager.ushort_type);

            case "long":
                return(TypeManager.int64_type);

            case "ulong":
                return(TypeManager.uint64_type);;

            case "float":
                return(TypeManager.float_type);;

            case "double":
                return(TypeManager.double_type);

            case "char":
                return(TypeManager.char_type);;

            case "decimal":
                return(TypeManager.decimal_type);;

            case "byte":
                return(TypeManager.byte_type);;

            case "sbyte":
                return(TypeManager.sbyte_type);;

            case "object":
                return(TypeManager.object_type);;

            case "bool":
                return(TypeManager.bool_type);;

            case "string":
                return(TypeManager.string_type);;

            case "void":
                return(TypeManager.void_type);;
            }
            FullNamedExpression e = ds.LookupNamespaceOrType(identifier, 0, mc.Location, false);

            if (e != null)
            {
                if (!(e is TypeExpr))
                {
                    return(null);
                }
                return(e.Type);
            }
            int index = identifier.LastIndexOf('.');

            if (index < 0)
            {
                return(null);
            }

            var       nsName   = identifier.Substring(0, index);
            var       typeName = identifier.Substring(index + 1);
            Namespace ns       = ds.NamespaceEntry.NS.GetNamespace(nsName, false);

            ns = ns ?? mc.Module.GlobalRootNamespace.GetNamespace(nsName, false);
            if (ns != null)
            {
                var te = ns.LookupType(mc.Compiler, typeName, 0, true, mc.Location);
                if (te != null)
                {
                    return(te.Type);
                }
            }

            int      warn;
            TypeSpec parent = FindDocumentedType(mc, identifier.Substring(0, index), ds, cref, r);

            if (parent == null)
            {
                return(null);
            }
            // no need to detect warning 419 here
            var ts = FindDocumentedMember(mc, parent,
                                          identifier.Substring(index + 1),
                                          null, ds, out warn, cref, false, null, r) as TypeSpec;

            if (ts != null)
            {
                return(ts);
            }
            return(null);
        }
Exemplo n.º 3
0
        private static TypeSpec FindDocumentedTypeNonArray(MemberCore mc,
                                                           string identifier, DeclSpace ds, string cref, Report r)
        {
            var types = mc.Module.Compiler.BuiltinTypes;

            switch (identifier)
            {
            case "int":
                return(types.Int);

            case "uint":
                return(types.UInt);

            case "short":
                return(types.Short);

            case "ushort":
                return(types.UShort);

            case "long":
                return(types.Long);

            case "ulong":
                return(types.ULong);

            case "float":
                return(types.Float);

            case "double":
                return(types.Double);

            case "char":
                return(types.Char);

            case "decimal":
                return(types.Decimal);

            case "byte":
                return(types.Byte);

            case "sbyte":
                return(types.SByte);

            case "object":
                return(types.Object);

            case "bool":
                return(types.Bool);

            case "string":
                return(types.String);

            case "void":
                return(types.Void);
            }
            FullNamedExpression e = ds.LookupNamespaceOrType(identifier, 0, mc.Location, false);

            if (e != null)
            {
                if (!(e is TypeExpr))
                {
                    return(null);
                }
                return(e.Type);
            }
            int index = identifier.LastIndexOf('.');

            if (index < 0)
            {
                return(null);
            }

            var       nsName   = identifier.Substring(0, index);
            var       typeName = identifier.Substring(index + 1);
            Namespace ns       = ds.NamespaceEntry.NS.GetNamespace(nsName, false);

            ns = ns ?? mc.Module.GlobalRootNamespace.GetNamespace(nsName, false);
            if (ns != null)
            {
                var te = ns.LookupType(mc, typeName, 0, true, mc.Location);
                if (te != null)
                {
                    return(te.Type);
                }
            }

            int      warn;
            TypeSpec parent = FindDocumentedType(mc, identifier.Substring(0, index), ds, cref, r);

            if (parent == null)
            {
                return(null);
            }
            // no need to detect warning 419 here
            var ts = FindDocumentedMember(mc, parent,
                                          identifier.Substring(index + 1),
                                          null, ds, out warn, cref, false, null, r) as TypeSpec;

            if (ts != null)
            {
                return(ts);
            }
            return(null);
        }