Class: JsxRosetta::IR::EventHandler

Inherits:
Data
  • Object
show all
Includes:
Node
Defined in:
lib/jsx_rosetta/ir/types.rb

Overview

An arrow/function expression whose body isn’t JSX — typically a JSX event handler on a PascalCase component (‘onClick==> doX()`) or a non-JSX-returning callback prop. We can’t translate arbitrary JS bodies to Ruby procedurally, so backends emit a stub method on the class with the verbatim JS body preserved as a TODO comment; the kwarg at the use site becomes ‘method(:method_name)` so the receiving component has a callable reference and the structural attachment is preserved end-to-end.

params : [String] body_source : String — verbatim JS of the arrow/function body

(the part after `=>` for arrows, or the full block
body for FunctionExpressions). Preserved as a
comment in the emitted method so the reviewer can
translate the behavior to Ruby.

Instance Attribute Summary collapse

Instance Attribute Details

#body_sourceObject (readonly)

Returns the value of attribute body_source

Returns:

  • (Object)

    the current value of body_source



542
543
544
# File 'lib/jsx_rosetta/ir/types.rb', line 542

def body_source
  @body_source
end

#paramsObject (readonly)

Returns the value of attribute params

Returns:

  • (Object)

    the current value of params



542
543
544
# File 'lib/jsx_rosetta/ir/types.rb', line 542

def params
  @params
end