| 4397 | } |
| 4398 | |
| 4399 | void fxSwitchNodeCode(void* it, void* param) |
| 4400 | { |
| 4401 | txSwitchNode* self = it; |
| 4402 | txCoder* coder = param; |
| 4403 | txTargetCode* breakTarget; |
| 4404 | txCaseNode* caseNode; |
| 4405 | txCaseNode* defaultNode = NULL; |
| 4406 | txUsingContext context; |
| 4407 | fxNodeDispatchCode(self->expression, param); |
| 4408 | fxScopeCodingBlock(self->scope, param); |
| 4409 | if (self->scope->disposableNodeCount) |
| 4410 | fxScopeCodeUsing(self->scope, coder, &context); |
| 4411 | breakTarget = fxCoderCreateTarget(coder); |
| 4412 | breakTarget->label = fxNewParserChunkClear(coder->parser, sizeof(txLabelNode)); |
| 4413 | breakTarget->nextTarget = coder->firstBreakTarget; |
| 4414 | coder->firstBreakTarget = breakTarget; |
| 4415 | if (coder->programFlag) { |
| 4416 | fxCoderAddByte(param, 1, XS_CODE_UNDEFINED); |
| 4417 | fxCoderAddByte(param, -1, XS_CODE_SET_RESULT); |
| 4418 | } |
| 4419 | caseNode = (txCaseNode*)self->items->first; |
| 4420 | while (caseNode) { |
| 4421 | caseNode->target = fxCoderCreateTarget(param); |
| 4422 | if (caseNode->expression) { |
| 4423 | fxCoderAddByte(param, 1, XS_CODE_DUB); |
| 4424 | fxNodeDispatchCode(caseNode->expression, param); |
| 4425 | fxCoderAddByte(param, -1, XS_CODE_STRICT_EQUAL); |
| 4426 | fxCoderAddBranch(param, -1, XS_CODE_BRANCH_IF_1, caseNode->target); |
| 4427 | } |
| 4428 | else |
| 4429 | defaultNode = caseNode; |
| 4430 | caseNode = (txCaseNode*)caseNode->next; |
| 4431 | } |
| 4432 | if (defaultNode) |
| 4433 | fxCoderAddBranch(param, 0, XS_CODE_BRANCH_1, defaultNode->target); |
| 4434 | else |
| 4435 | fxCoderAddBranch(param, 0, XS_CODE_BRANCH_1, coder->firstBreakTarget); |
| 4436 | caseNode = (txCaseNode*)self->items->first; |
| 4437 | while (caseNode) { |
| 4438 | fxCoderAdd(param, 0, caseNode->target); |
| 4439 | if (caseNode->statement) |
| 4440 | fxNodeDispatchCode(caseNode->statement, param); |
| 4441 | caseNode = (txCaseNode*)caseNode->next; |
| 4442 | } |
| 4443 | fxCoderAdd(param, 0, coder->firstBreakTarget); |
| 4444 | coder->firstBreakTarget = breakTarget->nextTarget; |
| 4445 | if (self->scope->disposableNodeCount) |
| 4446 | fxScopeCodeUsed(self->scope, coder, &context); |
| 4447 | fxScopeCoded(self->scope, param); |
| 4448 | fxCoderAddByte(param, -1, XS_CODE_POP); |
| 4449 | } |
| 4450 | |
| 4451 | void fxTemplateNodeCode(void* it, void* param) |
| 4452 | { |
nothing calls this directly
no test coverage detected