Class: Minjs::ECMA262::Prog
Overview
Class of ECMA262 Program
Instance Attribute Summary collapse
-
#exe_context ⇒ Object
Returns the value of attribute exe_context.
-
#source_elements ⇒ Object
readonly
Returns the value of attribute source_elements.
-
#var_env ⇒ Object
readonly
Returns the value of attribute var_env.
Attributes inherited from Base
Instance Method Summary collapse
-
#==(obj) ⇒ Object
compare object.
-
#deep_dup ⇒ Object
duplicate object.
-
#initialize(var_env, source_elements) ⇒ Prog
constructor
A new instance of Prog.
-
#replace(from, to) ⇒ Object
Replaces children object.
-
#to_js(options = {}) ⇒ Object
Returns a ECMAScript string containg the representation of element.
-
#traverse(parent) {|parent, _self| ... } ⇒ Object
Traverses this children and itself with given block.
Methods inherited from Base
Constructor Details
#initialize(var_env, source_elements) ⇒ Prog
Returns a new instance of Prog.
324 325 326 327 |
# File 'lib/minjs/ecma262/base.rb', line 324 def initialize(var_env, source_elements) @source_elements = source_elements @var_env = var_env end |
Instance Attribute Details
#exe_context ⇒ Object
Returns the value of attribute exe_context.
322 323 324 |
# File 'lib/minjs/ecma262/base.rb', line 322 def exe_context @exe_context end |
#source_elements ⇒ Object (readonly)
Returns the value of attribute source_elements.
320 321 322 |
# File 'lib/minjs/ecma262/base.rb', line 320 def source_elements @source_elements end |
#var_env ⇒ Object (readonly)
Returns the value of attribute var_env.
321 322 323 |
# File 'lib/minjs/ecma262/base.rb', line 321 def var_env @var_env end |
Instance Method Details
#==(obj) ⇒ Object
compare object
351 352 353 |
# File 'lib/minjs/ecma262/base.rb', line 351 def ==(obj) self.class == obj.class and self.source_elements == obj.source_elements end |
#deep_dup ⇒ Object
duplicate object
331 332 333 |
# File 'lib/minjs/ecma262/base.rb', line 331 def deep_dup self.class.new(var_env, source_elements.deep_dup) end |
#replace(from, to) ⇒ Object
Replaces children object
337 338 339 340 341 |
# File 'lib/minjs/ecma262/base.rb', line 337 def replace(from, to) if from == @source_elements @source_elements = to end end |
#to_js(options = {}) ⇒ Object
Returns a ECMAScript string containg the representation of element.
357 358 359 |
# File 'lib/minjs/ecma262/base.rb', line 357 def to_js( = {}) concat , @source_elements end |
#traverse(parent) {|parent, _self| ... } ⇒ Object
Traverses this children and itself with given block.
345 346 347 348 |
# File 'lib/minjs/ecma262/base.rb', line 345 def traverse(parent, &block) @source_elements.traverse(self, &block) yield parent, self end |