using System; using System.Collections.Generic; namespace TLang.VM { public class RootEnvironment : TLangEnvironment { public RootEnvironment() { } public Dictionary AvailableClasses {get;set;}=new Dictionary(); Dictionary items = new Dictionary(); public override TObject GetObject(string key) { if(HasObject(key)) { return items[key]; } return new TUndefined(); } public override bool HasObject(string key) { return items.ContainsKey(key); } public override TLangEnvironment GetParentEnvironment() { return this; } public override RootEnvironment GetRootEnvironment() { return this; } public override void SetObject(string key, TObject value) { items[key] = value; } public override bool HasObjectRecurse(string key) { return HasObject(key); } public override TLangEnvironment GetSubEnvironment() { return new SubEnvironment(this); } } }