MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxParamsNodeCode

Function fxParamsNodeCode

xs/sources/xsCode.c:4068–4118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4066}
4067
4068void fxParamsNodeCode(void* it, void* param)
4069{
4070 txParamsNode* self = it;
4071 txInteger c = 0;
4072 if (self->flags & mxSpreadFlag) {
4073 txInteger counter = fxCoderUseTemporaryVariable(param);
4074 fxCoderAddInteger(param, 1, XS_CODE_INTEGER_1, 0);
4075 fxCoderAddIndex(param, 0, XS_CODE_SET_LOCAL_1, counter);
4076 fxCoderAddByte(param, -1, XS_CODE_POP);
4077 if (self->items) {
4078 txNode* item = self->items->first;
4079 while (item) {
4080 if (item->description->token == XS_TOKEN_SPREAD) {
4081 fxSpreadNodeCode(item, param, counter);
4082 }
4083 else {
4084 c++;
4085 fxNodeDispatchCode(item, param);
4086 fxCoderAddIndex(param, 1, XS_CODE_GET_LOCAL_1, counter);
4087 fxCoderAddInteger(param, 1, XS_CODE_INTEGER_1, 1);
4088 fxCoderAddByte(param, -1, XS_CODE_ADD);
4089 fxCoderAddIndex(param, 0, XS_CODE_SET_LOCAL_1, counter);
4090 fxCoderAddByte(param, -1, XS_CODE_POP);
4091 }
4092 item = item->next;
4093 }
4094 }
4095 fxCoderAddIndex(param, 1, XS_CODE_GET_LOCAL_1, counter);
4096 if (self->flags & mxEvalParametersFlag)
4097 fxCoderAddByte(param, -3 - c, (self->flags & mxTailRecursionFlag) ? XS_CODE_EVAL_TAIL : XS_CODE_EVAL);
4098 else
4099 fxCoderAddByte(param, -3 - c, (self->flags & mxTailRecursionFlag) ? XS_CODE_RUN_TAIL : XS_CODE_RUN);
4100 fxCoderUnuseTemporaryVariables(param, 1);
4101 }
4102 else {
4103 if (self->items) {
4104 txNode* item = self->items->first;
4105 while (item) {
4106 fxNodeDispatchCode(item, param);
4107 c++;
4108 item = item->next;
4109 }
4110 if (self->flags & mxEvalParametersFlag) {
4111 fxCoderAddInteger(param, 1, XS_CODE_INTEGER_1, c);
4112 fxCoderAddByte(param, -3 - c, (self->flags & mxTailRecursionFlag) ? XS_CODE_EVAL_TAIL : XS_CODE_EVAL);
4113 }
4114 else
4115 fxCoderAddInteger(param, -2 - c, (self->flags & mxTailRecursionFlag) ? XS_CODE_RUN_TAIL_1 : XS_CODE_RUN_1, c);
4116 }
4117 }
4118}
4119
4120void fxParamsBindingNodeCode(void* it, void* param)
4121{

Callers

nothing calls this directly

Calls 7

fxCoderAddIntegerFunction · 0.85
fxCoderAddIndexFunction · 0.85
fxCoderAddByteFunction · 0.85
fxSpreadNodeCodeFunction · 0.85
fxNodeDispatchCodeFunction · 0.85

Tested by

no test coverage detected