Пример #1
0
        public MethodCallHiretachy GetMethod(Tree val, IList <Tree> Params)
        {
            var @params = new Class[Params.Count];

            for (var j = 0; j < @params.Length; j++)
            {
                //if (Params[j].Type == null)
                //    if (!TypeCalc.CalcTypes(Params[j]))
                //        throw new TypeLoadException();
                @params[j] = Params[j].Type;
            }
            return(_this.CurrentScop.Finder.GetMethod(ByteCodeMapper.Split(val.Content), @params));
        }
Пример #2
0
        public static void _Test()
        {
            while (true)
            {
                __test();

                var parse = new BasicParse {
                    Pile = new Pile(Prg_Example)
                };
                var parent = new Tree(parse.Pile, null, Kind.Program);
                var glob   = CurrentScop.Initialize("globe");
                Update(parse);
                var s = new Space(parse);
                if (s.Parse(parent))
                {
                    var byteCode = new ByteCodeMapper(glob);
                    var load     = new LoadClasses(byteCode);
                    load.Add(parent[0]);
                    load.Compile();
                    var inst = load.Optimum.Instructs;
                    var sw   = new IO.Stream.StreamWriter(true);
                    for (int i = 0; i < inst.Count; i++)
                    {
                        inst[i].Push(sw);
                    }
                    var tt = inst[0].Length;
                    var sr = new IO.Stream.StreamReader(sw);
                    for (int i = 0; i < inst.Count; i++)
                    {
                        var x     = Instruct.Pop(sr);
                        var isieq = x.Equals(inst[i]);
                        if (!isieq)
                        {
                        }
                    }
                }
            }
        }
Пример #3
0
        private bool CalcHeritachyType(Tree tree)
        {
            Heritachy <Var>   v;
            Heritachy <Class> e;
            var fn     = _byteCodeMapper.CurrentScop.Finder;
            var hers   = ByteCodeMapper.Split(tree.Content);
            var parent = tree.Parent;
            Heritachy <Method> t;

            if (parent != null && parent.Kind == Kind.Caller && (t = _byteCodeMapper.ClassLoader.GetMethod(parent[0], parent[1].Children)) != null)
            {
                tree.Type = t.main.Return;
                var tmp = t.HeritachyType;
                CopyTypes(t.HeritachyType, tree.Children);
            }
            else if ((v = fn.GetVariable(hers)) != null)
            {
                CopyTypes(v.HeritachyType, tree.Children);
                tree.Type   = v.main.Return;
                tree.Membre = v.main;
            }
            else if ((e = fn.GetClass(hers)) != null)
            {
                tree.Type = CopyTypes(e.HeritachyType, tree.Children).Type;
                tree.Type = e.main;
            }
            else
            {
                var s = fn.GetSpace(hers);
                if (s == null)
                {
                    return(SetCompiled(tree, false));
                }
                tree.Type = fn.GetClass("System.void");
            }
            return(SetCompiled(tree, true));
        }
Пример #4
0
 public Heritachy <Var> GetVariable(string name)
 {
     return(_this.CurrentScop.Finder.GetVariable(ByteCodeMapper.Split(name)));
 }
Пример #5
0
 public VarManager(ByteCodeMapper byteCodeMapper)
 {
     _this = byteCodeMapper;
 }
Пример #6
0
        public FieldInfo SetVariable(string type, string varName)
        {
            var @class = _this.CurrentScop.Finder.GetClass(ByteCodeMapper.Split(type));

            return(SetVariable(@class, varName));
        }
Пример #7
0
 public Optimum(ByteCodeMapper byteCodeMapper)
 {
     _byteCodeMapper = byteCodeMapper;
     //Add = _add;
 }
Пример #8
0
 public TypeCalc(ByteCodeMapper byteCodeMapper)
 {
     _byteCodeMapper = byteCodeMapper;
 }