Module: AdLint::Cc1::ScalarValueFactory
- Included in:
- ScalarValue
- Defined in:
- lib/adlint/cc1/value.rb
Instance Method Summary collapse
- #not_of(numeric_or_range, logical_shr) ⇒ Object
- #of(numeric_or_range, logical_shr) ⇒ Object
- #of_arbitrary(logical_shr) ⇒ Object
- #of_false(logical_shr) ⇒ Object
- #of_nan(logical_shr) ⇒ Object
- #of_nil(logical_shr) ⇒ Object
- #of_null(logical_shr) ⇒ Object
- #of_true(logical_shr) ⇒ Object
- #of_undefined(range, logical_shr) ⇒ Object
Instance Method Details
#not_of(numeric_or_range, logical_shr) ⇒ Object
419 420 421 422 423 424 425 426 427 428 429 430 431 432 |
# File 'lib/adlint/cc1/value.rb', line 419 def not_of(numeric_or_range, logical_shr) case numeric_or_range when Numeric new(ValueDomain.not_equal_to(numeric_or_range, logical_shr)) when Range new(ValueDomain.less_than( numeric_or_range.first, logical_shr ).union(ValueDomain.greater_than( numeric_or_range.last, logical_shr ))) else raise TypeError, "argument must be a Numeric or a Range." end end |
#of(numeric_or_range, logical_shr) ⇒ Object
404 405 406 407 408 409 410 411 412 413 414 415 416 417 |
# File 'lib/adlint/cc1/value.rb', line 404 def of(numeric_or_range, logical_shr) case numeric_or_range when Numeric new(ValueDomain.equal_to(numeric_or_range, logical_shr)) when Range new(ValueDomain.greater_than_or_equal_to( numeric_or_range.first, logical_shr ).intersection(ValueDomain.less_than_or_equal_to( numeric_or_range.last, logical_shr ))) else raise TypeError, "argument must be a Numeric or a Range." end end |
#of_arbitrary(logical_shr) ⇒ Object
448 449 450 |
# File 'lib/adlint/cc1/value.rb', line 448 def of_arbitrary(logical_shr) new(ValueDomain.of_unlimited(logical_shr)) end |
#of_false(logical_shr) ⇒ Object
438 439 440 |
# File 'lib/adlint/cc1/value.rb', line 438 def of_false(logical_shr) of(0, logical_shr) end |
#of_nan(logical_shr) ⇒ Object
464 465 466 |
# File 'lib/adlint/cc1/value.rb', line 464 def of_nan(logical_shr) new(ValueDomain.of_nan(logical_shr)) end |
#of_nil(logical_shr) ⇒ Object
460 461 462 |
# File 'lib/adlint/cc1/value.rb', line 460 def of_nil(logical_shr) new(ValueDomain.of_nil(logical_shr)) end |
#of_null(logical_shr) ⇒ Object
442 443 444 445 446 |
# File 'lib/adlint/cc1/value.rb', line 442 def of_null(logical_shr) # TODO: NULL may not be 0 on some environments. Representation of NULL # should be configurable? of(0, logical_shr) end |
#of_true(logical_shr) ⇒ Object
434 435 436 |
# File 'lib/adlint/cc1/value.rb', line 434 def of_true(logical_shr) not_of(0, logical_shr) end |
#of_undefined(range, logical_shr) ⇒ Object
452 453 454 455 456 457 458 |
# File 'lib/adlint/cc1/value.rb', line 452 def of_undefined(range, logical_shr) new(ValueDomain.of_undefined(ValueDomain.greater_than_or_equal_to( range.first, logical_shr ).intersection(ValueDomain.less_than_or_equal_to( range.last, logical_shr )))) end |