Class: Minjs::ECMA262::EnvRecord
- Inherits:
-
Object
- Object
- Minjs::ECMA262::EnvRecord
- Defined in:
- lib/minjs/ecma262/env.rb
Overview
class of Environment Record
Direct Known Subclasses
Instance Attribute Summary collapse
-
#binding ⇒ Object
readonly
Returns the value of attribute binding.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#create_mutable_binding(n, d, options = {}) ⇒ Object
CreateMutableBinding(N, D).
-
#initialize(options = {}) ⇒ EnvRecord
constructor
A new instance of EnvRecord.
-
#set_mutable_binding(n, v, s, options = {}) ⇒ Object
SetMutableBinding(N, V, S).
Constructor Details
#initialize(options = {}) ⇒ EnvRecord
Returns a new instance of EnvRecord.
11 12 13 14 |
# File 'lib/minjs/ecma262/env.rb', line 11 def initialize( = {}) @binding = {} @options = {} end |
Instance Attribute Details
#binding ⇒ Object (readonly)
Returns the value of attribute binding.
8 9 10 |
# File 'lib/minjs/ecma262/env.rb', line 8 def binding @binding end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
9 10 11 |
# File 'lib/minjs/ecma262/env.rb', line 9 def @options end |
Instance Method Details
#create_mutable_binding(n, d, options = {}) ⇒ Object
CreateMutableBinding(N, D)
19 20 21 22 23 24 |
# File 'lib/minjs/ecma262/env.rb', line 19 def create_mutable_binding(n, d, = {}) if n.kind_of? IdentifierName n = n.val end @binding[n] = {:value => nil} end |
#set_mutable_binding(n, v, s, options = {}) ⇒ Object
SetMutableBinding(N, V, S)
29 30 31 32 33 34 35 |
# File 'lib/minjs/ecma262/env.rb', line 29 def set_mutable_binding(n, v, s, = {}) if n.kind_of? IdentifierName n = n.val end @binding[n][:value] = v @binding[n].merge!( || {}) end |