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/SkSLBinaryExpression.cpp b/src/sksl/ir/SkSLBinaryExpression.cpp
index 8a22052..e79287f 100644
--- a/src/sksl/ir/SkSLBinaryExpression.cpp
+++ b/src/sksl/ir/SkSLBinaryExpression.cpp
@@ -40,7 +40,7 @@
for (int n = 0; n < left.type().rows(); ++n) {
// Get mat[N] with an index expression.
std::unique_ptr<Expression> matN = IndexExpression::Make(
- context, left.clone(), Literal::MakeInt(context, left.fOffset, n));
+ context, left.clone(), Literal::MakeInt(context, left.fLine, n));
// Get vec[N] with a swizzle expression.
std::unique_ptr<Expression> vecN = Swizzle::Make(
context, right.clone(), ComponentArray{(SkSL::SwizzleComponent::Type)n});
@@ -70,7 +70,7 @@
if (!left || !right) {
return nullptr;
}
- const int offset = left->fOffset;
+ const int line = left->fLine;
const Type* rawLeftType = (left->isIntLiteral() && right->type().isInteger())
? &right->type()
@@ -94,29 +94,29 @@
const Type* resultType;
if (!op.determineBinaryType(context, *rawLeftType, *rawRightType,
&leftType, &rightType, &resultType)) {
- context.fErrors->error(offset, String("type mismatch: '") + op.operatorName() +
- "' cannot operate on '" + left->type().displayName() +
- "', '" + right->type().displayName() + "'");
+ context.fErrors->error(line, String("type mismatch: '") + op.operatorName() +
+ "' cannot operate on '" + left->type().displayName() +
+ "', '" + right->type().displayName() + "'");
return nullptr;
}
if (isAssignment && leftType->componentType().isOpaque()) {
- context.fErrors->error(offset, "assignments to opaque type '" + left->type().displayName() +
- "' are not permitted");
+ context.fErrors->error(line, "assignments to opaque type '" + left->type().displayName() +
+ "' are not permitted");
return nullptr;
}
if (context.fConfig->strictES2Mode()) {
if (!op.isAllowedInStrictES2Mode()) {
- context.fErrors->error(offset, String("operator '") + op.operatorName() +
- "' is not allowed");
+ context.fErrors->error(line, String("operator '") + op.operatorName() +
+ "' is not allowed");
return nullptr;
}
if (leftType->isOrContainsArray()) {
// Most operators are already rejected on arrays, but GLSL ES 1.0 is very explicit that
// the *only* operator allowed on arrays is subscripting (and the rules against
// assignment, comparison, and even sequence apply to structs containing arrays as well)
- context.fErrors->error(offset, String("operator '") + op.operatorName() + "' can not "
- "operate on arrays (or structs containing arrays)");
+ context.fErrors->error(line, String("operator '") + op.operatorName() + "' can not "
+ "operate on arrays (or structs containing arrays)");
return nullptr;
}
}
@@ -163,8 +163,8 @@
}
// Perform constant-folding on the expression.
- const int offset = left->fOffset;
- if (std::unique_ptr<Expression> result = ConstantFolder::Simplify(context, offset, *left,
+ const int line = left->fLine;
+ if (std::unique_ptr<Expression> result = ConstantFolder::Simplify(context, line, *left,
op, *right, *resultType)) {
return result;
}
@@ -176,7 +176,7 @@
// : mat * vec)
if (is_low_precision_matrix_vector_multiply(*left, op, *right, *resultType)) {
// Look up `sk_Caps.rewriteMatrixVectorMultiply`.
- auto caps = Setting::Convert(context, offset, "rewriteMatrixVectorMultiply");
+ auto caps = Setting::Convert(context, line, "rewriteMatrixVectorMultiply");
bool capsBitIsTrue = caps->isBoolLiteral() && caps->as<Literal>().boolValue();
if (capsBitIsTrue || !caps->isBoolLiteral()) {
@@ -195,13 +195,13 @@
context,
std::move(caps),
std::move(rewrite),
- std::make_unique<BinaryExpression>(offset, std::move(left), op,
+ std::make_unique<BinaryExpression>(line, std::move(left), op,
std::move(right), resultType));
}
}
}
- return std::make_unique<BinaryExpression>(offset, std::move(left), op,
+ return std::make_unique<BinaryExpression>(line, std::move(left), op,
std::move(right), resultType);
}
@@ -231,7 +231,7 @@
}
std::unique_ptr<Expression> BinaryExpression::clone() const {
- return std::make_unique<BinaryExpression>(fOffset,
+ return std::make_unique<BinaryExpression>(fLine,
this->left()->clone(),
this->getOperator(),
this->right()->clone(),