Revert "Renamed SkSL "offset" to "line""
This reverts commit 58d47fa1ec2c2e7dd77ad48194801375275a401c.
Reason for revert: Tree broken
Original change's description:
> Renamed SkSL "offset" to "line"
>
> https://skia-review.googlesource.com/c/skia/+/451419 changed the meaning
> of "offset" throughout SkSL, so that it was actually tracking line
> numbers rather than offsets (and thus had a misleading name). This
> completes the transition by renaming all of the now-misnamed "offset"
> fields, parameters, and variables to "line'.
>
> Bug: skia:12459
> Change-Id: I394e6441f6ddfaad6d4098352ba9b1bfeaf273be
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/450644
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> Reviewed-by: John Stiles <johnstiles@google.com>
Bug: skia:12459
Change-Id: Idcec3b65cb81d51c8b860c4388578700030b40a9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452718
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
diff --git a/src/sksl/SkSLAnalysis.cpp b/src/sksl/SkSLAnalysis.cpp
index 6a98b64..8a7d5d7 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.fLine,
+ fErrors->error(expr.fOffset,
"cannot modify immutable variable '" + var->name() + "'");
} else {
SkASSERT(fAssignedVar == nullptr);
@@ -343,7 +343,7 @@
break;
default:
- fErrors->error(expr.fLine, "cannot assign to this expression");
+ fErrors->error(expr.fOffset, "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.fLine,
+ fErrors->error(swizzle.fOffset,
"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.fLine, std::move(msg));
+ fContext.fErrors->error(pe.fOffset, 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.fLine, std::move(msg));
+ fContext.fErrors->error(pe.fOffset, 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(/*line=*/-1, "program is too large");
+ context.fErrors->error(/*offset=*/-1, "program is too large");
}
}
}
@@ -815,7 +815,7 @@
// Report an error.
SkASSERT(var);
if (errors) {
- errors->error(stmt.fLine, "variable '" + var->name() + "' must be created in a scope");
+ errors->error(stmt.fOffset, "variable '" + var->name() + "' must be created in a scope");
}
return true;
}
@@ -919,7 +919,8 @@
}
if (!info.fAssignedVar) {
if (errors) {
- errors->error(expr->fLine, "can't assign to expression '" + expr->description() + "'");
+ errors->error(expr->fOffset, "can't assign to expression '" +
+ expr->description() + "'");
}
return false;
}
@@ -1007,7 +1008,7 @@
}
}
-static const char* invalid_for_ES2(int line,
+static const char* invalid_for_ES2(int offset,
const Statement* loopInitializer,
const Expression* loopTest,
const Expression* loopNext,
@@ -1221,18 +1222,18 @@
return nullptr; // All checks pass
}
-std::unique_ptr<LoopUnrollInfo> Analysis::GetLoopUnrollInfo(int line,
+std::unique_ptr<LoopUnrollInfo> Analysis::GetLoopUnrollInfo(int offset,
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(line, loopInitializer, loopTest, loopNext,
+ if (const char* msg = invalid_for_ES2(offset, loopInitializer, loopTest, loopNext,
loopStatement, *result)) {
result = nullptr;
if (errors) {
- errors->error(line, msg);
+ errors->error(offset, msg);
}
}
return result;
@@ -1339,7 +1340,7 @@
const IndexExpression& i = e.as<IndexExpression>();
ConstantExpressionVisitor indexerInvalid(&fLoopIndices);
if (indexerInvalid.visitExpression(*i.index())) {
- fErrors.error(i.fLine, "index expression must be constant");
+ fErrors.error(i.fOffset, "index expression must be constant");
return true;
}
}
@@ -1387,13 +1388,13 @@
switch (stmt.kind()) {
case Statement::Kind::kIf:
if (stmt.as<IfStatement>().isStatic()) {
- fContext.fErrors->error(stmt.fLine, "static if has non-static test");
+ fContext.fErrors->error(stmt.fOffset, "static if has non-static test");
}
break;
case Statement::Kind::kSwitch:
if (stmt.as<SwitchStatement>().isStatic()) {
- fContext.fErrors->error(stmt.fLine,
+ fContext.fErrors->error(stmt.fOffset,
"static switch has non-static test");
}
break;
@@ -1410,8 +1411,8 @@
case Expression::Kind::kFunctionCall: {
const FunctionDeclaration& decl = expr.as<FunctionCall>().function();
if (!decl.isBuiltin() && !decl.definition()) {
- fContext.fErrors->error(expr.fLine, "function '" + decl.description() +
- "' is not defined");
+ fContext.fErrors->error(expr.fOffset, "function '" + decl.description() +
+ "' is not defined");
}
break;
}
@@ -1420,11 +1421,11 @@
case Expression::Kind::kMethodReference:
case Expression::Kind::kTypeReference:
SkDEBUGFAIL("invalid reference-expr, should have been reported by coerce()");
- fContext.fErrors->error(expr.fLine, "invalid expression");
+ fContext.fErrors->error(expr.fOffset, "invalid expression");
break;
default:
if (expr.type() == *fContext.fTypes.fInvalid) {
- fContext.fErrors->error(expr.fLine, "invalid expression");
+ fContext.fErrors->error(expr.fOffset, "invalid expression");
}
break;
}