| 1471 | } |
| 1472 | |
| 1473 | DataType *SymbolScanner::lookupDataTypeByName(const Token &tok, SymbolScope *scope, bool recursive) |
| 1474 | { |
| 1475 | const string typeName = tok.getStringValue(); |
| 1476 | Symbol *dataTypeSym = scope->getSymbol(typeName, recursive); |
| 1477 | if (!dataTypeSym) |
| 1478 | { |
| 1479 | auto forwardDecl = m_forwardDeclarations.find(typeName); |
| 1480 | if (forwardDecl != m_forwardDeclarations.end()) |
| 1481 | { |
| 1482 | dataTypeSym = forwardDecl->second; |
| 1483 | } |
| 1484 | else |
| 1485 | { |
| 1486 | throw semantic_error(format_string("line %d: undefined name '%s'", tok.getFirstLine(), typeName.c_str())); |
| 1487 | } |
| 1488 | } |
| 1489 | DataType *dataType = dynamic_cast<DataType *>(dataTypeSym); |
| 1490 | if (!dataType) |
| 1491 | { |
| 1492 | throw semantic_error(format_string("line %d: '%s' is not a type", tok.getFirstLine(), typeName.c_str())); |
| 1493 | } |
| 1494 | return dataType; |
| 1495 | } |
| 1496 | |
| 1497 | bool SymbolScanner::containsStructEnumDeclaration(const AstNode *typeNode) |
| 1498 | { |
nothing calls this directly
no test coverage detected