~tim/scheme-vm

ref: e3ea9b9b3ff5b87f50cb7990ccdc5004a35caddc scheme-vm/compiler/import_binding.rb -rw-r--r-- 623 bytes View raw
e3ea9b9bTim Morgan Refactor import bindings 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class ImportBinding
  def initialize(library_name:, internal_name:, external_name:, syntax: nil)
    @library_name = library_name
    @internal_name = internal_name
    @external_name = external_name
    @syntax = syntax
    @prefix = ''
  end

  attr_reader :library_name, :internal_name, :syntax
  attr_accessor :prefix

  def external_name
    "#{@prefix}#{@external_name}"
  end

  def external_name=(name)
    @prefix = ''
    @external_name = name
  end

  def inspect
    "<ImportBinding library_name=\"#{library_name}\", " \
      "external_name=\"#{external_name}\", internal_name=\"#{internal_name}\">"
  end
end