Lines Matching refs:base
21 static bool index_out_of_range(const Context& context, SKSL_INT index, const Expression& base) {
22 if (index >= 0 && index < base.type().columns()) {
26 context.fErrors->error(base.fLine, "index " + to_string(index) + " out of range for '" +
27 base.type().displayName() + "'");
54 std::unique_ptr<Expression> base,
57 if (base->is<TypeReference>()) {
58 const Type& baseType = base->as<TypeReference>().value();
63 return TypeReference::Convert(context, base->fLine,
67 const Type& baseType = base->type();
69 context.fErrors->error(base->fLine,
83 if (index_out_of_range(context, indexValue, *base)) {
87 return IndexExpression::Make(context, std::move(base), std::move(index));
91 std::unique_ptr<Expression> base,
93 const Type& baseType = base->type();
100 if (!index_out_of_range(context, indexValue, *base)) {
103 // Swizzling is harmless and can unlock further simplifications for some base types.
104 return Swizzle::Make(context, std::move(base), ComponentArray{(int8_t)indexValue});
107 if (baseType.isArray() && !base->hasSideEffects()) {
110 const Expression* baseExpr = ConstantFolder::GetConstantValueForVariable(*base);
120 if (baseType.isMatrix() && !base->hasSideEffects()) {
126 const Expression* baseExpr = ConstantFolder::GetConstantValueForVariable(*base);
152 return std::make_unique<IndexExpression>(context, std::move(base), std::move(index));