diff options
Diffstat (limited to 'gfx/skia/skia/src/sksl/ir/SkSLLiteral.cpp')
-rw-r--r-- | gfx/skia/skia/src/sksl/ir/SkSLLiteral.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gfx/skia/skia/src/sksl/ir/SkSLLiteral.cpp b/gfx/skia/skia/src/sksl/ir/SkSLLiteral.cpp new file mode 100644 index 0000000000..aa8c5c4440 --- /dev/null +++ b/gfx/skia/skia/src/sksl/ir/SkSLLiteral.cpp @@ -0,0 +1,23 @@ +/* + * Copyright 2022 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "include/private/SkSLString.h" +#include "src/sksl/ir/SkSLLiteral.h" + +namespace SkSL { + +std::string Literal::description(OperatorPrecedence) const { + if (this->type().isBoolean()) { + return fValue ? "true" : "false"; + } + if (this->type().isInteger()) { + return std::to_string(this->intValue()); + } + return skstd::to_string(this->floatValue()); +} + +} // namespace SkSL |