| 195 | } |
| 196 | |
| 197 | txSlot* fxToInstance(txMachine* the, txSlot* theSlot) |
| 198 | { |
| 199 | txSlot* anInstance = C_NULL; |
| 200 | switch (theSlot->kind) { |
| 201 | case XS_UNDEFINED_KIND: |
| 202 | mxTypeError("cannot coerce undefined to object"); |
| 203 | break; |
| 204 | case XS_NULL_KIND: |
| 205 | mxTypeError("cannot coerce null to object"); |
| 206 | break; |
| 207 | case XS_BOOLEAN_KIND: |
| 208 | mxPush(mxBooleanPrototype); |
| 209 | anInstance = fxNewBooleanInstance(the); |
| 210 | anInstance->next->value.boolean = theSlot->value.boolean; |
| 211 | if (the->frame->flag & XS_STRICT_FLAG) |
| 212 | anInstance->flag |= XS_DONT_PATCH_FLAG; |
| 213 | mxPullSlot(theSlot); |
| 214 | break; |
| 215 | case XS_INTEGER_KIND: |
| 216 | mxPush(mxNumberPrototype); |
| 217 | anInstance = fxNewNumberInstance(the); |
| 218 | anInstance->next->value.number = theSlot->value.integer; |
| 219 | if (the->frame->flag & XS_STRICT_FLAG) |
| 220 | anInstance->flag |= XS_DONT_PATCH_FLAG; |
| 221 | mxPullSlot(theSlot); |
| 222 | break; |
| 223 | case XS_NUMBER_KIND: |
| 224 | mxPush(mxNumberPrototype); |
| 225 | anInstance = fxNewNumberInstance(the); |
| 226 | anInstance->next->value.number = theSlot->value.number; |
| 227 | if (the->frame->flag & XS_STRICT_FLAG) |
| 228 | anInstance->flag |= XS_DONT_PATCH_FLAG; |
| 229 | mxPullSlot(theSlot); |
| 230 | break; |
| 231 | case XS_STRING_KIND: |
| 232 | case XS_STRING_X_KIND: |
| 233 | mxPush(mxStringPrototype); |
| 234 | anInstance = fxNewStringInstance(the); |
| 235 | anInstance->next->kind = theSlot->kind; |
| 236 | anInstance->next->value.string = theSlot->value.string; |
| 237 | if (the->frame->flag & XS_STRICT_FLAG) |
| 238 | anInstance->flag |= XS_DONT_PATCH_FLAG; |
| 239 | mxPullSlot(theSlot); |
| 240 | break; |
| 241 | case XS_SYMBOL_KIND: |
| 242 | mxPush(mxSymbolPrototype); |
| 243 | anInstance = fxNewSymbolInstance(the); |
| 244 | anInstance->next->value.symbol = theSlot->value.symbol; |
| 245 | if (the->frame->flag & XS_STRICT_FLAG) |
| 246 | anInstance->flag |= XS_DONT_PATCH_FLAG; |
| 247 | mxPullSlot(theSlot); |
| 248 | break; |
| 249 | case XS_BIGINT_KIND: |
| 250 | case XS_BIGINT_X_KIND: |
| 251 | anInstance = gxTypeBigInt.toInstance(the, theSlot); |
| 252 | break; |
| 253 | case XS_REFERENCE_KIND: |
| 254 | anInstance = theSlot->value.reference; |
no test coverage detected