52 lines
1.3 KiB
C#
52 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace TLang.VM
|
|
{
|
|
public class RootEnvironment : TLangEnvironment
|
|
{
|
|
public RootEnvironment()
|
|
{
|
|
|
|
}
|
|
public Dictionary<string, LoadedClassData> AvailableClasses {get;set;}=new Dictionary<string, LoadedClassData>();
|
|
|
|
Dictionary<string,TObject> items = new Dictionary<string, TObject>();
|
|
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);
|
|
}
|
|
}
|
|
} |