Class: JsxRosetta::IR::ModuleConstant
- Inherits:
-
Data
- Object
- Data
- JsxRosetta::IR::ModuleConstant
- Includes:
- Node
- Defined in:
- lib/jsx_rosetta/ir/types.rb
Overview
A literal-shaped module-level ‘const` declaration that lowers to a real Ruby constant. Distinct from `LocalBinding` (verbatim TODO block) and `CvaBinding` (structured cva variants). The detector accepts initializers whose value reduces to a Ruby-literal-friendly object — strings, numbers, booleans, null, arrays/hashes of the same. Non-literal initializers (call expressions, identifier references, JSX) still fall through to the `LocalBinding` path so their verbatim source surfaces in the module-bindings TODO block.
name : String — original JS identifier (e.g. “TAGS”, “COLUMNS”). constant_name : String — Ruby constant identifier emitted above the class
(`AST::Inflector.underscore(name).upcase`). Stored on the
IR so future collision-detection has somewhere to bind.
value : Object — Ruby-literal-friendly value (String, Integer,
Float, true, false, nil, Array of the same, Hash with
String keys mapping to the same). Backends call `.inspect`
to emit the literal text.
Instance Attribute Summary collapse
-
#constant_name ⇒ Object
readonly
Returns the value of attribute constant_name.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Attribute Details
#constant_name ⇒ Object (readonly)
Returns the value of attribute constant_name
196 197 198 |
# File 'lib/jsx_rosetta/ir/types.rb', line 196 def constant_name @constant_name end |
#name ⇒ Object (readonly)
Returns the value of attribute name
196 197 198 |
# File 'lib/jsx_rosetta/ir/types.rb', line 196 def name @name end |
#value ⇒ Object (readonly)
Returns the value of attribute value
196 197 198 |
# File 'lib/jsx_rosetta/ir/types.rb', line 196 def value @value end |