| 820 | } |
| 821 | |
| 822 | string Function::describe(DescribeModule moduleName, DescribeExtra extra) const { |
| 823 | TextWriter ss; |
| 824 | if ( moduleName==DescribeModule::yes && module && !module->name.empty() ) { |
| 825 | ss << module->name << "::"; |
| 826 | } |
| 827 | if ( !isalpha(name[0]) && name[0]!='_' && name[0]!='`' ) { |
| 828 | ss << "operator "; |
| 829 | } |
| 830 | ss << name; |
| 831 | if ( arguments.size() ) { |
| 832 | ss << "("; |
| 833 | for ( auto & arg : arguments ) { |
| 834 | ss << arg->name << ": " << *arg->type; |
| 835 | if ( extra==DescribeExtra::yes && arg->init ) { |
| 836 | ss << " = " << *arg->init; |
| 837 | } |
| 838 | if ( arg != arguments.back() ) ss << "; "; |
| 839 | } |
| 840 | ss << ")"; |
| 841 | } |
| 842 | if ( result ) { |
| 843 | ss << ": " << result->describe(); |
| 844 | } |
| 845 | return ss.str(); |
| 846 | } |
| 847 | |
| 848 | string Function::getMangledName() const { |
| 849 | TextWriter ss; |