Class: JsxRosetta::IR::Loop

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

Overview

A list-rendering loop. Lowered from a JSX expression of the form:

{items.map((item) => <X />)}
{items.map((item, index) => <X />)}

plus the arrow-with-block form ‘(item) => { return <X />; }`.

iterable : Interpolation — verbatim source of the iterable

expression (e.g. "items", "todos.filter(...)").

item_binding : String — name of the item parameter, in original

camelCase. Backends snake_case as needed.

index_binding : String | nil — name of the index parameter, if present. body : Node — the lowered IR node rendered for each iteration.

Instance Attribute Summary collapse

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body

Returns:

  • (Object)

    the current value of body



272
273
274
# File 'lib/jsx_rosetta/ir/types.rb', line 272

def body
  @body
end

#index_bindingObject (readonly)

Returns the value of attribute index_binding

Returns:

  • (Object)

    the current value of index_binding



272
273
274
# File 'lib/jsx_rosetta/ir/types.rb', line 272

def index_binding
  @index_binding
end

#item_bindingObject (readonly)

Returns the value of attribute item_binding

Returns:

  • (Object)

    the current value of item_binding



272
273
274
# File 'lib/jsx_rosetta/ir/types.rb', line 272

def item_binding
  @item_binding
end

#iterableObject (readonly)

Returns the value of attribute iterable

Returns:

  • (Object)

    the current value of iterable



272
273
274
# File 'lib/jsx_rosetta/ir/types.rb', line 272

def iterable
  @iterable
end