Class: MilkTea::AST::ForStmt

Inherits:
Data
  • Object
show all
Defined in:
lib/milk_tea/core/ast.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bindings:, iterables:, body:, inline: false, threaded: false, line: nil, column: nil) ⇒ ForStmt

Returns a new instance of ForStmt.



184
# File 'lib/milk_tea/core/ast.rb', line 184

def initialize(bindings:, iterables:, body:, inline: false, threaded: false, line: nil, column: nil) = super

Instance Attribute Details

#bindingsObject (readonly)

Returns the value of attribute bindings

Returns:

  • (Object)

    the current value of bindings



183
184
185
# File 'lib/milk_tea/core/ast.rb', line 183

def bindings
  @bindings
end

#bodyObject (readonly)

Returns the value of attribute body

Returns:

  • (Object)

    the current value of body



183
184
185
# File 'lib/milk_tea/core/ast.rb', line 183

def body
  @body
end

#columnObject (readonly)

Returns the value of attribute column

Returns:

  • (Object)

    the current value of column



183
184
185
# File 'lib/milk_tea/core/ast.rb', line 183

def column
  @column
end

#inlineObject (readonly)

Returns the value of attribute inline

Returns:

  • (Object)

    the current value of inline



183
184
185
# File 'lib/milk_tea/core/ast.rb', line 183

def inline
  @inline
end

#iterablesObject (readonly)

Returns the value of attribute iterables

Returns:

  • (Object)

    the current value of iterables



183
184
185
# File 'lib/milk_tea/core/ast.rb', line 183

def iterables
  @iterables
end

#lineObject (readonly)

Returns the value of attribute line

Returns:

  • (Object)

    the current value of line



183
184
185
# File 'lib/milk_tea/core/ast.rb', line 183

def line
  @line
end

#threadedObject (readonly)

Returns the value of attribute threaded

Returns:

  • (Object)

    the current value of threaded



183
184
185
# File 'lib/milk_tea/core/ast.rb', line 183

def threaded
  @threaded
end

Instance Method Details

#bindingObject



187
# File 'lib/milk_tea/core/ast.rb', line 187

def binding = bindings.first

#iterableObject



188
# File 'lib/milk_tea/core/ast.rb', line 188

def iterable = iterables.first

#nameObject



185
# File 'lib/milk_tea/core/ast.rb', line 185

def name = bindings.first.name

#namesObject



186
# File 'lib/milk_tea/core/ast.rb', line 186

def names = bindings.map(&:name)

#parallel?Boolean

Returns:

  • (Boolean)


189
# File 'lib/milk_tea/core/ast.rb', line 189

def parallel? = bindings.length > 1 || iterables.length > 1