Class: Jade::Frontend::TypeChecking::Result
- Inherits:
-
Data
- Object
- Data
- Jade::Frontend::TypeChecking::Result
- Defined in:
- lib/jade/frontend/type_checking/result.rb
Instance Attribute Summary collapse
-
#constraints ⇒ Object
readonly
Returns the value of attribute constraints.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#constraints ⇒ Object (readonly)
Returns the value of attribute constraints
4 5 6 |
# File 'lib/jade/frontend/type_checking/result.rb', line 4 def constraints @constraints end |
#type ⇒ Object (readonly)
Returns the value of attribute type
4 5 6 |
# File 'lib/jade/frontend/type_checking/result.rb', line 4 def type @type end |
Class Method Details
.accumulator ⇒ Object
26 27 28 |
# File 'lib/jade/frontend/type_checking/result.rb', line 26 def self.accumulator ResultAcc[[], []] end |
.init(type, constraints = []) ⇒ Object
5 6 7 |
# File 'lib/jade/frontend/type_checking/result.rb', line 5 def self.init(type, constraints = []) new(type, constraints) end |
Instance Method Details
#apply(substitution) ⇒ Object
9 10 11 12 |
# File 'lib/jade/frontend/type_checking/result.rb', line 9 def apply(substitution) with(type: substitution.apply(type)) .with(constraints: constraints.map { substitution.apply(it) }) end |
#attach_origin(node) ⇒ Object
20 21 22 23 24 |
# File 'lib/jade/frontend/type_checking/result.rb', line 20 def attach_origin(node) constraints .map { it.with(origin: node) } .then { with(constraints: it) } end |
#map(&block) ⇒ Object
14 15 16 17 18 |
# File 'lib/jade/frontend/type_checking/result.rb', line 14 def map(&block) block .call(type) .then { with(type: it) } end |