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.



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

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



167
168
169
# File 'lib/milk_tea/core/ast.rb', line 167

def bindings
  @bindings
end

#bodyObject (readonly)

Returns the value of attribute body

Returns:

  • (Object)

    the current value of body



167
168
169
# File 'lib/milk_tea/core/ast.rb', line 167

def body
  @body
end

#columnObject (readonly)

Returns the value of attribute column

Returns:

  • (Object)

    the current value of column



167
168
169
# File 'lib/milk_tea/core/ast.rb', line 167

def column
  @column
end

#inlineObject (readonly)

Returns the value of attribute inline

Returns:

  • (Object)

    the current value of inline



167
168
169
# File 'lib/milk_tea/core/ast.rb', line 167

def inline
  @inline
end

#iterablesObject (readonly)

Returns the value of attribute iterables

Returns:

  • (Object)

    the current value of iterables



167
168
169
# File 'lib/milk_tea/core/ast.rb', line 167

def iterables
  @iterables
end

#lineObject (readonly)

Returns the value of attribute line

Returns:

  • (Object)

    the current value of line



167
168
169
# File 'lib/milk_tea/core/ast.rb', line 167

def line
  @line
end

#threadedObject (readonly)

Returns the value of attribute threaded

Returns:

  • (Object)

    the current value of threaded



167
168
169
# File 'lib/milk_tea/core/ast.rb', line 167

def threaded
  @threaded
end

Instance Method Details

#bindingObject



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

def binding = bindings.first

#iterableObject



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

def iterable = iterables.first

#nameObject



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

def name = bindings.first.name

#namesObject



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

def names = bindings.map(&:name)

#parallel?Boolean

Returns:

  • (Boolean)


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

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