This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .sub 'add_meta_method' :method | |
| .param pmc meta | |
| .param string name | |
| .param pmc meth | |
| # Add the method to the meta model | |
| $P0 = meta.'HOW'() | |
| $P0.'add_method'(name, meth) | |
| # Add forward method to the class itself. | |
| .lex '$meth_name', name | |
| .const 'Sub' $P1 = '!metaclass_method_forwarder' | |
| $P1 = newclosure $P1 | |
| $P0 = getattribute meta, 'parrotclass' | |
| $P0.'add_method'(name, $P1) | |
| .end | |
| .sub '!metaclass_method_forwarder' :outer('add_meta_method') :method :anon | |
| .param pmc pos_args :slurpy | |
| .param pmc named_args :slurpy :named | |
| $P0 = self.'HOW'() | |
| $P1 = find_lex '$meth_name' | |
| $S0 = $P1 | |
| .tailcall $P0.$S0(self, pos_args :flat, named_args :flat :named) | |
| .end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment