Class: JsxRosetta::IR::ModuleConstant

Inherits:
Data
  • Object
show all
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

Instance Attribute Details

#constant_nameObject (readonly)

Returns the value of attribute constant_name

Returns:

  • (Object)

    the current value of constant_name



196
197
198
# File 'lib/jsx_rosetta/ir/types.rb', line 196

def constant_name
  @constant_name
end

#nameObject (readonly)

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



196
197
198
# File 'lib/jsx_rosetta/ir/types.rb', line 196

def name
  @name
end

#valueObject (readonly)

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



196
197
198
# File 'lib/jsx_rosetta/ir/types.rb', line 196

def value
  @value
end