| 2137 | } |
| 2138 | |
| 2139 | void fxArrayNodeCode(void* it, void* param) |
| 2140 | { |
| 2141 | txArrayNode* self = it; |
| 2142 | txCoder* coder = param; |
| 2143 | txInteger array = fxCoderUseTemporaryVariable(param); |
| 2144 | fxCoderAddByte(param, 1, XS_CODE_ARRAY); |
| 2145 | fxCoderAddIndex(param, 0, XS_CODE_SET_LOCAL_1, array); |
| 2146 | if (self->items) { |
| 2147 | txNode* item = self->items->first; |
| 2148 | if (self->flags & mxSpreadFlag) { |
| 2149 | txInteger counter = fxCoderUseTemporaryVariable(param); |
| 2150 | fxCoderAddInteger(param, 1, XS_CODE_INTEGER_1, 0); |
| 2151 | fxCoderAddIndex(param, -1, XS_CODE_PULL_LOCAL_1, counter); |
| 2152 | while (item) { |
| 2153 | if (item->description->token == XS_TOKEN_SPREAD) { |
| 2154 | txInteger iterator = fxCoderUseTemporaryVariable(param); |
| 2155 | txInteger result = fxCoderUseTemporaryVariable(param); |
| 2156 | txTargetCode* nextTarget = fxCoderCreateTarget(param); |
| 2157 | txTargetCode* doneTarget = fxCoderCreateTarget(param); |
| 2158 | fxNodeDispatchCode(((txSpreadNode*)item)->expression, param); |
| 2159 | fxCoderAddByte(param, 0, XS_CODE_FOR_OF); |
| 2160 | fxCoderAddIndex(param, 0, XS_CODE_SET_LOCAL_1, iterator); |
| 2161 | fxCoderAddByte(param, -1, XS_CODE_POP); |
| 2162 | fxCoderAdd(param, 0, nextTarget); |
| 2163 | fxCoderAddIndex(param, 1, XS_CODE_GET_LOCAL_1, iterator); |
| 2164 | fxCoderAddByte(param, 1, XS_CODE_DUB); |
| 2165 | fxCoderAddSymbol(param, 0, XS_CODE_GET_PROPERTY, coder->parser->nextSymbol); |
| 2166 | fxCoderAddByte(param, 1, XS_CODE_CALL); |
| 2167 | fxCoderAddInteger(param, -2, XS_CODE_RUN_1, 0); |
| 2168 | fxCoderAddIndex(param, 0, XS_CODE_SET_LOCAL_1, result); |
| 2169 | fxCoderAddSymbol(param, 0, XS_CODE_GET_PROPERTY, coder->parser->doneSymbol); |
| 2170 | fxCoderAddBranch(param, -1, XS_CODE_BRANCH_IF_1, doneTarget); |
| 2171 | fxCoderAddIndex(param, 1, XS_CODE_GET_LOCAL_1, array); |
| 2172 | fxCoderAddIndex(param, 1, XS_CODE_GET_LOCAL_1, counter); |
| 2173 | fxCoderAddByte(param, 0, XS_CODE_AT); |
| 2174 | fxCoderAddIndex(param, 0, XS_CODE_GET_LOCAL_1, result); |
| 2175 | fxCoderAddSymbol(param, 0, XS_CODE_GET_PROPERTY, coder->parser->valueSymbol); |
| 2176 | fxCoderAddByte(param, -2, XS_CODE_SET_PROPERTY_AT); |
| 2177 | fxCoderAddByte(param, -1, XS_CODE_POP); |
| 2178 | fxCoderAddIndex(param, 1, XS_CODE_GET_LOCAL_1, counter); |
| 2179 | fxCoderAddByte(param, 0, XS_CODE_INCREMENT); |
| 2180 | fxCoderAddIndex(param, -1, XS_CODE_PULL_LOCAL_1, counter); |
| 2181 | fxCoderAddBranch(param, 0, XS_CODE_BRANCH_1, nextTarget); |
| 2182 | fxCoderAdd(param, 1, doneTarget); |
| 2183 | fxCoderUnuseTemporaryVariables(param, 2); |
| 2184 | } |
| 2185 | else { |
| 2186 | if (item->description->token != XS_TOKEN_ELISION) { |
| 2187 | fxCoderAddIndex(param, 1, XS_CODE_GET_LOCAL_1, array); |
| 2188 | fxCoderAddIndex(param, 1, XS_CODE_GET_LOCAL_1, counter); |
| 2189 | fxCoderAddByte(param, 0, XS_CODE_AT); |
| 2190 | fxNodeDispatchCode(item, param); |
| 2191 | fxCoderAddByte(param, -2, XS_CODE_SET_PROPERTY_AT); |
| 2192 | fxCoderAddByte(param, -1, XS_CODE_POP); |
| 2193 | fxCoderAddIndex(param, 1, XS_CODE_GET_LOCAL_1, counter); |
| 2194 | fxCoderAddByte(param, 0, XS_CODE_INCREMENT); |
| 2195 | fxCoderAddIndex(param, -1, XS_CODE_PULL_LOCAL_1, counter); |
| 2196 | } |
nothing calls this directly
no test coverage detected