| 961 | } |
| 962 | |
| 963 | void fxLinkTransfer(txMachine* the, txSlot* module, txID importID, txSlot* transfer) |
| 964 | { |
| 965 | txSlot* export; |
| 966 | txSlot* exportClosure; |
| 967 | txSlot* transferClosure; |
| 968 | txSlot* from; |
| 969 | txSlot* import; |
| 970 | |
| 971 | export = mxBehaviorGetProperty(the, mxModuleExports(module)->value.reference, importID, 0, XS_OWN); |
| 972 | if (export) { |
| 973 | if (export->kind == XS_EXPORT_KIND) { |
| 974 | if (export->value.export.closure == C_NULL) { |
| 975 | txString path = C_NULL; |
| 976 | txInteger line = 0; |
| 977 | #ifdef mxDebug |
| 978 | txSlot* slot = mxTransferClosure(transfer)->next; |
| 979 | if (slot) { |
| 980 | path = slot->value.string; |
| 981 | line = slot->next->value.integer; |
| 982 | } |
| 983 | #endif |
| 984 | fxIDToString(the, importID, the->nameBuffer, sizeof(the->nameBuffer)); |
| 985 | fxThrowMessage(the, path, line, XS_SYNTAX_ERROR, "import %s ambiguous", the->nameBuffer); |
| 986 | } |
| 987 | transferClosure = mxTransferClosure(transfer); |
| 988 | transferClosure->value = export->value; |
| 989 | transferClosure->kind = export->kind; |
| 990 | } |
| 991 | else { |
| 992 | exportClosure = mxTransferClosure(export); |
| 993 | if (exportClosure->kind != XS_NULL_KIND) { |
| 994 | transferClosure = mxTransferClosure(transfer); |
| 995 | transferClosure->value = exportClosure->value; |
| 996 | transferClosure->kind = exportClosure->kind; |
| 997 | } |
| 998 | else { |
| 999 | from = mxTransferFrom(export); |
| 1000 | import = mxTransferImport(export); |
| 1001 | if (((from->value.reference == module->value.reference) && (import->value.symbol == importID)) |
| 1002 | || ((from->value.reference == mxTransferFrom(transfer)->value.reference) && (import->value.symbol == mxTransferImport(transfer)->value.symbol))) { |
| 1003 | txString path = C_NULL; |
| 1004 | txInteger line = 0; |
| 1005 | #ifdef mxDebug |
| 1006 | txSlot* slot = mxTransferClosure(transfer)->next; |
| 1007 | if (slot) { |
| 1008 | path = slot->value.string; |
| 1009 | line = slot->next->value.integer; |
| 1010 | } |
| 1011 | #endif |
| 1012 | fxIDToString(the, importID, the->nameBuffer, sizeof(the->nameBuffer)); |
| 1013 | fxThrowMessage(the, path, line, XS_SYNTAX_ERROR, "import %s circular", the->nameBuffer); |
| 1014 | } |
| 1015 | fxCheckCStack(the); |
| 1016 | fxLinkTransfer(the, from, import->value.symbol, transfer); |
| 1017 | } |
| 1018 | } |
| 1019 | } |
| 1020 | else { |
no test coverage detected