Class: ADSL::Parser::ASTIn

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, #objset_has_side_effects?, #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

#to_adslObject



1391
1392
1393
# File 'lib/adsl/parser/ast_nodes.rb', line 1391

def to_adsl
  "#{ @objset1.to_adsl } in #{ @objset2.to_adsl }"
end

#typecheck_and_resolve(context) ⇒ Object

Raises:



1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
# File 'lib/adsl/parser/ast_nodes.rb', line 1380

def typecheck_and_resolve(context)
  objset1 = @objset1.typecheck_and_resolve context
  objset2 = @objset2.typecheck_and_resolve context
  
  return ADSL::DS::Boolean::TRUE if objset1.type.nil?
  return ADSL::DS::DSEmpty.new :objset => objset1 if objset2.type.nil?
  
  raise ADSLError, "Object sets are not of compatible types: #{objset1.type.name}, #{objset2.type.name}" unless objset2.type.superclass_of? objset1.type
  return ADSL::DS::DSIn.new :objset1 => objset1, :objset2 => objset2
end