| 1646 | } |
| 1647 | |
| 1648 | void InlineFunctionImplicitReturn(const char* pos) |
| 1649 | { |
| 1650 | (void)pos; |
| 1651 | if(currDefinedFunc.back()->explicitlyReturned) |
| 1652 | return; |
| 1653 | if(currDefinedFunc.back()->retType == typeVoid) |
| 1654 | return; |
| 1655 | if(CodeInfo::nodeList.back()->nodeType != typeNodeExpressionList) |
| 1656 | return; |
| 1657 | NodeZeroOP *curr = ((NodeExpressionList*)CodeInfo::nodeList.back())->GetFirstNode(); |
| 1658 | if(curr->next) |
| 1659 | { |
| 1660 | while(curr->next) |
| 1661 | curr = curr->next; |
| 1662 | if(curr->nodeType != typeNodePopOp) |
| 1663 | return; |
| 1664 | |
| 1665 | NodeZeroOP *node = ((NodePopOp*)curr)->GetFirstNode(); |
| 1666 | CodeInfo::nodeList.push_back(node); |
| 1667 | curr->prev->next = new NodeReturnOp(true, currDefinedFunc.back()->retType, currDefinedFunc.back(), false); |
| 1668 | if(!currDefinedFunc.back()->retType) |
| 1669 | { |
| 1670 | currDefinedFunc.back()->retType = node->typeInfo; |
| 1671 | currDefinedFunc.back()->funcType = CodeInfo::GetFunctionType(currDefinedFunc.back()->retType, currDefinedFunc.back()->firstParam, currDefinedFunc.back()->paramCount); |
| 1672 | } |
| 1673 | }else{ |
| 1674 | if(curr->nodeType != typeNodePopOp) |
| 1675 | return; |
| 1676 | NodeZeroOP *node = ((NodePopOp*)curr)->GetFirstNode(); |
| 1677 | CodeInfo::nodeList.back() = node; |
| 1678 | CodeInfo::nodeList.push_back(new NodeReturnOp(true, currDefinedFunc.back()->retType, currDefinedFunc.back(), false)); |
| 1679 | if(!currDefinedFunc.back()->retType) |
| 1680 | { |
| 1681 | currDefinedFunc.back()->retType = node->typeInfo; |
| 1682 | currDefinedFunc.back()->funcType = CodeInfo::GetFunctionType(currDefinedFunc.back()->retType, currDefinedFunc.back()->firstParam, currDefinedFunc.back()->paramCount); |
| 1683 | } |
| 1684 | AddOneExpressionNode(currDefinedFunc.back()->retType); |
| 1685 | } |
| 1686 | currDefinedFunc.back()->explicitlyReturned = true; |
| 1687 | } |
| 1688 | |
| 1689 | // Function for array indexing |
| 1690 | void AddArrayIndexNode(const char* pos, unsigned argumentCount) |
no test coverage detected