Treat uninvoked external-function-references as errors.

Finding a dangling ExternalFunctionReference in the IR should be handled
the same as a FunctionReference; both are equally indicative of a
problem in the user's code.

Change-Id: I5aa9204e692678d7b54d78fc7253d49940dd130a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/442694
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
This commit is contained in:
John Stiles 2021-08-27 15:14:59 -04:00 committed by SkCQ
parent 99ddd2a98d
commit 8ff0394331
2 changed files with 3 additions and 1 deletions

View File

@ -1291,6 +1291,7 @@ void IRGenerator::checkValid(const Expression& expr) {
}
break;
}
case Expression::Kind::kExternalFunctionReference:
case Expression::Kind::kFunctionReference:
case Expression::Kind::kTypeReference:
SkDEBUGFAIL("invalid reference-expression, should have been reported by coerce()");

View File

@ -13,6 +13,7 @@
#include "src/sksl/ir/SkSLConstructorArrayCast.h"
#include "src/sksl/ir/SkSLConstructorCompoundCast.h"
#include "src/sksl/ir/SkSLConstructorScalarCast.h"
#include "src/sksl/ir/SkSLExternalFunctionReference.h"
#include "src/sksl/ir/SkSLFunctionReference.h"
#include "src/sksl/ir/SkSLSymbolTable.h"
#include "src/sksl/ir/SkSLType.h"
@ -705,7 +706,7 @@ std::unique_ptr<Expression> Type::coerceExpression(std::unique_ptr<Expression> e
return nullptr;
}
const int offset = expr->fOffset;
if (expr->is<FunctionReference>()) {
if (expr->is<FunctionReference>() || expr->is<ExternalFunctionReference>()) {
context.fErrors->error(offset, "expected '(' to begin function call");
return nullptr;
}