Esempio n. 1
0
        //public IScop Get (string eher)
        //{
        //    var hers = new[] {eher};
        //    var c =(IScop) GetVariable(hers);
        //    if ( c != null ) return c;
        //}
        public Heritachy <Var> GetVariable(IList <string> hers)
        {
            HeritachyType vh;

            if (hers == null || hers.Count == 0)
            {
                return(null);
            }
            var var = GetVariable(hers[0]);

            if (var == null)
            {
                return(null);
            }
            var tmp  = vh = new HeritachyType(null, hers[0], var);
            var h    = new Heritachy <Var>(vh, null);
            var scop = var.Return;

            for (var i = 1; i < hers.Count; i++)
            {
                var t = scop.GetField(hers[i], SearcheMode.Flaten);
                if (t == null)
                {
                    return(null);
                }
                var.Push(t);
                scop = t.Return;
                tmp  = new HeritachyType(tmp, hers[i], new Var(t));
            }
            h.main = var;
            return(h);
        }
Esempio n. 2
0
 public HeritachyType(HeritachyType parent, string name, IScop iscop)
 {
     this.name = name;
     Scop      = iscop;
     if (parent != null)
     {
         parent.Children = this;
     }
 }
Esempio n. 3
0
        public Heritachy <Class> GetClass(IList <string> hers)
        {
            HeritachyType tmp;

            if (hers == null || hers.Count == 0)
            {
                return(null);
            }
            if (hers.Count == 1)
            {
                return(new Heritachy <Class>(tmp = new HeritachyType(hers[0], GetClass(hers[0])), (Class)tmp.Scop));
            }
            var space = GetSpace(hers[0]);

            if (space == null)
            {
                return(null);
            }
            var h = new Heritachy <Class>(tmp = new HeritachyType(null, hers[0], space), null);

            for (var i = 1; i < hers.Count - 1; i++)
            {
                space = space.GetSpace(hers[i], SearcheMode.Flaten);
                if (space == null)
                {
                    return(null);
                }
                tmp = tmp.Add(hers[i], space);
            }
            var @class = space.GetClass(hers[hers.Count - 1], SearcheMode.Flaten);

            if (@class != null)
            {
                tmp.Add(hers[hers.Count - 1], @class);
            }
            else
            {
                return(null);
            }
            h.main = @class;
            return(h);
        }
Esempio n. 4
0
        public MethodCallHiretachy GetMethod(IList <string> hers, IList <Class> @params)
        {
            if (hers == null || hers.Count == 0)
            {
                return(null);
            }
            var           deb = hers[0];
            HeritachyType tmp;

            if (hers.Count == 1)
            {
                var method = GetMethod(deb, @params);
                return(new MethodCallHiretachy(new HeritachyType(deb, method), method));
            }
            Var var;
            MethodCallHiretachy h = null;
            Scop scop;

            if ((var = GetVariable(deb)) != null)
            {
                h    = new MethodCallHiretachy(tmp = new HeritachyType(deb, var), null);
                scop = var.Return;
                for (var i = 1; i < hers.Count - 1; i++)
                {
                    var t = scop.GetField(hers[i], SearcheMode.Flaten);
                    if (t == null)
                    {
                        return(null);
                    }
                    var.Push(t);
                    scop = t.Return;
                    tmp  = tmp.Add(hers[i], t);
                }
                if (scop == null)
                {
                    return(null);
                }
                tmp.Add(hers[hers.Count - 1], h.main = scop.GetMethod(hers[hers.Count - 1], @params));
            }
            else if ((scop = GetClass(deb)) != null)
            {
                h = new MethodCallHiretachy(tmp = new HeritachyType(deb, scop));
                tmp.Add(hers[hers.Count - 1], h.main = hers.Count != 2 ? null : scop.GetMethod(hers[1], @params));
            }
            else if ((scop = GetSpace(deb)) != null)
            {
                h = new MethodCallHiretachy(tmp = new HeritachyType(deb, scop));
                for (var i = 1; i < hers.Count - 2; i++)
                {
                    if ((scop = scop.GetSpace(hers[i], SearcheMode.Flaten)) == null)
                    {
                        return(null);
                    }
                    else
                    {
                        tmp = tmp.Add(hers[i], scop);
                    }
                }
                tmp = tmp.Add(hers[hers.Count - 2], scop = scop.GetClass(hers[hers.Count - 2], SearcheMode.Flaten));
                if (scop == null)
                {
                    return(null);
                }
                tmp.Add(hers[hers.Count - 1], h.main = scop.GetMethod(hers[hers.Count - 1], @params));
            }
            return(h);
        }
Esempio n. 5
0
 public MethodCallHiretachy(HeritachyType hiHeritachyType) : base(hiHeritachyType)
 {
 }
Esempio n. 6
0
 public MethodCallHiretachy(HeritachyType heritachyType, Method main = null) : base(heritachyType, main)
 {
 }