~tim/scheme-vm

aefea028a5d393f077218af88fb111179a027ff5 — Tim Morgan 3 years ago 42da542
Clarify purpose of this code
2 files changed, 3 insertions(+), 7 deletions(-)

M compiler.rb
M vm/atom.rb
M compiler.rb => compiler.rb +1 -1
@@ 46,7 46,7 @@ class Compiler
  def mangle_identifier(name)
    @mangled_identifiers[name] ||= 0
    version = @mangled_identifiers[name] += 1
    name.sub(/.+/, "##{name}.v#{version}")
    name.mangle(version)
  end

  def built_in_function?(name)

M vm/atom.rb => vm/atom.rb +2 -6
@@ 22,13 22,9 @@ class VM
      to_s
    end

    def copy_and_rename(name)
    def mangle(version)
      name = "##{self}.v#{version}"
      self.class.new(name, filename, offset, line, column)
    end

    def sub(*_args)
      new_name = super
      copy_and_rename(new_name)
    end
  end
end