public override FieldInfo Compile(LoadClasses load, Scop scop, Tree tree) { if (!new TypeCalc(load.ByteCodeMapper).CalcTypes(tree)) { load.LogIn(scop, tree, this, "there are undefined variables or methods in expression : " + tree.Content); return(tree[0].Membre); } tree.Parcure(tree.Parent, (MethodInfo)scop); var m = load.Compile(scop, tree[0]); var n = tree.Count == 3 ? load.Compile(scop, tree[2]) : null; if (tree.Method is CPUMethodInfo) { var e = Qs.Pdb.CPU.CPUType.Call(load, scop, tree.Membre, tree.Method, tree[0].Membre, tree[2].Membre); //TODO :Obsolete load.Caller.Call(scop, tree.Method, m, n, tree.Membre); } else { load.Optimum.PushParam(m); if (n != null) { load.Optimum.PushParam(n); } load.Optimum.Call(tree.Method); } return(tree.Membre); }
public override FieldInfo Compile(LoadClasses load, Scop scop, Tree tree) { if (tree.Method == null) { tree.Method = load.GetMethod(tree[0], tree[1].Children); } if (tree.Method == null) { load.LogIn(scop, tree, this, "Function(" + tree[0].Content + ") Entrer cannot be found"); return(null); } if (tree.Method.ISCPUMethod) { var parm = new List <FieldInfo>(2); foreach (Tree e in tree[1]) { parm.Add(load.Compile(scop, e)); } } foreach (Tree e in tree[1]) { var z = load.Compile(scop, e); load.Optimum.PushParam(z); } load.Optimum.Call(tree.Method); return(tree.Membre = RegInfo.eax); }
public override FieldInfo Compile(LoadClasses load, Scop scop, Tree tree) { var hasElse = tree.Count == 3; AsmLabel debElse = load.Optimum.SetLabel(null, false), finElse = load.Optimum.SetLabel(null, false); var condition = load.Compile(scop, tree[0]); if (condition == null || condition.Return != Assembly.Bool) { load.LogIn(scop, tree, condition, "Condition Value Must be Of Type System.Bool"); } load.Add("test", condition, FieldInfo.Immediate(0)); load.Optimum.SetGoto("jne", debElse); if (tree[1].GeneratedBy != null) { tree[1].GeneratedBy.Compile(load, scop, tree[1]); load.Optimum.SetLabel(debElse); if (!hasElse) { return(null); } load.Optimum.SetGoto("jmp", finElse); tree[2].GeneratedBy.Compile(load, scop, tree[2]); load.Optimum.SetLabel(finElse); } else { load.Optimum.SetLabel(debElse); } return(null); }
public override FieldInfo Compile(LoadClasses load, Scop scop, Tree tree) { var label1 = load.Optimum.SetLabel(null, true); load.Compile(scop, tree[0]); var condition = tree[1].GeneratedBy.Compile(load, scop, tree[1]); if (condition == null || condition.Return != Assembly.Bool) { load.LogIn(scop, tree, tree[1], "Condition Value Must be Of Type System.Bool"); } load.Add("test", condition, FieldInfo.Immediate(0)); load.Optimum.SetGoto("jne", label1); return(RegInfo.eax); }
private bool Initialize(LoadClasses load, Scop scop, Tree tree, out MethodInfo method) { if (tree.Method == null) { load.LogIn(scop, tree, this, "Method Name " + tree[1].Content + " not founded"); method = null; return(false); } method = tree.Method; if (method.Return == null) { method.Return = load.ByteCodeMapper.Finder.GetClass(load.ByteCodeMapper.CurrentScop.Root, tree[0].Content); } if (method.Return == null || !method.Return.Finalized) { throw new BadImageFormatException(); } method.Offset = load.ByteCodeMapper.StreamWriter.Offset; load.ByteCodeMapper.OpenScop(method); return(true); }
public override FieldInfo Compile(LoadClasses load, Scop scop, Tree tree) { AsmLabel label1 = load.Optimum.SetLabel(null, true), label2 = load.Optimum.SetLabel(null, false); var condition = load.Compile(scop, tree[0]); if (condition == null || condition.Return != Assembly.Bool) { load.LogIn(scop, tree, condition, "Condition Value Must be Of Type System.Bool"); } load.Add("test", condition, FieldInfo.Immediate(0)); load.Optimum.SetGoto("jne", label2); var bloc = tree[1]; if (tree.Count == 2 && bloc.GeneratedBy != null) { bloc.GeneratedBy.Compile(load, scop, bloc); } load.Optimum.SetGoto("jmp", label1); load.Optimum.SetLabel(label2); return(RegInfo.eax); }