Class: Minjs::ECMA262::SingleLineComment

Inherits:
Literal
  • Object
show all
Defined in:
lib/minjs/ecma262/literal.rb

Overview

Class of ECMA262 SingleLineComment Element

See Also:

Instance Attribute Summary

Attributes inherited from Base

#parent

Instance Method Summary collapse

Methods inherited from Literal

#lt?, #priority, #side_effect?

Methods inherited from Base

#add_remove_paren, #concat, #deep_dup, #replace

Constructor Details

#initialize(comment) ⇒ SingleLineComment

Returns a new instance of SingleLineComment.



1099
1100
1101
# File 'lib/minjs/ecma262/literal.rb', line 1099

def initialize(comment)
  @comment = comment
end

Instance Method Details

#==(obj) ⇒ Object

compare object



1110
1111
1112
1113
# File 'lib/minjs/ecma262/literal.rb', line 1110

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

#to_js(options) ⇒ Object

Returns a ECMAScript string containg the representation of element.

See Also:



1117
1118
1119
# File 'lib/minjs/ecma262/literal.rb', line 1117

def to_js(options)
  "//#{@comment}"
end

#traverse(parent, &block) ⇒ Object

Traverses this children and itself with given block.

See Also:



1106
1107
# File 'lib/minjs/ecma262/literal.rb', line 1106

def traverse(parent, &block)
end

#ws?Boolean

true if literal is white space

Returns:



1122
1123
1124
# File 'lib/minjs/ecma262/literal.rb', line 1122

def ws?
  true
end