Class: Heist::Runtime::FileScope

Inherits:
Scope
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/heist/runtime/scope.rb

Overview

A FileScope is a special kind of Scope used to represent the region of a single file. It provides Scheme code with an awareness of its path so it can load local files. FileScope instances delegate all variable assignments to their parent Scope (this is typically the global scope) so that variables are visible across files.

Instance Attribute Summary

Attributes inherited from Scope

#runtime

Instance Method Summary collapse

Methods inherited from Scope

#[], #[]=, #current_file, #define, #defined?, #each_var, #eval, #expand_path, #innermost_binding, #load, #longest_prefix, #program, #run, #set!, #syntax

Constructor Details

#initialize(parent, path) ⇒ FileScope

Returns a new instance of FileScope.



247
248
249
250
# File 'lib/heist/runtime/scope.rb', line 247

def initialize(parent, path)
  super(parent)
  @path = File.directory?(path) ? path + '/repl.scm' : path
end