Const correctness in generated code and in code generators. Added missing \reflection\generate_code.bat file. (#4679)

This commit is contained in:
Flaviu
2018-03-23 17:58:07 +02:00
committed by Wouter van Oortmerssen
parent c0a6e5120d
commit 79f62ee353
16 changed files with 306 additions and 270 deletions

View File

@@ -205,7 +205,7 @@ enum {
};
static std::string TokenToString(int t) {
static const char *tokens[] = {
static const char * const tokens[] = {
#define FLATBUFFERS_TOKEN(NAME, VALUE, STRING) STRING,
FLATBUFFERS_GEN_TOKENS(FLATBUFFERS_TOKEN)
#undef FLATBUFFERS_TOKEN
@@ -225,7 +225,7 @@ static std::string TokenToString(int t) {
}
// clang-format on
std::string Parser::TokenToStringId(int t) {
std::string Parser::TokenToStringId(int t) const {
return t == kTokenIdentifier ? attribute_ : TokenToString(t);
}
@@ -478,9 +478,9 @@ CheckedError Parser::Next() {
}
// Check if a given token is next.
bool Parser::Is(int t) { return t == token_; }
bool Parser::Is(int t) const { return t == token_; }
bool Parser::IsIdent(const char *id) {
bool Parser::IsIdent(const char *id) const {
return token_ == kTokenIdentifier && attribute_ == id;
}