Declare a non-array variable, the main point being there is no redeclaration for resizing allowed. Return the successfully declared variable.
| 9531 | // Return the successfully declared variable. |
| 9532 | // |
| 9533 | TVariable* TParseContext::declareNonArray(const TSourceLoc& loc, const TString& identifier, const TType& type) |
| 9534 | { |
| 9535 | // make a new variable |
| 9536 | TVariable* variable = new TVariable(&identifier, type); |
| 9537 | |
| 9538 | ioArrayCheck(loc, type, identifier); |
| 9539 | |
| 9540 | // add variable to symbol table |
| 9541 | if (symbolTable.insert(*variable)) { |
| 9542 | if (symbolTable.atGlobalLevel()) |
| 9543 | trackLinkage(*variable); |
| 9544 | return variable; |
| 9545 | } |
| 9546 | |
| 9547 | error(loc, "redefinition", variable->getName().c_str(), ""); |
| 9548 | return nullptr; |
| 9549 | } |
| 9550 | |
| 9551 | // |
| 9552 | // Handle all types of initializers from the grammar. |
nothing calls this directly
no test coverage detected