| 1529 | } |
| 1530 | |
| 1531 | Token * clangimport::AstNode::createTokensVarDecl(TokenList &tokenList) |
| 1532 | { |
| 1533 | const std::string addr = mExtTokens.front(); |
| 1534 | if (contains(mExtTokens, "static")) |
| 1535 | addtoken(tokenList, "static"); |
| 1536 | int typeIndex = mExtTokens.size() - 1; |
| 1537 | while (typeIndex > 1 && std::isalpha(mExtTokens[typeIndex][0])) |
| 1538 | typeIndex--; |
| 1539 | const std::string type = mExtTokens[typeIndex]; |
| 1540 | const std::string name = mExtTokens[typeIndex - 1]; |
| 1541 | const Token *startToken = tokenList.back(); |
| 1542 | const ::Type *recordType = addTypeTokens(tokenList, type); |
| 1543 | if (!startToken) |
| 1544 | startToken = tokenList.front(); |
| 1545 | else if (startToken->str() != "static") |
| 1546 | startToken = startToken->next(); |
| 1547 | Token *vartok1 = addtoken(tokenList, name); |
| 1548 | auto *scope = const_cast<Scope *>(tokenList.back()->scope()); |
| 1549 | scope->varlist.emplace_back(vartok1, unquote(type), startToken, vartok1->previous(), 0, scope->defaultAccess(), recordType, scope); |
| 1550 | mData->varDecl(addr, vartok1, &scope->varlist.back()); |
| 1551 | if (mExtTokens.back() == "cinit" && !children.empty()) { |
| 1552 | Token *eq = addtoken(tokenList, "="); |
| 1553 | eq->astOperand1(vartok1); |
| 1554 | eq->astOperand2(children.back()->createTokens(tokenList)); |
| 1555 | return eq; |
| 1556 | } |
| 1557 | if (mExtTokens.back() == "callinit") { |
| 1558 | Token *par1 = addtoken(tokenList, "("); |
| 1559 | par1->astOperand1(vartok1); |
| 1560 | par1->astOperand2(getChild(0)->createTokens(tokenList)); |
| 1561 | Token *par2 = addtoken(tokenList, ")"); |
| 1562 | par1->link(par2); |
| 1563 | par2->link(par1); |
| 1564 | return par1; |
| 1565 | } |
| 1566 | if (mExtTokens.back() == "listinit") { |
| 1567 | return getChild(0)->createTokens(tokenList); |
| 1568 | } |
| 1569 | return vartok1; |
| 1570 | } |
| 1571 | |
| 1572 | static void setTypes(TokenList &tokenList) |
| 1573 | { |
nothing calls this directly
no test coverage detected