Class: Rubex::AST::Expression::ArgDeclaration
- Defined in:
- lib/rubex/ast/expression/arg_declaration.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#data_hash ⇒ Object
readonly
Keep data_hash attr_reader because this node is coerced into specialized ArgDecl nodes in the parser.
Attributes inherited from Base
Instance Method Summary collapse
-
#analyse_types(local_scope, extern: false) ⇒ Object
TODO: Support array of function pointers and array in arguments.
-
#initialize(data_hash) ⇒ ArgDeclaration
constructor
A new instance of ArgDeclaration.
Methods inherited from Base
#allocate_temp, #allocate_temps, #analyse_for_target_type, #c_code, #expression?, #from_ruby_object, #generate_and_dispose_subexprs, #generate_assignment_code, #generate_disposal_code, #generate_evaluation_code, #has_temp, #possible_typecast, #release_temp, #release_temps, #to_ruby_object
Constructor Details
#initialize(data_hash) ⇒ ArgDeclaration
Returns a new instance of ArgDeclaration.
8 9 10 |
# File 'lib/rubex/ast/expression/arg_declaration.rb', line 8 def initialize(data_hash) @data_hash = data_hash end |
Instance Attribute Details
#data_hash ⇒ Object (readonly)
Keep data_hash attr_reader because this node is coerced into specialized ArgDecl nodes in the parser.
7 8 9 |
# File 'lib/rubex/ast/expression/arg_declaration.rb', line 7 def data_hash @data_hash end |
Instance Method Details
#analyse_types(local_scope, extern: false) ⇒ Object
TODO: Support array of function pointers and array in arguments.
13 14 15 16 17 18 19 20 21 |
# File 'lib/rubex/ast/expression/arg_declaration.rb', line 13 def analyse_types(local_scope, extern: false) var, dtype, ident, ptr_level, value = fetch_data name = ident c_name = Rubex::ARG_PREFIX + ident @type = Helpers.determine_dtype(dtype, ptr_level) value&.analyse_types(local_scope) add_arg_to_symbol_table name, c_name, value, extern, local_scope @has_temp = true if @type.object? end |