Fixed line number of DSLParser struct errors

RedeclareStructTypeWithName was reporting an error on the wrong line.

Change-Id: Ibe954ca5013dbedca8cf015660cf3d28fa97987d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/445101
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
This commit is contained in:
Ethan Nicholas 2021-09-02 10:38:22 -04:00 committed by SkCQ
parent b9c6489133
commit 38ccf67b7b

View File

@ -545,15 +545,14 @@ skstd::optional<DSLType> DSLParser::structDeclaration() {
/* structDeclaration ((IDENTIFIER varDeclarationEnd) | SEMICOLON) */
SkTArray<dsl::DSLGlobalVar> DSLParser::structVarDeclaration(const DSLModifiers& modifiers) {
PositionInfo pos = this->position(this->peek());
skstd::optional<DSLType> type = this->structDeclaration();
if (!type) {
return {};
}
Token name;
if (this->checkNext(Token::Kind::TK_IDENTIFIER, &name)) {
return this->varDeclarationEnd<DSLGlobalVar>(pos, modifiers, std::move(*type),
this->text(name));
return this->varDeclarationEnd<DSLGlobalVar>(this->position(name), modifiers,
std::move(*type), this->text(name));
}
this->expect(Token::Kind::TK_SEMICOLON, "';'");
return {};