Class: Idl::ForLoopAst

Inherits:
AstNode show all
Defined in:
lib/udb/idl/condition_to_udb.rb

Instance Method Summary collapse

Instance Method Details

#to_udb_h(symtab) ⇒ UdbHashType

Parameters:

  • symtab (Idl::SymbolTable)

Returns:



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/udb/idl/condition_to_udb.rb', line 88

def to_udb_h(symtab)
  res = { "allOf" => [] }

  symtab.push(self)
  init.execute(symtab)
  while condition.value(symtab)
    stmts.each do |stmt|
      if stmt.is_a?(ImplicationStatementAst)
        res["allOf"] << stmt.to_udb_h(symtab)
      elsif stmt.is_a?(ReturnStatementAst)
        raise "Returns are not allowed in constraints"
      else
        stmt.execute(symtab)
      end
    end
    update.execute(symtab)
  end
  symtab.pop

  res
end