| 162 | | if(indicesCount == 0) { |
| 163 | | push('array.assign(0, array.at(0).'+operateMethodNames[calcCode]+'(arg));'); |
| 164 | | } else if(indicesCount == 1) { |
| 165 | | push('var offset = self.scanArg(stack.pop(), "i").toIntValue()._value;'); |
| 166 | | push('array.expand1D(offset);'); |
| 167 | | push('array.assign(offset, array.at(offset).'+operateMethodNames[calcCode]+'(arg));'); |
| | 162 | if(!(8 <= calcCode && calcCode <= 13)) { |
| | 163 | // 比較演算以外は同じ型の値が返ってくることに依存して型チェックをしない |
| | 164 | push('var array = '+variableExpr+'.value;'); |
| | 165 | if(indicesCount == 0) { |
| | 166 | push('array.assign(0, array.at(0).'+operateMethodNames[calcCode]+'(arg));'); |
| | 167 | } else if(indicesCount == 1) { |
| | 168 | push('var offset = self.scanArg(stack.pop(), "i").toIntValue()._value;'); |
| | 169 | push('array.expand1D(offset);'); |
| | 170 | push('array.assign(offset, array.at(offset).'+operateMethodNames[calcCode]+'(arg));'); |
| | 171 | } else { |
| | 172 | pushGettingIndicesCode(indicesCount, 0); |
| | 173 | push('stack.length -= '+indicesCount+';'); |
| | 174 | push('array.expand(indices);'); |
| | 175 | push('var offset = array.getOffset(indices);'); |
| | 176 | push('array.assign(offset, array.at(offset).'+operateMethodNames[calcCode]+'(arg));'); |
| | 177 | } |
| 169 | | pushGettingIndicesCode(indicesCount, 0); |
| 170 | | push('stack.length -= '+indicesCount+';'); |
| 171 | | push('array.expand(indices);'); |
| 172 | | push('var offset = array.getOffset(indices);'); |
| 173 | | push('array.assign(offset, array.at(offset).'+operateMethodNames[calcCode]+'(arg));'); |
| | 179 | push('var variable = '+variableExpr+';'); |
| | 180 | if(indicesCount == 0) { |
| | 181 | push('if(variable.value.getType() != arg.getType()) variable.reset(arg.getType());'); |
| | 182 | push('variable.value.assign(0, variable.value.at(0).'+operateMethodNames[calcCode]+'(arg));'); |
| | 183 | } else if(indicesCount == 1) { |
| | 184 | push('var offset = self.scanArg(stack.pop(), "i").toIntValue()._value;'); |
| | 185 | push('if(variable.value.getType() != arg.getType()) {'); |
| | 186 | push(' if(offset == 0) {'); |
| | 187 | push(' variable.reset(arg.getType());'); |
| | 188 | push(' } else {'); |
| | 189 | push(' throw new HSPError(ErrorCode.INVALID_ARRAYSTORE);'); |
| | 190 | push(' }'); |
| | 191 | push('}'); |
| | 192 | push('variable.value.assign(offset, variable.value.at(offset).'+operateMethodNames[calcCode]+'(arg));'); |
| | 193 | } else { |
| | 194 | pushGettingIndicesCode(indicesCount, 0); |
| | 195 | push('stack.length -= '+indicesCount+';'); |
| | 196 | push('var array = variable.value;'); |
| | 197 | push('array.expand(indices);'); |
| | 198 | push('var offset = array.getOffset(indices);'); |
| | 199 | push('if(array.getType() != arg.getType()) {'); |
| | 200 | push(' if(offset == 0) {'); |
| | 201 | push(' variable.reset(arg.getType());'); |
| | 202 | push(' array = variable.value;'); |
| | 203 | push(' array.expand(indices);'); |
| | 204 | push(' } else {'); |
| | 205 | push(' throw new HSPError(ErrorCode.INVALID_ARRAYSTORE);'); |
| | 206 | push(' }'); |
| | 207 | push('}'); |
| | 208 | push('array.assign(offset, array.at(offset).'+operateMethodNames[calcCode]+'(arg));'); |
| | 209 | } |