public StaticMethodVariabel(MethodContainer m, ClassVariabel c, VariabelDatabase extra) : base(null, null, extra) { method = m; this.c = c; this.extra = extra; }
public ObjectVariabel(ClassVariabel c, Dictionary<string, PointerContainer> pointer, Dictionary<string, MethodContainer> Method, VariabelDatabase extra, ArrayList Extends) { owner = c; Items = new ClassItemContainer[pointer.Count + Method.Count]; int i = 0; foreach(PointerContainer p in pointer.Values) { Items[i] = new ClassItemContainer() { Name = p.Name, Context = p.DefaultValue, IsPointer = true, Level = p.Level, }; i++; } foreach(MethodContainer m in Method.Values) { Items[i] = new ClassItemContainer() { Name = m.Name, Context = new MethodVariabel(m, this, extra), IsPointer = false, Level = m.Level, }; i++; } AppendExtends(extra); }
public ArrayVariabel(EnegyData data, VariabelDatabase db, Posision pos) : base(new ClassVariabel(new Class()), new Dictionary<string, PointerContainer>(), new Dictionary<string, MethodContainer>(), null, new System.Collections.ArrayList()) { Class c = new Class("array"); Method length = new Method("length"); length.SetBody(Length_caller); c.SetMethod(length, data, db, pos); Method hasValue = new Method("hasValue"); hasValue.GetAgumentStack().push("context"); hasValue.SetBody(HasValue_caller); c.SetMethod(hasValue, data, db, pos); Method hasKey = new Method("hasKey"); hasKey.GetAgumentStack().push("string", "context"); hasKey.SetBody(HasKey_caller); c.SetMethod(hasKey, data, db, pos); Method removeKey = new Method("removeKey"); removeKey.GetAgumentStack().push("string", "key"); removeKey.SetBody(RemoveKey_caller); c.SetMethod(removeKey, data, db, pos); Method removeValue = new Method("removeValue"); removeValue.GetAgumentStack().push("value"); removeValue.SetBody(RemoveValue_caller); c.SetMethod(removeValue, data, db, pos); ClassVariabel i = new ClassVariabel(c); ObjectVariabel o = i.createNew(db, data, new CVar[0], pos); Items = o.Items; }
public static bool instanceof(ClassVariabel c, ObjectVariabel obj) { if (c.Name == obj.Name) return true;//direct control is success :) foreach (ClassVariabel extends in obj.GetExtends) { if (c.Name == extends.Name) return true; } return false; }
public void Extends(ClassVariabel extends) { container.Extends.Add(extends); }
public VariabelDatabase(Dictionary<string, CVar> global, ArrayList types, ClassVariabel c) { this.global = global; this.types = types; C = c; }
public VariabelDatabase createShadow(ClassVariabel obj) { return new VariabelDatabase(global, types, obj); }
public CVar call(ClassVariabel c, VariabelDatabase db, CVar[] stack, EnegyData data, Posision pos) { Interprenter.parse(new TokenCache(Body, data, db), data, db); return data.getReturn(); }