Class: Carbon::Tacky::Typed
- Inherits:
-
Struct
- Object
- Struct
- Carbon::Tacky::Typed
- Defined in:
- lib/carbon/tacky/typed.rb
Constant Summary collapse
- INT32 =
Carbon::Type("Carbon::Int32")
- STRING =
Carbon::Type("Carbon::String")
- FLOAT =
Carbon::Type("Carbon::Float")
Instance Attribute Summary collapse
-
#type ⇒ Object
Returns the value of attribute type.
-
#value ⇒ Object
Returns the value of attribute value.
Class Method Summary collapse
Instance Attribute Details
#type ⇒ Object
Returns the value of attribute type
6 7 8 |
# File 'lib/carbon/tacky/typed.rb', line 6 def type @type end |
#value ⇒ Object
Returns the value of attribute value
6 7 8 |
# File 'lib/carbon/tacky/typed.rb', line 6 def value @value end |
Class Method Details
.from(value) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/carbon/tacky/typed.rb', line 11 def self.from(value) case value when Concrete::Type, Tacky::Typed then value when Tacky::Parameter then new(value, value.type) when Tacky::Reference then fail NotImplementedError when Tacky::Block then nil when ::Integer then new(value, INT32) when ::Float then new(value, FLOAT) when ::String, ::Symbol then new(value, STRING) else fail ArgumentError, "Cannot guess type for #{value.class}" end end |