Class: ADSL::Parser::ASTCreateObjset

Inherits:
ASTNode show all
Defined in:
lib/adsl/parser/ast_nodes.rb

Instance Method Summary collapse

Methods inherited from ASTNode

#==, #adsl_ast, #adsl_ast_size, #block_replace, #dup, #hash, is_formula?, is_objset?, is_statement?, node_type, #optimize, #preorder_traverse

Methods included from Verification::FormulaGenerators

#[], #and, #binary_op, #binary_op_with_any_number_of_params, #equiv, #exists, #false, #forall, #handle_quantifier, #implies, #in_formula_builder, #not, #or, #true

Methods included from Verification::Utils

#classname_for_classname, #infer_classname_from_varname, #t

Instance Method Details

#objset_has_side_effects?Boolean

Returns:

  • (Boolean)


746
# File 'lib/adsl/parser/ast_nodes.rb', line 746

def objset_has_side_effects?; true; end

#to_adslObject



758
759
760
# File 'lib/adsl/parser/ast_nodes.rb', line 758

def to_adsl
  "create(#{ @class_name.text })"
end

#typecheck_and_resolve(context) ⇒ Object

Raises:



748
749
750
751
752
753
754
755
756
# File 'lib/adsl/parser/ast_nodes.rb', line 748

def typecheck_and_resolve(context)
  klass_node, klass = context.classes[@class_name.text]
  raise ADSLError, "Undefined class #{@class_name.text} referred to at line #{@class_name.lineno}" if klass.nil?
  if @create_obj.nil?
    @create_obj = ADSL::DS::DSCreateObj.new :klass => klass
    context.pre_stmts << @create_obj
  end
  ADSL::DS::DSCreateObjset.new :createobj => @create_obj
end