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/SkSLAnalysis.cpp b/src/sksl/SkSLAnalysis.cpp
index 8a7d5d7..6a98b64 100644
--- a/src/sksl/SkSLAnalysis.cpp
+++ b/src/sksl/SkSLAnalysis.cpp
@@ -317,7 +317,7 @@
VariableReference& varRef = expr.as<VariableReference>();
const Variable* var = varRef.variable();
if (var->modifiers().fFlags & (Modifiers::kConst_Flag | Modifiers::kUniform_Flag)) {
- fErrors->error(expr.fOffset,
+ fErrors->error(expr.fLine,
"cannot modify immutable variable '" + var->name() + "'");
} else {
SkASSERT(fAssignedVar == nullptr);
@@ -343,7 +343,7 @@
break;
default:
- fErrors->error(expr.fOffset, "cannot assign to this expression");
+ fErrors->error(expr.fLine, "cannot assign to this expression");
break;
}
}
@@ -355,7 +355,7 @@
SkASSERT(idx >= SwizzleComponent::X && idx <= SwizzleComponent::W);
int bit = 1 << idx;
if (bits & bit) {
- fErrors->error(swizzle.fOffset,
+ fErrors->error(swizzle.fLine,
"cannot write to the same swizzle field more than once");
break;
}
@@ -652,7 +652,7 @@
}
}
msg = "potential recursion (function call cycle) not allowed:" + msg;
- fContext.fErrors->error(pe.fOffset, std::move(msg));
+ fContext.fErrors->error(pe.fLine, std::move(msg));
fFunctionSize = iter->second = 0;
return true;
}
@@ -668,7 +668,7 @@
msg += "\n\t" + (*unwind)->description();
}
msg += "\n\t" + decl->description();
- fContext.fErrors->error(pe.fOffset, std::move(msg));
+ fContext.fErrors->error(pe.fLine, std::move(msg));
fFunctionSize = iter->second = 0;
return true;
}
@@ -780,7 +780,7 @@
// Report an error when main()'s flattened size is larger than our program limit.
if (visitor.functionSize() > kProgramSizeLimit &&
element->as<FunctionDefinition>().declaration().isMain()) {
- context.fErrors->error(/*offset=*/-1, "program is too large");
+ context.fErrors->error(/*line=*/-1, "program is too large");
}
}
}
@@ -815,7 +815,7 @@
// Report an error.
SkASSERT(var);
if (errors) {
- errors->error(stmt.fOffset, "variable '" + var->name() + "' must be created in a scope");
+ errors->error(stmt.fLine, "variable '" + var->name() + "' must be created in a scope");
}
return true;
}
@@ -919,8 +919,7 @@
}
if (!info.fAssignedVar) {
if (errors) {
- errors->error(expr->fOffset, "can't assign to expression '" +
- expr->description() + "'");
+ errors->error(expr->fLine, "can't assign to expression '" + expr->description() + "'");
}
return false;
}
@@ -1008,7 +1007,7 @@
}
}
-static const char* invalid_for_ES2(int offset,
+static const char* invalid_for_ES2(int line,
const Statement* loopInitializer,
const Expression* loopTest,
const Expression* loopNext,
@@ -1222,18 +1221,18 @@
return nullptr; // All checks pass
}
-std::unique_ptr<LoopUnrollInfo> Analysis::GetLoopUnrollInfo(int offset,
+std::unique_ptr<LoopUnrollInfo> Analysis::GetLoopUnrollInfo(int line,
const Statement* loopInitializer,
const Expression* loopTest,
const Expression* loopNext,
const Statement* loopStatement,
ErrorReporter* errors) {
auto result = std::make_unique<LoopUnrollInfo>();
- if (const char* msg = invalid_for_ES2(offset, loopInitializer, loopTest, loopNext,
+ if (const char* msg = invalid_for_ES2(line, loopInitializer, loopTest, loopNext,
loopStatement, *result)) {
result = nullptr;
if (errors) {
- errors->error(offset, msg);
+ errors->error(line, msg);
}
}
return result;
@@ -1340,7 +1339,7 @@
const IndexExpression& i = e.as<IndexExpression>();
ConstantExpressionVisitor indexerInvalid(&fLoopIndices);
if (indexerInvalid.visitExpression(*i.index())) {
- fErrors.error(i.fOffset, "index expression must be constant");
+ fErrors.error(i.fLine, "index expression must be constant");
return true;
}
}
@@ -1388,13 +1387,13 @@
switch (stmt.kind()) {
case Statement::Kind::kIf:
if (stmt.as<IfStatement>().isStatic()) {
- fContext.fErrors->error(stmt.fOffset, "static if has non-static test");
+ fContext.fErrors->error(stmt.fLine, "static if has non-static test");
}
break;
case Statement::Kind::kSwitch:
if (stmt.as<SwitchStatement>().isStatic()) {
- fContext.fErrors->error(stmt.fOffset,
+ fContext.fErrors->error(stmt.fLine,
"static switch has non-static test");
}
break;
@@ -1411,8 +1410,8 @@
case Expression::Kind::kFunctionCall: {
const FunctionDeclaration& decl = expr.as<FunctionCall>().function();
if (!decl.isBuiltin() && !decl.definition()) {
- fContext.fErrors->error(expr.fOffset, "function '" + decl.description() +
- "' is not defined");
+ fContext.fErrors->error(expr.fLine, "function '" + decl.description() +
+ "' is not defined");
}
break;
}
@@ -1421,11 +1420,11 @@
case Expression::Kind::kMethodReference:
case Expression::Kind::kTypeReference:
SkDEBUGFAIL("invalid reference-expr, should have been reported by coerce()");
- fContext.fErrors->error(expr.fOffset, "invalid expression");
+ fContext.fErrors->error(expr.fLine, "invalid expression");
break;
default:
if (expr.type() == *fContext.fTypes.fInvalid) {
- fContext.fErrors->error(expr.fOffset, "invalid expression");
+ fContext.fErrors->error(expr.fLine, "invalid expression");
}
break;
}