Class: Rubex::AST::TopStatement::RubyMethodDef
- Defined in:
- lib/rubex/ast/top_statement/method_def/ruby_method_def.rb
Instance Attribute Summary collapse
-
#singleton ⇒ Object
readonly
Returns the value of attribute singleton.
Attributes inherited from MethodDef
#arg_list, #entry, #name, #scope, #self_name, #statements
Instance Method Summary collapse
- #==(other) ⇒ Object
- #analyse_statement(local_scope) ⇒ Object
- #generate_code(code) ⇒ Object
-
#initialize(name, arg_list, statements, singleton: false) ⇒ RubyMethodDef
constructor
A new instance of RubyMethodDef.
Methods inherited from MethodDef
Methods included from Helpers::Writers
#declare_carrays, #declare_ruby_objects, #declare_temps, #declare_types, #declare_vars, #sue_footer, #sue_header, #write_char_2_ruby_str_code, #write_char_2_ruby_str_header, #write_usability_functions_code, #write_usability_functions_header, #write_usability_macros
Constructor Details
#initialize(name, arg_list, statements, singleton: false) ⇒ RubyMethodDef
Returns a new instance of RubyMethodDef.
7 8 9 10 |
# File 'lib/rubex/ast/top_statement/method_def/ruby_method_def.rb', line 7 def initialize(name, arg_list, statements, singleton: false) super(name, arg_list, statements) @singleton = singleton end |
Instance Attribute Details
#singleton ⇒ Object (readonly)
Returns the value of attribute singleton.
5 6 7 |
# File 'lib/rubex/ast/top_statement/method_def/ruby_method_def.rb', line 5 def singleton @singleton end |
Instance Method Details
#==(other) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/rubex/ast/top_statement/method_def/ruby_method_def.rb', line 23 def ==(other) self.class == other.class && @name == other.name && @c_name == other.c_name && @arg_list == other.arg_list && @statements == other.statements && @entry == other.entry && @type == other.type end |
#analyse_statement(local_scope) ⇒ Object
12 13 14 15 |
# File 'lib/rubex/ast/top_statement/method_def/ruby_method_def.rb', line 12 def analyse_statement(local_scope) super @entry.singleton = @singleton end |
#generate_code(code) ⇒ Object
17 18 19 20 21 |
# File 'lib/rubex/ast/top_statement/method_def/ruby_method_def.rb', line 17 def generate_code(code) code.write_ruby_method_header(type: @entry.type.type.to_s, c_name: @entry.c_name) super end |