/* --------------------------------------------------------- *
* __________ D E L T A S C R I P T *
* (_________() *
* / === / - A fast, dynamic scripting language *
* | == | - Version 4.13.11.0 *
* / === / - Developed by Adam R. Nelson *
* | = = | - 2011-2013 *
* / === / - Distributed under GNU LGPL v3 *
* (________() - http://github.com/ar-nelson/deltascript *
* *
* --------------------------------------------------------- */
package com.sector91.delta.script.objects;
import com.sector91.delta.script.DScriptContext;
import com.sector91.delta.script.DScriptErr;
public final class DS_RootScope extends DS_HashedScope
{
private DScriptContext context;
@Override public void setLocal(DS_Tag tag, DS_Object value)
throws DScriptErr
{
throw new DScriptErr("Cannot overwrite the global binding '" +
tag.str + "' in the root scope.");
}
@Override public boolean isRootScope()
{return true;}
@Override public DS_RootScope getRootScope()
{return this;}
public void addGlobalBinding(DS_Tag tag, DS_Object value)
throws DScriptErr
{super.setLocal(tag, value);}
@Override public DScriptContext getContext()
{return context;}
public void setContext(DScriptContext context)
{this.context = context;}
@Override public DS_RootScope clone()
{
DS_RootScope newScope = new DS_RootScope();
for (ScopeEntry n : getEntries())
newScope.addEntryDirectly(n.cloneTo(this, newScope));
return newScope;
}
}