Reland "Renamed SkSL "offset" to "line""
This reverts commit cc91452f0a65f261283615db9ed3d37b1c3acd15.
Change-Id: I7eff0ddeebef4ce298893f9b3ba410b09647e9a4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/453138
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/src/sksl/ir/SkSLFunctionDefinition.cpp b/src/sksl/ir/SkSLFunctionDefinition.cpp
index a92aa58..fd5e3bb 100644
--- a/src/sksl/ir/SkSLFunctionDefinition.cpp
+++ b/src/sksl/ir/SkSLFunctionDefinition.cpp
@@ -17,7 +17,7 @@
namespace SkSL {
std::unique_ptr<FunctionDefinition> FunctionDefinition::Convert(const Context& context,
- int offset,
+ int line,
const FunctionDeclaration& function,
std::unique_ptr<Statement> body,
bool builtin) {
@@ -56,7 +56,7 @@
// issue, we can add normalization before each return statement.
if (fContext.fConfig->fKind == ProgramKind::kVertex && fFunction.isMain()) {
fContext.fErrors->error(
- stmt.fOffset,
+ stmt.fLine,
"early returns from vertex programs are not supported");
}
@@ -70,13 +70,13 @@
} else {
// Returning something from a function with a void return type.
returnStmt.setExpression(nullptr);
- fContext.fErrors->error(returnStmt.fOffset,
+ fContext.fErrors->error(returnStmt.fLine,
"may not return a value from a void function");
}
} else {
if (this->functionReturnsValue()) {
// Returning nothing from a function with a non-void return type.
- fContext.fErrors->error(returnStmt.fOffset,
+ fContext.fErrors->error(returnStmt.fLine,
"expected function to return '" +
fFunction.returnType().displayName() + "'");
}
@@ -102,7 +102,7 @@
}
case Statement::Kind::kBreak:
if (fBreakableLevel == 0) {
- fContext.fErrors->error(stmt.fOffset,
+ fContext.fErrors->error(stmt.fLine,
"break statement must be inside a loop or switch");
}
break;
@@ -111,10 +111,10 @@
if (std::any_of(fContinuableLevel.begin(),
fContinuableLevel.end(),
[](int level) { return level > 0; })) {
- fContext.fErrors->error(stmt.fOffset,
+ fContext.fErrors->error(stmt.fLine,
"continue statement cannot be used in a switch");
} else {
- fContext.fErrors->error(stmt.fOffset,
+ fContext.fErrors->error(stmt.fLine,
"continue statement must be inside a loop");
}
}
@@ -143,11 +143,11 @@
Finalizer(context, function, &referencedIntrinsics).visitStatement(*body);
if (Analysis::CanExitWithoutReturningValue(function, *body)) {
- context.fErrors->error(function.fOffset, "function '" + function.name() +
+ context.fErrors->error(function.fLine, "function '" + function.name() +
"' can exit without returning a value");
}
- return std::make_unique<FunctionDefinition>(offset, &function, builtin, std::move(body),
+ return std::make_unique<FunctionDefinition>(line, &function, builtin, std::move(body),
std::move(referencedIntrinsics));
}