Lines Matching defs:context

21 static bool index_out_of_range(const Context& context, SKSL_INT index, const Expression& base) {
26 context.fErrors->error(base.fLine, "index " + to_string(index) + " out of range for '" +
31 const Type& IndexExpression::IndexType(const Context& context, const Type& type) {
33 if (type.componentType() == *context.fTypes.fFloat) {
35 case 2: return *context.fTypes.fFloat2;
36 case 3: return *context.fTypes.fFloat3;
37 case 4: return *context.fTypes.fFloat4;
40 } else if (type.componentType() == *context.fTypes.fHalf) {
42 case 2: return *context.fTypes.fHalf2;
43 case 3: return *context.fTypes.fHalf3;
44 case 4: return *context.fTypes.fHalf4;
52 std::unique_ptr<Expression> IndexExpression::Convert(const Context& context,
59 SKSL_INT arraySize = baseType.convertArraySize(context, std::move(index));
63 return TypeReference::Convert(context, base->fLine,
69 context.fErrors->error(base->fLine,
74 index = context.fTypes.fInt->coerceExpression(std::move(index), context);
83 if (index_out_of_range(context, indexValue, *base)) {
87 return IndexExpression::Make(context, std::move(base), std::move(index));
90 std::unique_ptr<Expression> IndexExpression::Make(const Context& context,
100 if (!index_out_of_range(context, indexValue, *base)) {
104 return Swizzle::Make(context, std::move(base), ComponentArray{(int8_t)indexValue});
129 const Type& vecType = scalarType.toCompound(context, vecWidth, /*rows=*/1);
146 return ConstructorCompound::Make(context, line, vecType, std::move(ctorArgs));
152 return std::make_unique<IndexExpression>(context, std::move(base), std::move(index));