Class: Minjs::ECMA262::StContinue

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

Overview

Base class of ECMA262 ContinueStatement 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 = nil) ⇒ StContinue

Returns a new instance of StContinue.



1011
1012
1013
# File 'lib/minjs/ecma262/statement.rb', line 1011

def initialize(exp = nil)
  @exp = exp
end

Instance Attribute Details

#expObject (readonly)

Returns the value of attribute exp.



1009
1010
1011
# File 'lib/minjs/ecma262/statement.rb', line 1009

def exp
  @exp
end

Instance Method Details

#==(obj) ⇒ Object

compare object



1028
1029
1030
1031
# File 'lib/minjs/ecma262/statement.rb', line 1028

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

#deep_dupObject

duplicate object

See Also:



1017
1018
1019
# File 'lib/minjs/ecma262/statement.rb', line 1017

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.

See Also:



1035
1036
1037
1038
1039
1040
1041
# File 'lib/minjs/ecma262/statement.rb', line 1035

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

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

Traverses this children and itself with given block.

Yields:

Yield Parameters:



1022
1023
1024
1025
# File 'lib/minjs/ecma262/statement.rb', line 1022

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