Class: Minjs::ECMA262::StBreak
- Defined in:
- lib/minjs/ecma262/statement.rb
Overview
Base class of ECMA262 BreakStatement element.
Instance Attribute Summary collapse
-
#exp ⇒ Object
readonly
Returns the value of attribute exp.
Attributes inherited from Base
Instance Method Summary collapse
-
#==(obj) ⇒ Object
compare object.
-
#deep_dup ⇒ Object
duplicate object.
-
#initialize(exp = nil) ⇒ StBreak
constructor
A new instance of StBreak.
-
#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 Statement
#empty?, #priority, #to_exp?, #to_return?
Methods inherited from Base
#add_remove_paren, #concat, #replace
Constructor Details
#initialize(exp = nil) ⇒ StBreak
Returns a new instance of StBreak.
1050 1051 1052 |
# File 'lib/minjs/ecma262/statement.rb', line 1050 def initialize(exp = nil) @exp = exp end |
Instance Attribute Details
#exp ⇒ Object (readonly)
Returns the value of attribute exp.
1048 1049 1050 |
# File 'lib/minjs/ecma262/statement.rb', line 1048 def exp @exp end |
Instance Method Details
#==(obj) ⇒ Object
compare object
1067 1068 1069 1070 |
# File 'lib/minjs/ecma262/statement.rb', line 1067 def ==(obj) self.class == obj.class and @exp == obj.exp end |
#deep_dup ⇒ Object
duplicate object
1056 1057 1058 |
# File 'lib/minjs/ecma262/statement.rb', line 1056 def deep_dup self.class.new(@exp ? @exp.deep_dup : nil) end |
#to_js(options = {}) ⇒ Object
Returns a ECMAScript string containg the representation of element.
1074 1075 1076 1077 1078 1079 1080 |
# File 'lib/minjs/ecma262/statement.rb', line 1074 def to_js( = {}) if @exp concat , :break, @exp, ";" else concat , :break, ";" end end |
#traverse(parent) {|parent, _self| ... } ⇒ Object
Traverses this children and itself with given block.
1061 1062 1063 1064 |
# File 'lib/minjs/ecma262/statement.rb', line 1061 def traverse(parent, &block) @exp.traverse(self, &block) if @exp yield parent, self end |