skia2/src/sksl/SkSLContext.cpp
John Stiles ac01aca0fe Migrate BuiltinTypes to a separate file from Context.
No code or functionality changes.

Change-Id: I24317767570ae9ebbfea56f873d98709fb22d8b9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354876
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-01-15 17:23:16 +00:00

44 lines
1.0 KiB
C++

/*
* Copyright 2021 Google LLC
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "src/sksl/SkSLContext.h"
namespace SkSL {
/**
* Used as a sentinel expression during dataflow analysis, when an exact value for a variable can't
* be determined at compile-time.
*/
class DefinedExpression final : public Expression {
public:
static constexpr Kind kExpressionKind = Kind::kDefined;
DefinedExpression(const Type* type)
: INHERITED(/*offset=*/-1, kExpressionKind, type) {}
bool hasProperty(Property property) const override {
return false;
}
String description() const override {
return "<defined>";
}
std::unique_ptr<Expression> clone() const override {
return std::make_unique<DefinedExpression>(&this->type());
}
using INHERITED = Expression;
};
Context::Context(ErrorReporter& errors)
: fErrors(errors)
, fDefined_Expression(std::make_unique<DefinedExpression>(fTypes.fInvalid.get())) {}
} // namespace SkSL