Class: Minjs::ECMA262::MultiLineComment

Inherits:
Literal show all
Defined in:
lib/minjs/ecma262/lit.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Literal

#priority, #to_exp?

Methods inherited from Base

#concat, #deep_dup, #replace, #to_s

Constructor Details

#initialize(comment, has_lf) ⇒ MultiLineComment

Returns a new instance of MultiLineComment.



569
570
571
572
# File 'lib/minjs/ecma262/lit.rb', line 569

def initialize(comment, has_lf)
  @comment = comment
  @has_lf = has_lf
end

Instance Attribute Details

#commentObject (readonly)

Returns the value of attribute comment.



567
568
569
# File 'lib/minjs/ecma262/lit.rb', line 567

def comment
  @comment
end

#has_lfObject (readonly)

Returns the value of attribute has_lf.



567
568
569
# File 'lib/minjs/ecma262/lit.rb', line 567

def has_lf
  @has_lf
end

Instance Method Details

#==(obj) ⇒ Object



577
578
579
580
581
# File 'lib/minjs/ecma262/lit.rb', line 577

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

#lt?Boolean

Returns:



595
596
597
# File 'lib/minjs/ecma262/lit.rb', line 595

def lt?
  @has_lf ? true : false
end

#to_js(options) ⇒ Object



583
584
585
586
587
588
589
# File 'lib/minjs/ecma262/lit.rb', line 583

def to_js(options)
  if lt?
    "/*#{@comment}*/"
  else
    "/*#{@comment}*/"
  end
end

#traverse(parent, &block) ⇒ Object



574
575
# File 'lib/minjs/ecma262/lit.rb', line 574

def traverse(parent, &block)
end

#ws?Boolean

Returns:



591
592
593
# File 'lib/minjs/ecma262/lit.rb', line 591

def ws?
  !lt?
end