Class: AdLint::Cpp::CommaSeparatedExpression

Inherits:
Expression show all
Defined in:
lib/adlint/cpp/syntax.rb

Instance Attribute Summary collapse

Attributes inherited from Expression

#value

Instance Method Summary collapse

Methods inherited from SyntaxNode

#short_class_name

Methods included from LocationHolder

#analysis_target?

Methods included from Visitable

#accept

Constructor Details

#initialize(val) ⇒ CommaSeparatedExpression

Returns a new instance of CommaSeparatedExpression.



912
913
914
915
# File 'lib/adlint/cpp/syntax.rb', line 912

def initialize(val)
  super(val)
  @expressions = []
end

Instance Attribute Details

#expressions=(value) ⇒ Object (writeonly)

Sets the attribute expressions

Parameters:

  • value

    the value to set the attribute expressions to.



917
918
919
# File 'lib/adlint/cpp/syntax.rb', line 917

def expressions=(value)
  @expressions = value
end

Instance Method Details

#inspect(indent = 0) ⇒ Object



932
933
934
935
# File 'lib/adlint/cpp/syntax.rb', line 932

def inspect(indent = 0)
  ([" " * indent + short_class_name] +
   @expressions.map { |expr| expr.inspect(indent + 1) }).join("\n")
end

#locationObject



919
920
921
# File 'lib/adlint/cpp/syntax.rb', line 919

def location
  @expressions.first.location
end

#push(expression) ⇒ Object



927
928
929
930
# File 'lib/adlint/cpp/syntax.rb', line 927

def push(expression)
  @expressions.push(expression)
  self
end

#to_sObject



923
924
925
# File 'lib/adlint/cpp/syntax.rb', line 923

def to_s
  @expressions.map { |expr| expr.to_s }.join(",")
end