Class: ADSL::Parser::ASTDeclareVar

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



721
722
723
# File 'lib/adsl/parser/ast_nodes.rb', line 721

def to_adsl
  "declare #{ @var_name.text }\n"
end

#typecheck_and_resolve(context) ⇒ Object



712
713
714
715
716
717
718
719
# File 'lib/adsl/parser/ast_nodes.rb', line 712

def typecheck_and_resolve(context)
  var = context.lookup_var @var_name.text, false
  if var.nil?
    return ASTAssignment.new(:var_name => @var_name.dup, :objset => ASTEmptyObjset.new).typecheck_and_resolve(context)
  else
    []
  end
end