| 260 | } |
| 261 | |
| 262 | void fx_Function(txMachine* the) |
| 263 | { |
| 264 | txInteger c, i; |
| 265 | txStringStream stream; |
| 266 | txSlot* module = mxFunctionInstanceHome(mxFunction->value.reference)->value.home.module; |
| 267 | if (!module) module = mxProgram.value.reference; |
| 268 | |
| 269 | c = mxArgc; |
| 270 | i = 0; |
| 271 | mxPushStringX("(function anonymous("); |
| 272 | while (c > 1) { |
| 273 | fxToString(the, mxArgv(i)); |
| 274 | fxConcatString(the, the->stack, mxArgv(i)); |
| 275 | if (c > 2) |
| 276 | fxConcatStringC(the, the->stack, ", "); |
| 277 | c--; |
| 278 | i++; |
| 279 | } |
| 280 | fxConcatStringC(the, the->stack, "\n){"); |
| 281 | if (c > 0) { |
| 282 | fxToString(the, mxArgv(i)); |
| 283 | fxConcatString(the, the->stack, mxArgv(i)); |
| 284 | } |
| 285 | fxConcatStringC(the, the->stack, "\n})"); |
| 286 | stream.slot = the->stack; |
| 287 | stream.offset = 0; |
| 288 | stream.size = mxStringLength(the->stack->value.string); |
| 289 | fxRunScript(the, fxParseScript(the, &stream, fxStringGetter, mxProgramFlag | mxFunctionFlag), C_NULL, C_NULL, C_NULL, C_NULL, module); |
| 290 | mxPullSlot(mxResult); |
| 291 | if (mxHasTarget && !fxIsSameSlot(the, mxTarget, mxFunction)) { |
| 292 | mxPushSlot(mxTarget); |
| 293 | fxGetPrototypeFromConstructor(the, &mxFunctionPrototype); |
| 294 | mxResult->value.reference->value.instance.prototype = the->stack->value.reference; |
| 295 | mxPop(); |
| 296 | } |
| 297 | } |
| 298 | |
| 299 | void fx_Function_prototype_apply(txMachine* the) |
| 300 | { |
nothing calls this directly
no test coverage detected