Class: AdLint::Cc1::TransitionTag

Inherits:
Object
  • Object
show all
Defined in:
lib/adlint/cc1/value.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(by = nil, at = nil) ⇒ TransitionTag

Returns a new instance of TransitionTag.



1924
1925
1926
1927
# File 'lib/adlint/cc1/value.rb', line 1924

def initialize(by = nil, at = nil)
  self.by = by
  self.at = at
end

Instance Attribute Details

#atObject

NOTE: This value is generated in ‘at’ points to branch trees.



1937
1938
1939
# File 'lib/adlint/cc1/value.rb', line 1937

def at
  @at
end

#byObject

NOTE: This value is generated by ‘by’ points to AST nodes.



1930
1931
1932
# File 'lib/adlint/cc1/value.rb', line 1930

def by
  @by
end

Instance Method Details

#merge!(tag) ⇒ Object



1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
# File 'lib/adlint/cc1/value.rb', line 1947

def merge!(tag)
  if tag
    if at == tag.at
      self.by = tag.by + by
      self.at = tag.at + at
    else
      self.by = tag.by
      self.at = tag.at
    end
  end
end

#pretty_print(pp) ⇒ Object



1959
1960
1961
1962
1963
1964
# File 'lib/adlint/cc1/value.rb', line 1959

def pretty_print(pp)
  {
    by: @by.map(&:location),
    at: @at.map { |br| br.ctrlexpr.to_expr }.compact.map(&:location)
  }.pretty_print(pp)
end

#traceable?Boolean

Returns:

  • (Boolean)


1943
1944
1945
# File 'lib/adlint/cc1/value.rb', line 1943

def traceable?
  !@by.empty?
end