示例#1
0
        internal JukaEnvironment Ancestor(int distance)
        {
            JukaEnvironment environment = this;

            for (int i = 0; i < distance; i++)
            {
                environment = environment.enclosing;
            }

            return(environment);
        }
示例#2
0
        internal void ExecuteBlock(List <Stmt> statements, JukaEnvironment environment)
        {
            JukaEnvironment previous = this.environment;

            try
            {
                this.environment = environment;
                foreach (Stmt statement in statements)
                {
                    Execute(statement);
                }
            }
            finally
            {
                this.environment = previous;
            }
        }
示例#3
0
        internal JukaInterpreter(ServiceProvider services)
        {
            environment          = globals = new JukaEnvironment();
            this.serviceProvider = services;

            if (serviceProvider != null)
            {
#pragma warning disable CS8604 // Possible null reference argument.
                globals.Define("clock", serviceProvider.GetService <ISystemClock>());
                globals.Define("fileOpen", services.GetService <IFileOpen>());
#pragma warning restore CS8604 // Possible null reference argument.
            }
            else
            {
                throw new JRuntimeException("Unable to load system calls");
            }
        }
示例#4
0
 internal JukaFunction(Stmt.Function declaration, JukaEnvironment closure, bool isInitializer)
 {
     this.isInitializer = isInitializer;
     this.declaration   = declaration;
     this.closure       = closure;
 }
示例#5
0
 internal JukaEnvironment(JukaEnvironment enclosing)
 {
     this.enclosing = enclosing;
 }