class AdLint::Cc1::ArrayValue
Attributes
values[R]
Public Class Methods
new(vals)
click to toggle source
# File lib/adlint/cc1/value.rb, line 883 def initialize(vals) @values = vals end
Public Instance Methods
!()
click to toggle source
# File lib/adlint/cc1/value.rb, line 1077 def ! # NOTE: When an array variable appears in expressions, object-specifier # of an array variable should be evaluated into a pointer to the # array body. scalar_value_of_false # NOTREACHED end
!=(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1144 def !=(rhs_val) # NOTE: When an array variable appears in expressions, object-specifier # of an array variable should be evaluated into a pointer to the # array body. # So, this comparison operator should not be reached. case rhs_sval = rhs_val.to_single_value when ArrayValue 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 array and non-array." end end
%(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1035 def %(rhs_val) # NOTE: When an array variable appears in expressions, object-specifier # of an array variable should be evaluated into a pointer to the # array body. dup # NOTREACHED end
&(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1042 def &(rhs_val) # NOTE: When an array variable appears in expressions, object-specifier # of an array variable should be evaluated into a pointer to the # array body. dup # NOTREACHED end
*(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1021 def *(rhs_val) # NOTE: When an array variable appears in expressions, object-specifier # of an array variable should be evaluated into a pointer to the # array body. dup # NOTREACHED end
+(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1007 def +(rhs_val) # NOTE: When an array variable appears in expressions, object-specifier # of an array variable should be evaluated into a pointer to the # array body. dup # NOTREACHED end
+@()
click to toggle source
# File lib/adlint/cc1/value.rb, line 993 def +@ # NOTE: When an array variable appears in expressions, object-specifier # of an array variable should be evaluated into a pointer to the # array body. dup # NOTREACHED end
-(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1014 def -(rhs_val) # NOTE: When an array variable appears in expressions, object-specifier # of an array variable should be evaluated into a pointer to the # array body. dup # NOTREACHED end
-@()
click to toggle source
# File lib/adlint/cc1/value.rb, line 1000 def -@ # NOTE: When an array variable appears in expressions, object-specifier # of an array variable should be evaluated into a pointer to the # array body. dup # NOTREACHED end
/(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1028 def /(rhs_val) # NOTE: When an array variable appears in expressions, object-specifier # of an array variable should be evaluated into a pointer to the # array body. dup # NOTREACHED end
<(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1084 def <(rhs_val) # NOTE: When an array variable appears in expressions, object-specifier # of an array variable should be evaluated into a pointer to the # array body. # So, this comparison operator should not be reached. case rhs_sval = rhs_val.to_single_value when ArrayValue 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 array and non-array." end end
<<(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1063 def <<(rhs_val) # NOTE: When an array variable appears in expressions, object-specifier # of an array variable should be evaluated into a pointer to the # array body. dup # NOTREACHED end
<=(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1164 def <=(rhs_val) # NOTE: When an array variable appears in expressions, object-specifier # of an array variable should be evaluated into a pointer to the # array body. # So, this comparison operator should not be reached. case rhs_sval = rhs_val.to_single_value when ArrayValue 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 array and non-array." end end
==(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1124 def ==(rhs_val) # NOTE: When an array variable appears in expressions, object-specifier # of an array variable should be evaluated into a pointer to the # array body. # So, this comparison operator should not be reached. case rhs_sval = rhs_val.to_single_value when ArrayValue 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 array and non-array." end end
>(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1104 def >(rhs_val) # NOTE: When an array variable appears in expressions, object-specifier # of an array variable should be evaluated into a pointer to the # array body. # So, this comparison operator should not be reached. case rhs_sval = rhs_val.to_single_value when ArrayValue 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 array and non-array." end end
>=(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1184 def >=(rhs_val) # NOTE: When an array variable appears in expressions, object-specifier # of an array variable should be evaluated into a pointer to the # array body. # So, this comparison operator should not be reached. case rhs_sval = rhs_val.to_single_value when ArrayValue 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 array and non-array." end end
>>(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1070 def >>(rhs_val) # NOTE: When an array variable appears in expressions, object-specifier # of an array variable should be evaluated into a pointer to the # array body. dup # NOTREACHED end
^(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1056 def ^(rhs_val) # NOTE: When an array variable appears in expressions, object-specifier # of an array variable should be evaluated into a pointer to the # array body. dup # NOTREACHED end
ambiguous?()
click to toggle source
# File lib/adlint/cc1/value.rb, line 926 def ambiguous? @values.empty? ? false : @values.all? { |val| val.ambiguous? } end
array?()
click to toggle source
# File lib/adlint/cc1/value.rb, line 893 def array? true end
coerce_to(type)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1357 def coerce_to(type) type.coerce_array_value(self) end
composite?()
click to toggle source
# File lib/adlint/cc1/value.rb, line 897 def composite? false end
contain?(val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 909 def contain?(val) case sval = val.to_single_value when ArrayValue 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 905 def definite? @values.empty? ? true : @values.all? { |val| val.definite? } end
dup()
click to toggle source
# File lib/adlint/cc1/value.rb, line 1378 def dup ArrayValue.new(@values.map { |val| val.dup }) end
eql?(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1370 def eql?(rhs_val) rhs_val.kind_of?(ArrayValue) && @values.eql?(rhs_val.values) end
exist?()
click to toggle source
# File lib/adlint/cc1/value.rb, line 901 def exist? @values.empty? ? true : @values.all? { |val| val.exist? } end
hash()
click to toggle source
# File lib/adlint/cc1/value.rb, line 1374 def hash @values.hash end
invert_domain!()
click to toggle source
# File lib/adlint/cc1/value.rb, line 971 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 1204 def logical_and(rhs_val) # NOTE: When an array variable appears in expressions, object-specifier # of an array variable should be evaluated into a pointer to the # array body. # So, this comparison operator should not be reached. case rhs_sval = rhs_val.to_single_value when ArrayValue 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 array and non-array." end end
logical_or(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1224 def logical_or(rhs_val) # NOTE: When an array variable appears in expressions, object-specifier # of an array variable should be evaluated into a pointer to the # array body. # So, this comparison operator should not be reached. case rhs_sval = rhs_val.to_single_value when ArrayValue 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 array and non-array." end end
narrow_domain!(op, ope_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 941 def narrow_domain!(op, ope_val) case ope_sval = ope_val.to_single_value when ArrayValue @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 array value domain with non-array." end end
overwrite!(val, tag)
click to toggle source
# File lib/adlint/cc1/value.rb, line 930 def overwrite!(val, tag) case sval = val.to_single_value when ArrayValue @values.zip(sval.values).each do |lhs, rhs| rhs && lhs.overwrite!(rhs, tag) end else raise TypeError, "cannot overwrite array with non-array." end end
scalar?()
click to toggle source
# File lib/adlint/cc1/value.rb, line 889 def scalar? false end
single_value_unified_with(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 975 def single_value_unified_with(rhs_val) case rhs_sval = rhs_val.to_single_value when ArrayValue ArrayValue.new(@values.zip(rhs_sval.values).map { |lhs, rhs| lhs.single_value_unified_with(rhs) }) else raise TypeError, "cannot unify array value with non-array." end end
test_may_be_equal_to(val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1253 def test_may_be_equal_to(val) case sval = val.to_single_value when ArrayValue TrivialValueTest.new((self == sval).test_may_be_true.result) else raise TypeError, "comparison between array and non-array." end end
test_may_be_false()
click to toggle source
# File lib/adlint/cc1/value.rb, line 1349 def test_may_be_false # NOTE: When an array variable appears in expressions, object-specifier # of an array variable should be evaluated into a pointer to the # array body. # So, this method should not be reached. 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 1307 def test_may_be_greater_than(val) case sval = val.to_single_value when ArrayValue TrivialValueTest.new((self > sval).test_may_be_true.result) else raise TypeError, "comparison between array and non-array." end end
test_may_be_less_than(val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1289 def test_may_be_less_than(val) case sval = val.to_single_value when ArrayValue TrivialValueTest.new((self < sval).test_may_be_true.result) else raise TypeError, "comparison between array and non-array." end end
test_may_be_null()
click to toggle source
# File lib/adlint/cc1/value.rb, line 1320 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 1332 def test_may_be_true # NOTE: When an array variable appears in expressions, object-specifier # of an array variable should be evaluated into a pointer to the # array body. # So, this method should not be reached. 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 1271 def test_may_not_be_equal_to(val) case sval = val.to_single_value when ArrayValue TrivialValueTest.new((self != sval).test_may_be_true.result) else raise TypeError, "comparison between array and non-array." end end
test_must_be_equal_to(val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1244 def test_must_be_equal_to(val) case sval = val.to_single_value when ArrayValue TrivialValueTest.new((self == sval).test_must_be_true.result) else raise TypeError, "comparison between array and non-array." end end
test_must_be_false()
click to toggle source
# File lib/adlint/cc1/value.rb, line 1340 def test_must_be_false # NOTE: When an array variable appears in expressions, object-specifier # of an array variable should be evaluated into a pointer to the # array body. # So, this method should not be reached. 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 1298 def test_must_be_greater_than(val) case sval = val.to_single_value when ArrayValue TrivialValueTest.new((self > sval).test_must_be_true.result) else raise TypeError, "comparison between array and non-array." end end
test_must_be_less_than(val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1280 def test_must_be_less_than(val) case sval = value.to_single_value when ArrayValue TrivialValueTest.new((self < sval).test_must_be_true.result) else raise TypeError, "comparison between array and non-array." end end
test_must_be_null()
click to toggle source
# File lib/adlint/cc1/value.rb, line 1316 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 1324 def test_must_be_true # NOTE: When an array variable appears in expressions, object-specifier # of an array variable should be evaluated into a pointer to the # array body. # So, this method should not be reached. 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 1262 def test_must_not_be_equal_to(val) case sval = val.to_single_value when ArrayValue TrivialValueTest.new((self != sval).test_must_be_true.result) else raise TypeError, "comparison between array and non-array." end end
to_defined_value()
click to toggle source
# File lib/adlint/cc1/value.rb, line 1366 def to_defined_value ArrayValue.new(@values.map { |val| val.to_defined_value }) end
to_enum()
click to toggle source
# File lib/adlint/cc1/value.rb, line 1361 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 922 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 956 def widen_domain!(op, ope_val) case ope_sval = ope_val.to_single_value when ArrayValue @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 array value domain with non-array." end end
|(rhs_val)
click to toggle source
# File lib/adlint/cc1/value.rb, line 1049 def |(rhs_val) # NOTE: When an array variable appears in expressions, object-specifier # of an array variable should be evaluated into a pointer to the # array body. dup # NOTREACHED end
~()
click to toggle source
# File lib/adlint/cc1/value.rb, line 986 def ~ # NOTE: When an array variable appears in expressions, object-specifier # of an array variable should be evaluated into a pointer to the # array body. dup # NOTREACHED end
Private Instance Methods
logical_shr?()
click to toggle source
# File lib/adlint/cc1/value.rb, line 1383 def logical_shr? @values.all? { |val| val.logical_shr? } end