class Minjs::ECMA262::EnvRecord

class of Environment Record

@see www.ecma-international.org/ecma-262 ECMA262 10.2.1

Attributes

binding[R]
options[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/minjs/ecma262/env.rb, line 11
def initialize(options = {})
  @binding = {}
  @options = {}
end

Public Instance Methods

create_mutable_binding(n, d, options = {}) click to toggle source

CreateMutableBinding(N, D)

@see www.ecma-international.org/ecma-262 ECMA262 10.2.1

# File lib/minjs/ecma262/env.rb, line 19
def create_mutable_binding(n, d, options = {})
  if n.kind_of? IdentifierName
    n = n.val
  end
  @binding[n] = {:value => nil}
end
set_mutable_binding(n, v, s, options = {}) click to toggle source

SetMutableBinding(N, V, S)

@see www.ecma-international.org/ecma-262 ECMA262 10.2.1

# File lib/minjs/ecma262/env.rb, line 29
def set_mutable_binding(n, v, s, options = {})
  if n.kind_of? IdentifierName
    n = n.val
  end
  @binding[n][:value] = v
  @binding[n].merge!(options || {})
end