| 657 | } |
| 658 | |
| 659 | FunctionPtr generateLocalFunction ( const string & lambdaName, ExprBlock * block ) { |
| 660 | auto lfn = lambdaName + "`function"; |
| 661 | auto pFunc = new Function(); |
| 662 | pFunc->generated = true; |
| 663 | pFunc->at = pFunc->atDecl = block->at; |
| 664 | pFunc->name = lfn; |
| 665 | pFunc->body = block->clone(); |
| 666 | pFunc->privateFunction = true; |
| 667 | auto wb = static_cast<ExprBlock*>(pFunc->body); |
| 668 | wb->blockFlags = 0; |
| 669 | wb->arguments.clear(); |
| 670 | wb->returnType = nullptr; |
| 671 | pFunc->result = new TypeDecl(*block->type); |
| 672 | for ( auto & arg : block->arguments ) { |
| 673 | auto cA = arg->clone(); |
| 674 | cA->marked_used = true; |
| 675 | pFunc->arguments.push_back(cA); |
| 676 | } |
| 677 | verifyGenerated(pFunc->body); |
| 678 | return pFunc; |
| 679 | } |
| 680 | |
| 681 | bool isCaptureAsRef ( const VariablePtr & var ) { |
| 682 | return var->capture_as_ref; |
no test coverage detected