Class: Minjs::ECMA262::StThrow

Inherits:
Statement show all
Defined in:
lib/minjs/ecma262/statement.rb

Overview

Base class of ECMA262 ThrowStatement element.

See Also:

Instance Attribute Summary collapse

Attributes inherited from Base

#parent

Instance Method Summary collapse

Methods inherited from Statement

#empty?, #priority, #to_exp?, #to_return?

Methods inherited from Base

#add_remove_paren, #concat, #replace

Constructor Details

#initialize(exp) ⇒ StThrow

Returns a new instance of StThrow.



1355
1356
1357
# File 'lib/minjs/ecma262/statement.rb', line 1355

def initialize(exp)
  @exp = exp
end

Instance Attribute Details

#expObject (readonly)

Returns the value of attribute exp.



1353
1354
1355
# File 'lib/minjs/ecma262/statement.rb', line 1353

def exp
  @exp
end

Instance Method Details

#==(obj) ⇒ Object

compare object



1372
1373
1374
1375
# File 'lib/minjs/ecma262/statement.rb', line 1372

def ==(obj)
  self.class == obj.class and
    @exp == obj.exp
end

#deep_dupObject

duplicate object

See Also:



1361
1362
1363
# File 'lib/minjs/ecma262/statement.rb', line 1361

def deep_dup
  self.class.new(@exp.deep_dup)
end

#to_js(options = {}) ⇒ Object

Returns a ECMAScript string containg the representation of element.

See Also:



1379
1380
1381
# File 'lib/minjs/ecma262/statement.rb', line 1379

def to_js(options = {})
  concat options, :throw, @exp, ";"
end

#traverse(parent) {|parent, _self| ... } ⇒ Object

Traverses this children and itself with given block.

Yields:

Yield Parameters:



1366
1367
1368
1369
# File 'lib/minjs/ecma262/statement.rb', line 1366

def traverse(parent, &block)
  @exp.traverse(self, &block)
  yield parent, self
end