| 1463 | } |
| 1464 | |
| 1465 | TypeInfo* GetCurrentArgumentType(const char *pos, unsigned arguments) |
| 1466 | { |
| 1467 | if(!currFunction) |
| 1468 | ThrowError(pos, "ERROR: cannot infer type for inline function outside of the function call"); |
| 1469 | |
| 1470 | HashMap<FunctionInfo*>::Node *currF = NULL; |
| 1471 | if(newType) |
| 1472 | { |
| 1473 | unsigned betterHash = newType->nameHash; |
| 1474 | betterHash = StringHashContinue(betterHash, "::"); |
| 1475 | betterHash = StringHashContinue(betterHash, currFunction); |
| 1476 | currF = funcMap.first(betterHash); |
| 1477 | } |
| 1478 | if(!currF) |
| 1479 | { |
| 1480 | FunctionSelect f; |
| 1481 | NamespaceSelect(InplaceStr(currFunction), f); |
| 1482 | currF = f.curr; |
| 1483 | } |
| 1484 | TypeInfo **typeInstance = NULL; |
| 1485 | const char *tmpPos = NULL; |
| 1486 | |
| 1487 | if(!currF && (tmpPos = strchr(currFunction, '<')) != NULL && tmpPos < strchr(currFunction, ':')) |
| 1488 | { |
| 1489 | // find class to enable aliases |
| 1490 | typeInstance = CodeInfo::classMap.find(GetStringHash(currFunction, strchr(currFunction, ':'))); |
| 1491 | unsigned betterHash = GetStringHash(currFunction, strchr(currFunction, '<')); |
| 1492 | betterHash = StringHashContinue(betterHash, strchr(currFunction, ':')); |
| 1493 | currF = funcMap.first(betterHash); |
| 1494 | } |
| 1495 | AliasInfo *info = typeInstance ? (*typeInstance)->childAlias : NULL; |
| 1496 | while(info) |
| 1497 | { |
| 1498 | CodeInfo::classMap.insert(info->nameHash, info->type); |
| 1499 | info = info->next; |
| 1500 | } |
| 1501 | TypeInfo *preferredType = NULL; |
| 1502 | while(currF) |
| 1503 | { |
| 1504 | FunctionInfo *func = currF->value; |
| 1505 | if(func->visible && !((func->address & 0x80000000) && (func->address != -1)) && func->funcType && func->paramCount > currArgument) |
| 1506 | { |
| 1507 | unsigned tmpCount = func->funcType->funcType->paramCount; |
| 1508 | func->funcType->funcType->paramCount = currArgument; |
| 1509 | unsigned rating = GetFunctionRating(func->funcType->funcType, currArgument); |
| 1510 | func->funcType->funcType->paramCount = tmpCount; |
| 1511 | if(rating == ~0u) |
| 1512 | { |
| 1513 | currF = funcMap.next(currF); |
| 1514 | continue; |
| 1515 | } |
| 1516 | TypeInfo *argType = NULL; |
| 1517 | if(func->generic) |
| 1518 | { |
| 1519 | // Having only a partial set of arguments, begin parsing arguments to the point that the current argument will be known |
| 1520 | Lexeme *start = CodeInfo::lexStart + func->generic->start; |
| 1521 | |
| 1522 | // Save current type |
no test coverage detected