Beispiel #1
0
        public HashSet <string> GetMethodBodyDependences(Metadata.DB_Type type)
        {
            Metadata.Model model = new Metadata.Model(new FileFinder(project.dependence_dir));

            Metadata.MyCppMethodBodyTypeFinder f = new Metadata.MyCppMethodBodyTypeFinder(model);
            model.AcceptTypeVisitor(f, type);

            HashSet <string> set = new HashSet <string>();

            foreach (var s in f.typeRef)
            {
                if (s.IsVoid)
                {
                    continue;
                }
                if (s.isGenericParameter)
                {
                    continue;
                }
                set.Add(s.GetTypeDefinitionFullName());
                foreach (var l in GetTypeList(s))
                {
                    set.Add(l);
                }
            }

            return(set);
        }
Beispiel #2
0
            //查找一个类型,如果是动态类型,构造一个
            public Metadata.DB_Type FindType(Metadata.Expression.TypeSyntax refType, Metadata.Model model)
            {
                if (refType.IsVoid)
                {
                    return(null);
                }
                Metadata.DB_Type type = Model.GetType(refType, model);
                if (type == null)
                {
                    type = Metadata.DB.LoadType(path, refType.GetTypeDefinitionFullName());
                    Model.types.Add(refType.GetTypeDefinitionFullName(), type);
                    return(Model.GetType(refType, model));;
                }

                return(type);
            }
Beispiel #3
0
        //返回一个类型的不可以声明的类型
        public HashSet <string> GetTypeDependencesNoDeclareType(Metadata.DB_Type type)
        {
            HashSet <string> set = new HashSet <string>();

            Metadata.Model model = new Metadata.Model(new FileFinder(project.dependence_dir));

            MyCppHeaderTypeNoDeclareFinder f = new MyCppHeaderTypeNoDeclareFinder(model);

            model.AcceptTypeVisitor(f, type);

            //泛型需要添加方法体
            if (type.is_generic_type_definition)
            {
                set = GetMethodBodyDependences(type);
            }


            foreach (var s in f.result)
            {
                if (s.IsVoid)
                {
                    continue;
                }
                if (s.isGenericParameter)
                {
                    continue;
                }
                set.Add(s.GetTypeDefinitionFullName());
                foreach (var l in GetTypeList(s))
                {
                    set.Add(l);
                }
            }

            return(set);
        }
Beispiel #4
0
            public static Metadata.DB_Type GetType(Metadata.Expression.TypeSyntax typeSyntax, Metadata.Model model)
            {
                if (typeSyntax.isGenericType)
                {
                    Metadata.DB_Type ma = GetType(typeSyntax.GetTypeDefinitionFullName());
                    return(Metadata.DB_Type.MakeGenericType(ma, typeSyntax.args, new Metadata.Model(new Finder())));
                }

                if (typeSyntax.isGenericParameter)
                {
                    //return Metadata.DB_Type.MakeGenericParameterType(GetType(typeSyntax), new Metadata.GenericParameterDefinition() { type_name = gps.Name });
                    return(model.GetIndifierInfo(typeSyntax.Name).type);
                }

                return(GetType(typeSyntax.GetTypeDefinitionFullName()));
            }
Beispiel #5
0
 //查找一个类型,如果是动态类型,构造一个
 public Metadata.DB_Type FindType(Metadata.Expression.TypeSyntax refType, Metadata.Model model)
 {
     return(Model.GetType(refType, model));
 }
Beispiel #6
0
 public MyCppHeaderTypeNoDeclareFinder(Metadata.Model model)
 {
     this.model = model;
 }