Made out-of-bounds literals non-fatal errors in DSLParser
There was no good reason for this behavior in the first place, and this change makes the error reporting behavior better match SkSLParser. Change-Id: I7b69e7bcc64173c0ac6523e075c1f24e2be00ed0 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/444758 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
This commit is contained in:
parent
2ecc595e86
commit
0459a93734
@ -1639,25 +1639,23 @@ skstd::optional<DSLWrapper<DSLExpression>> DSLParser::term() {
|
||||
}
|
||||
case Token::Kind::TK_INT_LITERAL: {
|
||||
SKSL_INT i;
|
||||
if (this->intLiteral(&i)) {
|
||||
return {{DSLExpression(i, this->position(t))}};
|
||||
if (!this->intLiteral(&i)) {
|
||||
i = 0;
|
||||
}
|
||||
break;
|
||||
return {{DSLExpression(i, this->position(t))}};
|
||||
}
|
||||
case Token::Kind::TK_FLOAT_LITERAL: {
|
||||
SKSL_FLOAT f;
|
||||
if (this->floatLiteral(&f)) {
|
||||
return {{DSLExpression(f, this->position(t))}};
|
||||
if (!this->floatLiteral(&f)) {
|
||||
f = 0.0f;
|
||||
}
|
||||
break;
|
||||
return {{DSLExpression(f, this->position(t))}};
|
||||
}
|
||||
case Token::Kind::TK_TRUE_LITERAL: // fall through
|
||||
case Token::Kind::TK_FALSE_LITERAL: {
|
||||
bool b;
|
||||
if (this->boolLiteral(&b)) {
|
||||
return {{DSLExpression(b, this->position(t))}};
|
||||
}
|
||||
break;
|
||||
SkAssertResult(this->boolLiteral(&b));
|
||||
return {{DSLExpression(b, this->position(t))}};
|
||||
}
|
||||
case Token::Kind::TK_LPAREN: {
|
||||
this->nextToken();
|
||||
|
Loading…
Reference in New Issue
Block a user