Class: Uinit::Sig::MethodCompiler

Inherits:
Uinit::Struct
  • Object
show all
Defined in:
lib/uinit/sig/method_compiler.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.compileObject



6
7
8
# File 'lib/uinit/sig/method_compiler.rb', line 6

def self.compile(...)
  new(...).compile
end

Instance Method Details

#compileObject



14
15
16
17
# File 'lib/uinit/sig/method_compiler.rb', line 14

def compile
  compile_arguments_check_method
  compile_wrapped_method
end

#compile_arguments_check_methodObject



19
20
21
22
23
24
25
26
# File 'lib/uinit/sig/method_compiler.rb', line 19

def compile_arguments_check_method
  compile_method("    def __check_\#{method.method_name}(\#{compile_parameters_sig})\n      __method__ = _signed_methods.\#{method.signed_name}\n      \#{compile_parameters_check}\n    end\n  RUBY\nend\n", __FILE__, __LINE__ + 1)

#compile_wrapped_methodObject



28
29
30
31
32
33
34
35
36
# File 'lib/uinit/sig/method_compiler.rb', line 28

def compile_wrapped_method
  compile_method("    def \#{method.method_name}(...)\n      method = _signed_methods.\#{method.signed_name}\n      __check_\#{method.method_name}(...)\n      \#{compile_original_method_call}\n    end\n  RUBY\nend\n", __FILE__, __LINE__ + 1)