* enlarge the block to contains all variables in the list. This is used to create * itemized array variable */
| 782 | * itemized array variable |
| 783 | */ |
| 784 | Block* |
| 785 | VariableSelector::lower_block_for_vars(const vector<Block*>& blks, vector<const Variable*>& vars) |
| 786 | { |
| 787 | size_t i, j, len; |
| 788 | Block* b = 0; |
| 789 | for (j=0; j<blks.size(); j++) { |
| 790 | b = blks[j]; |
| 791 | len = vars.size(); |
| 792 | for (i=0; i<len; i++) { |
| 793 | if (find_variable_in_set(b->local_vars, vars[i]) != -1) { |
| 794 | vars.erase(vars.begin() + i); |
| 795 | i--; |
| 796 | len--; |
| 797 | } |
| 798 | } |
| 799 | if (vars.empty()) { |
| 800 | return b; |
| 801 | } |
| 802 | } |
| 803 | // we break out of loop when either all vars have been covered, or |
| 804 | // there is no more higher block to go - most likely there are global |
| 805 | // variables or pameters in the list - in that case, returning 0 |
| 806 | // properly indicate only global scope covers all variables |
| 807 | return 0; |
| 808 | } |
| 809 | |
| 810 | /************************************************************************************* |
| 811 | * find an initializing value for a new variable |
nothing calls this directly
no test coverage detected