class AdLint::Cc1::CompositeValue
Attributes
values[R]
Public Class Methods
new(vals)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1390 def initialize(vals) @values = vals end
Public Instance Methods
!()
click to toggle source
# File lib/adlint/cc1/value.rb, line 1574 def ! # NOTE: A composite variable cannot appear in expressions except the # primary-expression(object-specifier followed by `.'). scalar_value_of_false # NOTREACHED end
!=(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1634 def !=(rhs_val) # NOTE: A composite variable cannot appear in expressions except the # primary-expression(object-specifier followed by `.'). case rhs_sval = rhs_val.to_single_value when CompositeValue if @values.size == rhs_sval.values.size zipped = @values.zip(rhs_sval.values) zipped.reduce(scalar_value_of_nil) do |rslt_val, (lhs, rhs)| rslt_val.single_value_unified_with(lhs != rhs) end else scalar_value_of_false end else raise TypeError, "comparison between composite and non-composite." end end
%(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1538 def %(rhs_val) # NOTE: A composite variable cannot appear in expressions except the # primary-expression(object-specifier followed by `.'). dup # NOTREACHED end
&(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1544 def &(rhs_val) # NOTE: A composite variable cannot appear in expressions except the # primary-expression(object-specifier followed by `.'). dup # NOTREACHED end
*(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1526 def *(rhs_val) # NOTE: A composite variable cannot appear in expressions except the # primary-expression(object-specifier followed by `.'). dup # NOTREACHED end
+(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1514 def +(rhs_val) # NOTE: A composite variable cannot appear in expressions except the # primary-expression(object-specifier followed by `.'). dup # NOTREACHED end
+@()
click to toggle source
# File lib/adlint/cc1/value.rb, line 1502 def +@ # NOTE: A composite variable cannot appear in expressions except the # primary-expression(object-specifier followed by `.'). dup # NOTREACHED end
-(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1520 def -(rhs_val) # NOTE: A composite variable cannot appear in expressions except the # primary-expression(object-specifier followed by `.'). dup # NOTREACHED end
-@()
click to toggle source
# File lib/adlint/cc1/value.rb, line 1508 def -@ # NOTE: A composite variable cannot appear in expressions except the # primary-expression(object-specifier followed by `.'). dup # NOTREACHED end
/(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1532 def /(rhs_val) # NOTE: A composite variable cannot appear in expressions except the # primary-expression(object-specifier followed by `.'). dup # NOTREACHED end
<(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1580 def <(rhs_val) # NOTE: A composite variable cannot appear in expressions except the # primary-expression(object-specifier followed by `.'). case rhs_sval = rhs_val.to_single_value when CompositeValue if @values.size == rhs_sval.values.size zipped = @values.zip(rhs_sval.values) zipped.reduce(scalar_value_of_nil) do |rslt_val, (lhs, rhs)| rslt_val.single_value_unified_with(lhs < rhs) end else scalar_value_of_false end else raise TypeError, "comparison between composite and non-composite." end end
<<(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1562 def <<(rhs_val) # NOTE: A composite variable cannot appear in expressions except the # primary-expression(object-specifier followed by `.'). dup # NOTREACHED end
<=(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1652 def <=(rhs_val) # NOTE: A composite variable cannot appear in expressions except the # primary-expression(object-specifier followed by `.'). case rhs_sval = rhs_val.to_single_value when CompositeValue if @values.size == rhs_sval.values.size zipped = @values.zip(rhs_sval.values) zipped.reduce(scalar_value_of_nil) do |rslt_val, (lhs, rhs)| rslt_val.single_value_unified_with(lhs <= rhs) end else scalar_value_of_false end else raise TypeError, "comparison between composite and non-composite." end end
==(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1616 def ==(rhs_val) # NOTE: A composite variable cannot appear in expressions except the # primary-expression(object-specifier followed by `.'). case rhs_sval = rhs_val.to_single_value when CompositeValue if @values.size == rhs_sval.values.size zipped = @values.zip(rhs_sval.values) zipped.reduce(scalar_value_of_nil) do |rslt_val, (lhs, rhs)| rslt_val.single_value_unified_with(lhs == rhs) end else scalar_value_of_false end else raise TypeError, "comparison between composite and non-composite." end end
>(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1598 def >(rhs_val) # NOTE: A composite variable cannot appear in expressions except the # primary-expression(object-specifier followed by `.'). case rhs_sval = rhs_val.to_single_value when CompositeValue if @values.size == rhs_sval.values.size zipped = @values.zip(rhs_sval.values) zipped.reduce(scalar_value_of_nil) do |rslt_val, (lhs, rhs)| rslt_val.single_value_unified_with(lhs > rhs) end else scalar_value_of_false end else raise TypeError, "comparison between composite and non-composite." end end
>=(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1670 def >=(rhs_val) # NOTE: A composite variable cannot appear in expressions except the # primary-expression(object-specifier followed by `.'). case rhs_sval = rhs_val.to_single_value when CompositeValue if @values.size == rhs_sval.values.size zipped = @values.zip(rhs_sval.values) zipped.reduce(scalar_value_of_nil) do |rslt_val, (lhs, rhs)| rslt_val.single_value_unified_with(lhs >= rhs) end else scalar_value_of_false end else raise TypeError, "comparison between composite and non-composite." end end
>>(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1568 def >>(rhs_val) # NOTE: A composite variable cannot appear in expressions except the # primary-expression(object-specifier followed by `.'). dup # NOTREACHED end
^(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1556 def ^(rhs_val) # NOTE: A composite variable cannot appear in expressions except the # primary-expression(object-specifier followed by `.'). dup # NOTREACHED end
ambiguous?()
click to toggle source
# File lib/adlint/cc1/value.rb, line 1433 def ambiguous? @values.empty? ? false : @values.all? { |val| val.ambiguous? } end
array?()
click to toggle source
# File lib/adlint/cc1/value.rb, line 1400 def array? false end
coerce_to(type)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1829 def coerce_to(type) type.coerce_composite_value(self) end
composite?()
click to toggle source
# File lib/adlint/cc1/value.rb, line 1404 def composite? true end
contain?(val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1416 def contain?(val) case sval = val.to_single_value when CompositeValue if @values.size == sval.values.size @values.zip(sval.values).all? { |lhs, rhs| lhs.contain?(rhs) } else false end else false end end
definite?()
click to toggle source
# File lib/adlint/cc1/value.rb, line 1412 def definite? @values.empty? ? true : @values.all? { |val| val.definite? } end
dup()
click to toggle source
# File lib/adlint/cc1/value.rb, line 1850 def dup CompositeValue.new(@values.map { |val| val.dup }) end
eql?(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1842 def eql?(rhs_val) rhs_val.kind_of?(CompositeValue) && @values.eql?(rhs_val.values) end
exist?()
click to toggle source
# File lib/adlint/cc1/value.rb, line 1408 def exist? @values.empty? ? true : @values.all? { |val| val.exist? } end
hash()
click to toggle source
# File lib/adlint/cc1/value.rb, line 1846 def hash @values.hash end
invert_domain!()
click to toggle source
# File lib/adlint/cc1/value.rb, line 1480 def invert_domain! @values.each { |val| val.invert_domain! } end
logical_and(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1688 def logical_and(rhs_val) # NOTE: A composite variable cannot appear in expressions except the # primary-expression(object-specifier followed by `.'). case rhs_sval = rhs_val.to_single_value when CompositeValue if @values.size == rhs_sval.values.size zipped = @values.zip(rhs_sval.values) zipped.reduce(scalar_value_of_nil) do |rslt_val, (lhs, rhs)| rslt_val.single_value_unified_with(lhs.logical_and(rhs)) end else scalar_value_of_false end else raise TypeError, "comparison between composite and non-composite." end end
logical_or(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1706 def logical_or(rhs_val) # NOTE: A composite variable cannot appear in expressions except the # primary-expression(object-specifier followed by `.'). case rhs_sval = rhs_val.to_single_value when CompositeValue if @values.size == rhs_sval.values.size zipped = @values.zip(rhs_sval.values) zipped.reduce(scalar_value_of_nil) do |rslt_val, (lhs, rhs)| rslt_val.single_value_unified_with(lhs.logical_or(rhs)) end else scalar_value_of_false end else raise TypeError, "comparison between composite and non-composite." end end
narrow_domain!(op, ope_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1448 def narrow_domain!(op, ope_val) case ope_sval = ope_val.to_single_value when CompositeValue @values.zip(ope_sval.values).each do |lhs, rhs| if rhs lhs.narrow_domain!(op, rhs) else next end end else raise TypeError, "cannot narrow composite value domain with non-composite." end end
overwrite!(val, tag)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1437 def overwrite!(val, tag) case sval = val.to_single_value when CompositeValue @values.zip(sval.values).each do |lhs, rhs| rhs && lhs.overwrite!(rhs, tag) end else raise TypeError, "cannot overwrite composite with non-composite." end end
scalar?()
click to toggle source
# File lib/adlint/cc1/value.rb, line 1396 def scalar? false end
single_value_unified_with(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1484 def single_value_unified_with(rhs_val) case rhs_sval = rhs_val.to_single_value when CompositeValue CompositeValue.new( @values.zip(rhs_sval.values).map { |lhs, rhs| lhs.single_value_unified_with(rhs) }) else raise TypeError, "cannot unify composite value with non-composite." end end
test_may_be_equal_to(val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1733 def test_may_be_equal_to(val) case sval = val.to_single_value when CompositeValue TrivialValueTest.new((self == sval).test_may_be_true.result) else raise TypeError, "comparison between composite and non-composite." end end
test_may_be_false()
click to toggle source
# File lib/adlint/cc1/value.rb, line 1823 def test_may_be_false # NOTE: A composite variable cannot appear in expressions except the # primary-expression(object-specifier followed by `.'). TrivialValueTest.new(@values.all? { |val| val.test_may_be_false.result }) end
test_may_be_greater_than(val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1787 def test_may_be_greater_than(val) case sval = val.to_single_value when CompositeValue TrivialValueTest.new((self > sval).test_may_be_true.result) else raise TypeError, "comparison between composite and non-composite." end end
test_may_be_less_than(val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1769 def test_may_be_less_than(val) case sval = val.to_single_value when CompositeValue TrivialValueTest.new((self < sval).test_may_be_true.result) else raise TypeError, "comparison between composite and non-composite." end end
test_may_be_null()
click to toggle source
# File lib/adlint/cc1/value.rb, line 1800 def test_may_be_null TrivialValueTest.new(@values.all? { |val| val.test_may_be_null.result }) end
test_may_be_true()
click to toggle source
# File lib/adlint/cc1/value.rb, line 1810 def test_may_be_true # NOTE: A composite variable cannot appear in expressions except the # primary-expression(object-specifier followed by `.'). TrivialValueTest.new(@values.all? { |val| val.test_may_be_true.result }) end
test_may_not_be_equal_to(val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1751 def test_may_not_be_equal_to(val) case sval = val.to_single_value when CompositeValue TrivialValueTest.new((self != sval).test_may_be_true.result) else raise TypeError, "comparison between composite and non-composite." end end
test_must_be_equal_to(val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1724 def test_must_be_equal_to(val) case sval = val.to_single_value when CompositeValue TrivialValueTest.new((self == sval).test_must_be_true.result) else raise TypeError, "comparison between composite and non-composite." end end
test_must_be_false()
click to toggle source
# File lib/adlint/cc1/value.rb, line 1816 def test_must_be_false # NOTE: A composite variable cannot appear in expressions except the # primary-expression(object-specifier followed by `.'). TrivialValueTest.new( @values.all? { |val| val.test_must_be_false.result }) end
test_must_be_greater_than(val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1778 def test_must_be_greater_than(val) case sval = val.to_single_value when CompositeValue TrivialValueTest.new((self > sval).test_must_be_true.result) else raise TypeError, "comparison between composite and non-composite." end end
test_must_be_less_than(val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1760 def test_must_be_less_than(val) case sval = val.to_single_value when CompositeValue TrivialValueTest.new((self < sval).test_must_be_true.result) else raise TypeError, "comparison between composite and non-composite." end end
test_must_be_null()
click to toggle source
# File lib/adlint/cc1/value.rb, line 1796 def test_must_be_null TrivialValueTest.new(@values.all? { |val| val.test_must_be_null.result }) end
test_must_be_true()
click to toggle source
# File lib/adlint/cc1/value.rb, line 1804 def test_must_be_true # NOTE: A composite variable cannot appear in expressions except the # primary-expression(object-specifier followed by `.'). TrivialValueTest.new(@values.all? { |val| val.test_must_be_true.result }) end
test_must_not_be_equal_to(val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1742 def test_must_not_be_equal_to(val) case sval = val.to_single_value when CompositeValue TrivialValueTest.new((self != sval).test_must_be_true.result) else raise TypeError, "comparison between composite and non-composite." end end
to_defined_value()
click to toggle source
# File lib/adlint/cc1/value.rb, line 1838 def to_defined_value CompositeValue.new(@values.map { |val| val.to_defined_value }) end
to_enum()
click to toggle source
# File lib/adlint/cc1/value.rb, line 1833 def to_enum # FIXME: This method generates only one of sample values. @values.map { |val| val.to_enum.first } end
undefined?()
click to toggle source
# File lib/adlint/cc1/value.rb, line 1429 def undefined? @values.empty? ? false : @values.all? { |val| val.undefined? } end
widen_domain!(op, ope_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1464 def widen_domain!(op, ope_val) case ope_sval = ope_val.to_single_value when CompositeValue @values.zip(ope_sval.values).each do |lhs, rhs| if rhs lhs.widen_domain!(op, rhs) else next end end else raise TypeError, "cannot widen composite value domain with non-composite." end end
|(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1550 def |(rhs_val) # NOTE: A composite variable cannot appear in expressions except the # primary-expression(object-specifier followed by `.'). dup # NOTREACHED end
~()
click to toggle source
# File lib/adlint/cc1/value.rb, line 1496 def ~ # NOTE: A composite variable cannot appear in expressions except the # primary-expression(object-specifier followed by `.'). dup # NOTREACHED end
Private Instance Methods
logical_shr?()
click to toggle source
# File lib/adlint/cc1/value.rb, line 1855 def logical_shr? @values.all? { |val| val.logical_shr? } end