Class: DeclarationStatement

Inherits:
Statement show all
Defined in:
lib/core/statement/DeclarationStatement.rb

Overview

This class represents statements that declare new variables. e.g. var = ‘test’.chop

var1 = var2.pop

Instance Attribute Summary

Attributes inherited from Statement

#overrides, #scope, #statement_id, #statement_level

Instance Method Summary collapse

Methods inherited from Statement

#[], #[]=, #add, #assignment?, #cauldron_method_calls, #clear, #confirmed?, #contains_method_call?, #context_variable, #contextual_variable, #copy, #created_variable, #created_variable_id, #creates_variable?, #decalares_variable?, #declared_variable, #declared_variable_id, #describe, #each, #each_unrealised_variable, #each_untyped_variable, #each_variable, #each_with_index, #equivalent?, #exchange_variables, #find_actual_variable, #find_all_required_runtime_methods, #find_overriding_statements, #find_statement, #find_variable, #first, #has?, #identify_overriding_statements, #is_simple?, #last, #left_hand_side, #length, #literalise, #map_to, #not_declared_variables, #overrides?, #push, #realise2, #realised?, #replace_variable!, #replace_variable_if, #required_variable_ids, reset_global_id, #right_hand_side, #same_not_declared_variables?, #select_all, #statement_count, #subst, #subst!, #subst_variable!, #to_declaration, #to_literal_string, #to_var, #tokens, #unrealised_variables, #untyped_variables, #valid_syntax?, #variables, #write, #write_with_uniq_id, #write_with_value, #write_with_variable_id

Methods included from ActsAsCode

#write_structure

Methods included from ActsAsStatement

#classes_match?, #statement_type

Methods included from PrintVariables

#display_name_for

Constructor Details

#initialize(*parameters) ⇒ DeclarationStatement

Returns a new instance of DeclarationStatement.



7
8
9
# File 'lib/core/statement/DeclarationStatement.rb', line 7

def initialize(*parameters)
  super(*parameters)
end

Instance Method Details

#declaredObject

Returns the declared variable. So in he case where there is var = 8 it would return var. This is always the first entry.



15
16
17
# File 'lib/core/statement/DeclarationStatement.rb', line 15

def declared
  return self.first
end