Fix bug in C# detection code. The test had a bug also, so it was not detected by the test.
This commit is contained in:
parent
8cb53107dd
commit
1afd923d34
|
@ -1982,9 +1982,7 @@ bool Tokenizer::tokenize(std::istream &code,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert C# code
|
// Convert C# code
|
||||||
// FIXME: This should be if(isCSharp()), but that makes the lines 5931 and
|
if (isCSharp()) {
|
||||||
// 5932 of test/testtokenize.cpp fail.
|
|
||||||
if (_files[0].find(".cs")) {
|
|
||||||
for (Token *tok = _tokens; tok; tok = tok->next()) {
|
for (Token *tok = _tokens; tok; tok = tok->next()) {
|
||||||
if (Token::Match(tok, "%type% [ ] %var% [=;]") &&
|
if (Token::Match(tok, "%type% [ ] %var% [=;]") &&
|
||||||
(!tok->previous() || Token::Match(tok->previous(), "[;{}]"))) {
|
(!tok->previous() || Token::Match(tok->previous(), "[;{}]"))) {
|
||||||
|
|
|
@ -5928,8 +5928,12 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
void cs() {
|
void cs() {
|
||||||
ASSERT_EQUALS("int * i ;", tokenizeAndStringify("int [] i;"));
|
bool simplify = false;
|
||||||
ASSERT_EQUALS("; int * i ;", tokenizeAndStringify("; int [] i;"));
|
bool expand = true;
|
||||||
|
Settings::PlatformType platform = Settings::Unspecified;
|
||||||
|
const std::string filename="test.cs";
|
||||||
|
ASSERT_EQUALS("int * i ;", tokenizeAndStringify("int [] i;", simplify, expand, platform, filename));
|
||||||
|
ASSERT_EQUALS("; int * i ;", tokenizeAndStringify("; int [] i;", simplify, expand, platform, filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string javatest(const char javacode[]) {
|
std::string javatest(const char javacode[]) {
|
||||||
|
|
Loading…
Reference in New Issue